Fix toggleDuty() for ESX

This commit is contained in:
Jim Shield
2025-07-07 00:09:34 +01:00
parent 7c47de5dc0
commit d6fd2cc28c
2 changed files with 16 additions and 2 deletions

View File

@@ -117,7 +117,6 @@ function onResourceStart(func, thisScript)
debugPrint("^6Bridge^7: ^2Shared Load Detected^7.") debugPrint("^6Bridge^7: ^2Shared Load Detected^7.")
hasPrinted = true hasPrinted = true
end end
if isStarted(ESXExport) then Wait(10000) end
func() func()
end end
end end

View File

@@ -104,16 +104,31 @@ function toggleDuty()
TriggerServerEvent("QBCore:ToggleDuty") TriggerServerEvent("QBCore:ToggleDuty")
Wait(100) Wait(100)
onDuty = getPlayer().onDuty onDuty = getPlayer().onDuty
elseif isStarted(RSGExport) then elseif isStarted(RSGExport) then
TriggerServerEvent("RSGCore:ToggleDuty") TriggerServerEvent("RSGCore:ToggleDuty")
Wait(100) Wait(100)
onDuty = getPlayer().onDuty onDuty = getPlayer().onDuty
else
elseif isStarted(ESXExport) then
local tempJob = ESX.GetPlayerData().job
tempJob.onDuty = not onDuty
ESX.SetPlayerData("job", tempJob)
onDuty = getPlayer().onDuty
if onDuty then if onDuty then
triggerNotify(nil, "Now on duty", "success") triggerNotify(nil, "Now on duty", "success")
else else
triggerNotify(nil, "Now off duty", "success") triggerNotify(nil, "Now off duty", "success")
end end
else
onDuty = not onDuty
if onDuty then
triggerNotify(nil, "Now on duty", "success")
else
triggerNotify(nil, "Now off duty", "success")
end
end end
end end