Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. DecorRegister('illegal_chargeMeth', 3)
  2.  
  3. Citizen.CreateThread(function()
  4. while ESX == nil do
  5. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  6. Citizen.Wait(0)
  7. end
  8.  
  9. while ESX.GetPlayerData().job == nil do
  10. Citizen.Wait(10)
  11. end
  12.  
  13. PlayerData = ESX.GetPlayerData()
  14. end)
  15.  
  16. RegisterNetEvent('esx:setJob')
  17. AddEventHandler('esx:setJob', function(job)
  18. PlayerData.job = job
  19. end)
  20.  
  21. -- Verifie si le joueurs est dans un vehicule ou pas
  22. function IsInVehicle()
  23. local ply = PlayerPedId()
  24. if IsPedSittingInAnyVehicle(ply) then
  25. return true
  26. else
  27. return false
  28. end
  29. end
  30.  
  31. function recolte(currentVehicle, isGoodVehicle)
  32. if (PlayerData.job.name == 'police') then
  33. ESX.ShowNotification(_U('police_methylamine'))
  34. else
  35. if currentVehicle == 0 then
  36. ESX.ShowNotification(_U('need_vehicle'))
  37. return
  38. end
  39. if isGoodVehicle == false then
  40. ESX.ShowNotification(_U('bad_vehicle'))
  41. else
  42. if currentCharge >= 10000 then
  43. currentCharge = 10000
  44. ESX.ShowNotification(_U('full_vehicle'))
  45. Citizen.Wait(1000)
  46. ESX.ShowNotification(_U('full_vehicle_2'))
  47. Citizen.Wait(10000)
  48. ESX.ShowNotification(_U('full_vehicle_3'))
  49. else
  50. currentCharge = math.min(10000, currentCharge + 10)
  51. DecorSetInt(currentVehicle,'illegal_chargeMeth', currentCharge)
  52. ESX.ShowNotification(_U('filling_vehicle'))
  53. Citizen.Wait(100)
  54. end
  55. end
  56. end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement