diff --git a/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua index b8a421d8b..b3cdabac1 100644 --- a/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_basicItem/client/main.lua @@ -25,12 +25,12 @@ AddEventHandler("DMVCARD:USE", function() Wait(1) end) -RegisterNetEvent("WCARD:USE") -AddEventHandler("WCARD:USE", function() +RegisterNetEvent("weapon:USE") +AddEventHandler("weapon:USE", function() closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestDistance ~= -1 and closestDistance <= 2.0 then ESX.ShowNotification((playerReceiveCard):format(GetPlayerName(closestPlayer))) - TriggerServerEvent("bpt_idcardidcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), + TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), "weapon") else TriggerServerEvent("bpt_idcard:open", GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), "weapon") diff --git a/server-data/resources/[bpt_addons]/bpt_basicItem/server/main.lua b/server-data/resources/[bpt_addons]/bpt_basicItem/server/main.lua index 4f7cdd4d1..f29f9d951 100644 --- a/server-data/resources/[bpt_addons]/bpt_basicItem/server/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_basicItem/server/main.lua @@ -12,5 +12,5 @@ end) ESX.RegisterUsableItem("licensecard", function(source) local _source = source - TriggerClientEvent("WCARD:USE", _source) + TriggerClientEvent("weapon:USE", _source) end) diff --git a/server-data/resources/[bpt_addons]/bpt_policejob/client/main.lua b/server-data/resources/[bpt_addons]/bpt_policejob/client/main.lua index a3281820e..89dfd2382 100644 --- a/server-data/resources/[bpt_addons]/bpt_policejob/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_policejob/client/main.lua @@ -3,7 +3,7 @@ local HasAlreadyEnteredMarker, isDead, isHandcuffed, hasAlreadyJoined, playerInS local LastStation, LastPart, LastPartNum, LastEntity, CurrentAction, CurrentActionMsg dragStatus.isDragged, isInShopMenu = false, false -function cleanPlayer(playerPed) +function CleanPlayer(playerPed) SetPedArmour(playerPed, 0) ClearPedBloodDamage(playerPed) ResetPedVisibleDamage(playerPed) @@ -11,7 +11,7 @@ function cleanPlayer(playerPed) ResetPedMovementClipset(playerPed, 0) end -function setUniform(uniform, playerPed) +function SetUniform(uniform, playerPed) TriggerEvent("skinchanger:getSkin", function(skin) local uniformObject @@ -44,7 +44,7 @@ function OpenCloakroomMenu() } ESX.OpenContext("right", elements, function(menu, element) - cleanPlayer(playerPed) + CleanPlayer(playerPed) local data = { current = element } if data.current.value == "citizen_wear" then @@ -143,7 +143,7 @@ function OpenCloakroomMenu() end if data.current.uniform then - setUniform(data.current.uniform, playerPed) + SetUniform(data.current.uniform, playerPed) elseif data.current.value == "freemode_ped" then local modelHash @@ -230,6 +230,7 @@ function OpenPoliceActionsMenu() { icon = "fas fa-idkyet", title = TranslateCap("put_in_vehicle"), value = "put_in_vehicle" }, { icon = "fas fa-idkyet", title = TranslateCap("out_the_vehicle"), value = "out_the_vehicle" }, { icon = "fas fa-idkyet", title = TranslateCap("fine"), value = "fine" }, + { icon = "fas fa-idkyet", title = TranslateCap("weapon"), value = "weapon" }, { icon = "fas fa-idkyet", title = TranslateCap("unpaid_bills"), value = "unpaid_bills" }, } @@ -261,6 +262,10 @@ function OpenPoliceActionsMenu() TriggerServerEvent("bpt_policejob:OutVehicle", GetPlayerServerId(closestPlayer)) elseif action == "fine" then OpenFineMenu(closestPlayer) + elseif action == 'weapon' then + TriggerServerEvent('esx_license:addLicense', GetPlayerServerId(closestPlayer), 'weapon') + ESX.ShowNotification('Hai rilasciato il porto d\'armi') + TriggerServerEvent('bpt_policejob:message', GetPlayerServerId(closestPlayer), 'Ti รจ stato rilasciato il porto d\'armi dalla Polizia') elseif action == "license" then ShowPlayerLicense(closestPlayer) elseif action == "unpaid_bills" then @@ -633,7 +638,7 @@ function OpenUnpaidBillsMenu(player) } ESX.TriggerServerCallback("bpt_billing:getTargetBills", function(bills) - for k, bill in ipairs(bills) do + for _, bill in ipairs(bills) do elements[#elements + 1] = { unselectable = true, icon = "fas fa-scroll", @@ -940,27 +945,6 @@ function OnPlayerData(k, v) end end -RegisterNetEvent("esx_phone:loaded") -AddEventHandler("esx_phone:loaded", function(phoneNumber, contacts) - local specialContact = { - name = TranslateCap("phone_police"), - number = "police", - base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDFGQTJDRkI0QUJCMTFFN0JBNkQ5OENBMUI4QU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juHWshwmwOE1iMmCFYEzg1jtIm1BaxW6wCGGoFdewPfvyE4ertTiv4rHC73B855dwp2a23bbd4tC1hvhOCbX7b4VyUQKhxrtSOaYKngasizvwi0RmOS4O1QZf2yYfiaR+73AvhTQEVf+rpn9/8IMAChKDrDzfsdIQAAAABJRU5ErkJggg==", - } - - TriggerEvent("esx_phone:addSpecialContact", specialContact.name, specialContact.number, specialContact.base64Icon) -end) - --- don't show dispatches if the player isn't in service -AddEventHandler("esx_phone:cancelMessage", function(dispatchNumber) - if ESX.PlayerData.job and ESX.PlayerData.job.name == "police" and ESX.PlayerData.job.name == dispatchNumber then - -- if esx_service is enabled - if Config.EnableESXService and not playerInService then - CancelEvent() - end - end -end) - AddEventHandler("bpt_policejob:hasEnteredMarker", function(station, part, partNum) if part == "Cloakroom" then CurrentAction = "menu_cloakroom" @@ -1470,7 +1454,7 @@ CreateThread(function() end) -- Create blip for colleagues -function createBlip(id) +function CreateBlip(id) local ped = GetPlayerPed(id) local blip = GetBlipFromEntity(ped) @@ -1513,7 +1497,7 @@ AddEventHandler("bpt_policejob:updateBlip", function() if players[i].job.name == "police" then local id = GetPlayerFromServerId(players[i].source) if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= PlayerPedId() then - createBlip(id) + CreateBlip(id) end end end @@ -1538,7 +1522,6 @@ end) AddEventHandler("onResourceStop", function(resource) if resource == GetCurrentResourceName() then TriggerEvent("bpt_policejob:unrestrain") - TriggerEvent("esx_phone:removeSpecialContact", "police") if Config.EnableESXService then TriggerServerEvent("esx_service:disableService", "police") diff --git a/server-data/resources/[bpt_addons]/bpt_policejob/config.lua b/server-data/resources/[bpt_addons]/bpt_policejob/config.lua index dbc6a6a04..6562e2dff 100644 --- a/server-data/resources/[bpt_addons]/bpt_policejob/config.lua +++ b/server-data/resources/[bpt_addons]/bpt_policejob/config.lua @@ -8,7 +8,7 @@ Config.EnablePlayerManagement = true -- Enable if you want society managing. Config.EnableArmoryManagement = false Config.EnableESXIdentity = true -- Enable if you're using esx_identity. Config.EnableESXOptionalneeds = false -- Enable if you're using esx_optionalneeds -Config.EnableLicenses = false -- Enable if you're using esx_license. +Config.EnableLicenses = true -- Enable if you're using esx_license. Config.EnableHandcuffTimer = true -- Enable handcuff timer? will unrestrain player after the time ends. Config.HandcuffTimer = 10 * 60000 -- 10 minutes. Config.EnableJobBlip = false -- Enable blips for cops on duty, requires bpt_society. diff --git a/server-data/resources/[bpt_addons]/bpt_policejob/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_policejob/locales/it.lua index d5a5ca89f..7d144f31f 100644 --- a/server-data/resources/[bpt_addons]/bpt_policejob/locales/it.lua +++ b/server-data/resources/[bpt_addons]/bpt_policejob/locales/it.lua @@ -164,4 +164,5 @@ Locales["it"] = { ["quick_actions"] = "Azioni rapide", -- Altro ["society_police"] = "Polizia", + ["weapon"] = "Porto D'armi", } diff --git a/server-data/resources/[bpt_addons]/bpt_policejob/server/main.lua b/server-data/resources/[bpt_addons]/bpt_policejob/server/main.lua index bbab1a7b9..7679ccd2b 100644 --- a/server-data/resources/[bpt_addons]/bpt_policejob/server/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_policejob/server/main.lua @@ -4,7 +4,6 @@ if Config.EnableESXService then end end -TriggerEvent("esx_phone:registerNumber", "police", TranslateCap("alert_police"), true, true) TriggerEvent("bpt_society:registerSociety", "police", TranslateCap("society_police"), "society_police", "society_police", "society_police", { type = "public", }) @@ -239,7 +238,7 @@ ESX.RegisterServerCallback("bpt_policejob:getVehicleInfos", function(source, cb, end) ESX.RegisterServerCallback("bpt_policejob:getArmoryWeapons", function(source, cb) - TriggerEvent("esx_datastore:getSharedDataStore", "society_police", function(store) + TriggerEvent("bpt_datastore:getSharedDataStore", "society_police", function(store) local weapons = store.get("weapons") if weapons == nil then @@ -257,7 +256,7 @@ ESX.RegisterServerCallback("bpt_policejob:addArmoryWeapon", function(source, cb, xPlayer.removeWeapon(weaponName) end - TriggerEvent("esx_datastore:getSharedDataStore", "society_police", function(store) + TriggerEvent("bpt_datastore:getSharedDataStore", "society_police", function(store) local weapons = store.get("weapons") or {} local foundWeapon = false @@ -285,7 +284,7 @@ ESX.RegisterServerCallback("bpt_policejob:removeArmoryWeapon", function(source, local xPlayer = ESX.GetPlayerFromId(source) xPlayer.addWeapon(weaponName, 500) - TriggerEvent("esx_datastore:getSharedDataStore", "society_police", function(store) + TriggerEvent("bpt_datastore:getSharedDataStore", "society_police", function(store) local weapons = store.get("weapons") or {} local foundWeapon = false @@ -361,7 +360,7 @@ end) ESX.RegisterServerCallback("bpt_policejob:buyJobVehicle", function(source, cb, vehicleProps, type) local xPlayer = ESX.GetPlayerFromId(source) - local price = getPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, type) + local price = GetPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, type) -- vehicle model not found if price == 0 then @@ -398,7 +397,7 @@ ESX.RegisterServerCallback("bpt_policejob:storeNearbyVehicle", function(source, end end) -function getPriceFromHash(vehicleHash, jobGrade, type) +function GetPriceFromHash(vehicleHash, jobGrade, type) local vehicles = Config.AuthorizedVehicles[type][jobGrade] for i = 1, #vehicles do @@ -462,9 +461,3 @@ AddEventHandler("onResourceStart", function(resource) end end end) - -AddEventHandler("onResourceStop", function(resource) - if resource == GetCurrentResourceName() then - TriggerEvent("esx_phone:removeNumber", "police") - end -end)