Guest User

client

a guest
Dec 18th, 2019
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. function save(vehicle,props)
  2.     local model = GetEntityModel(vehicle)
  3.     local x,y,z = table.unpack(GetEntityCoords(vehicle))
  4.     local heading = GetEntityHeading(vehicle)
  5.     local PlateVeh = GetVehicleNumberPlateText(vehicle)
  6.     TriggerServerEvent('save', PlateVeh, props)
  7. end
  8. Citizen.CreateThread(function()
  9.     ped = GetPlayerPed(-1)
  10.     local vehicle = 0
  11.     local inVeh = false
  12.     while true do
  13.         print('Triggering save...')
  14.         if IsPedInAnyVehicle(ped) then
  15.             inVeh = true
  16.             vehicle = GetVehiclePedIsUsing(ped)
  17.             save(vehicle,ESX.Game.GetVehicleProperties(vehicle))
  18.         else
  19.             if inVeh then
  20.                 save(vehicle)
  21.             end
  22.             inVeh = false
  23.         end
  24.  
  25.         Citizen.Wait(10000)
  26.     end
  27. end)
  28. RegisterNetEvent('loadveh')
  29. AddEventHandler('loadveh', function (vehicle,x,y,z,a)
  30.     ESX.Game.SpawnVehicle(vehicle.model, {},120, function(callback_vehicle)
  31.         ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
  32.     end)
  33.     TriggerServerEvent('eden_garage:modifystate', vehicle, false)
  34. end)
Add Comment
Please, Sign In to add comment