improvement(policejob): Use the new arguments for GetExtendedPlayers()

This commit is contained in:
Linden
2021-06-30 21:51:58 +10:00
parent e5c0b24f63
commit 4ee9ec3a11
+6 -8
View File
@@ -448,14 +448,9 @@ ESX.RegisterServerCallback('esx_policejob:getPlayerInventory', function(source,
end)
AddEventHandler('playerDropped', function()
-- Save the source in case we lose it (which happens a lot)
local playerId = source
-- Did the player ever join?
if playerId then
local xPlayer = ESX.GetPlayerFromId(playerId)
-- Is it worth telling all clients to refresh?
if xPlayer and xPlayer.job.name == 'police' then
Citizen.Wait(5000)
TriggerClientEvent('esx_policejob:updateBlip', -1)
@@ -466,7 +461,6 @@ end)
RegisterNetEvent('esx_policejob:spawned')
AddEventHandler('esx_policejob:spawned', function()
local xPlayer = ESX.GetPlayerFromId(playerId)
if xPlayer and xPlayer.job.name == 'police' then
Citizen.Wait(5000)
TriggerClientEvent('esx_policejob:updateBlip', -1)
@@ -475,13 +469,17 @@ end)
RegisterNetEvent('esx_policejob:forceBlip')
AddEventHandler('esx_policejob:forceBlip', function()
TriggerClientEvent('esx_policejob:updateBlip', -1)
for _, xPlayer in pairs(ESX.GetExtendedPlayers('job', 'police')) do
TriggerClientEvent('esx_policejob:updateBlip', -1)
end
end)
AddEventHandler('onResourceStart', function(resource)
if resource == GetCurrentResourceName() then
Citizen.Wait(5000)
TriggerClientEvent('esx_policejob:updateBlip', -1)
for _, xPlayer in pairs(ESX.GetExtendedPlayers('job', 'police')) do
TriggerClientEvent('esx_policejob:updateBlip', xPlayer.source)
end
end
end)