I don’t want the Officers to need to tune in every time into the Panic Channel and also do not want to add each Officers one by one to the Config.
So i tried, combining the Duty System together with the Ressource.
I came this far:
The Panic Command i limited to the “police” job, since they will be offduty with the “offpolice” job.
-- /panic command
RegisterCommand("panic", function()
if ESX.PlayerData.job.name == 'police' then
and limited the panictune command aswell to the Person with the “police” job.
-- /panictune command
RegisterCommand("panictune", function()
if ESX.PlayerData.job.name == 'police' then
PanicTune()
Now, When i go on Duty he should register that the Person is on Duty, right?
Still Outputs that “You’re not in Duty” (Custom Set Message for this) and does not tune in the Channel nor does he have Permission to execute the “/panic”, “/panictune” Command or use any of the Items / Menu Options, Custom Made for the Panic Button.
Is there a way, to automatically tune him into the Panic Channel when going On-Duty and Tune him out of the Panic Channel when going Off-Duty?
Thanks for your Reply!
That helped and worked like charm.
To combine everything together with the Duty System, I’ve added a Eventhandler to the esx:setJob Event:
-- /panictune command
--RegisterNetEvent("panictune", function()
-- if PlayerData.job ~= nil and PlayerData.job.name == 'police' then
-- PanicTune()
-- else
-- NewNoti("~r~Du bist nicht im Dienst!", true)
-- end
--end)
AddEventHandler("esx:setJob", function ()
if PlayerData.job ~= nil and PlayerData.job.name == 'police' then
PanicTune()
else
NewNoti("~r~Du bist nicht im Dienst und dich erreichen keine Notrufe mehr!", true)
end
end)
And now this works like a Charm. Thank you very much!