fix(police): Add events for playerLoaded/onPlayerLogout; SetTimeout on restart

This commit is contained in:
Linden
2021-07-22 10:19:12 +10:00
parent 97c929946d
commit 72e26d64e7
+17 -4
View File
@@ -3,10 +3,17 @@ local HasAlreadyEnteredMarker, isDead, isHandcuffed, hasAlreadyJoined, playerInS
local LastStation, LastPart, LastPartNum, LastEntity, CurrentAction, CurrentActionMsg
dragStatus.isDragged, isInShopMenu = false, false
if ESX.PlayerLoaded and ESX.PlayerData.job == 'police' then
Citizen.Wait(1000)
TriggerServerEvent('esx_policejob:forceBlip')
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
ESX.PlayerLoaded = true
end)
RegisterNetEvent('esx:onPlayerLogout')
AddEventHandler('esx:onPlayerLogout', function()
ESX.PlayerLoaded = false
ESX.PlayerData = {}
end)
function cleanPlayer(playerPed)
SetPedArmour(playerPed, 0)
@@ -1562,3 +1569,9 @@ function ImpoundVehicle(vehicle)
ESX.ShowNotification(_U('impound_successful'))
currentTask.busy = false
end
if ESX.PlayerLoaded and ESX.PlayerData.job == 'police' then
SetTimeout(1000, function()
TriggerServerEvent('esx_policejob:forceBlip')
end)
end