Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2020
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. ESX = nil
  2.  
  3. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  4.  
  5. RegisterServerEvent('duty:onoff')
  6. AddEventHandler('duty:onoff', function(job)
  7.  
  8. local _source = source
  9. local xPlayer = ESX.GetPlayerFromId(_source)
  10. local job = xPlayer.job.name
  11. local grade = xPlayer.job.grade
  12.  
  13. if job == 'police' or job == 'ambulance' or job == 'mechanic' or job == 'realestateagent' then
  14. xPlayer.setJob('off' ..job, grade)
  15. TriggerClientEvent('esx:showNotification', _source, _U('offduty'))
  16. TriggerEvent("esx_eden_garage:EnableSocietyGarage", "police", false)
  17. exports.ft_libs:DisableArea("esx_eden_garage_area_police_mecanodeletepoint")
  18. exports.ft_libs:DisableArea("esx_eden_garage_area_police_mecanospawnpoint")
  19. exports.ft_libs:DisableArea("esx_eden_garage_area_Bennys_mecanodeletepoint")
  20. exports.ft_libs:DisableArea("esx_eden_garage_area_Bennys_mecanospawnpoint")
  21. elseif job == 'offpolice' then
  22. xPlayer.setJob('police', grade)
  23. TriggerClientEvent('esx:showNotification', _source, _U('onduty'))
  24. TriggerEvent("esx_eden_garage:EnableSocietyGarage", "police", true)
  25. exports.ft_libs:EnableArea("esx_eden_garage_area_police_mecanodeletepoint")
  26. exports.ft_libs:EnableArea("esx_eden_garage_area_police_mecanospawnpoint")
  27. elseif job == 'offambulance' then
  28. xPlayer.setJob('ambulance', grade)
  29. TriggerClientEvent('esx:showNotification', _source, _U('onduty'))
  30. elseif job == 'offmechanic' then
  31. xPlayer.setJob('mechanic', grade)
  32. TriggerClientEvent('esx:showNotification', _source, _U('onduty'))
  33. exports.ft_libs:EnableArea("esx_eden_garage_area_Bennys_mecanodeletepoint")
  34. exports.ft_libs:EnableArea("esx_eden_garage_area_Bennys_mecanospawnpoint")
  35. elseif job == 'offrealestateagent' then
  36. xPlayer.setJob('realestateagent', grade)
  37. TriggerClientEvent('esx:showNotification', _source, _U('onduty'))
  38. end
  39.  
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement