Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. ESX = nil
  2. local PlayerData = {}
  3.  
  4. Citizen.CreateThread(function()
  5. while ESX == nil do
  6. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  7. Citizen.Wait(0)
  8. end
  9. end)
  10.  
  11. Citizen.CreateThread(function()
  12. while true do
  13. Citizen.Wait(1000)
  14. PlayerData = ESX.GetPlayerData()
  15. end
  16. end)
  17.  
  18. RegisterCommand('testcar', function(source, args, rawCommand)
  19. if PlayerData.job.name == 'cardealer' then
  20. local veh = args[1]
  21. local position=tonumber(args[2])
  22. local playerPed=GetPlayerPed(-1)
  23. local coords=GetEntityCoords(playerPed)
  24. local position1=vector3(-1204.19,-1738.02,4.39)
  25. if veh == nil then
  26. ESX.ShowNotification("~r~Please enter a car model")
  27. end
  28. vehiclehash = GetHashKey(veh)
  29. RequestModel(vehiclehash)
  30.  
  31. Citizen.CreateThread(function()
  32. local waiting = 0
  33. while not HasModelLoaded(vehiclehash) do
  34. waiting = waiting + 100
  35. Citizen.Wait(100)
  36. if waiting > 5000 then
  37. ESX.ShowNotification("Could not load the vehicle model.")
  38. break
  39. end
  40. end
  41.  
  42. if position then
  43. if position==1 then
  44. ESX.Game.SpawnVehicle(vehiclehash,position1,296,function(vehicle)
  45. --TaskWarpPedIntoVehicle(playerPed,vehicle,-1)
  46. FreezeEntityPosition(vehicle, true)
  47. end)
  48. end
  49. else
  50. ESX.ShowNotification("~r~No position")
  51. end
  52. end)
  53.  
  54. elseif PlayerData.job.name ~= 'cardealer' then
  55. ESX.ShowNotification("~r~You cannot use this command")
  56. end
  57.  
  58. if position then
  59. ESX.ShowNotification("~r~Not nill")
  60. end
  61. end)
  62.  
  63. --CLEARING THE AREA OUT OF VEHICLES
  64. Citizen.CreateThread(function()
  65. while true do
  66. ClearAreaOfVehicles(-1168.08, -1747.34, 4.0, 30.0, false,false,false,false,false)
  67. Citizen.Wait(0)
  68. end
  69. end)
  70.  
  71. RegisterCommand('dvtest', function()
  72. if PlayerData.job.name == 'cardealer' then
  73. if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) and not IsEntityDead(GetPlayerPed(-1)) then
  74. DeleteEntity(GetVehiclePedIsIn(GetPlayerPed(-1),false))
  75. end
  76. end
  77. end)
  78.  
  79. RegisterCommand('coords',function()
  80. print(GetEntityCoords(playerPed))
  81. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement