Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function save(vehicle,props)
- local model = GetEntityModel(vehicle)
- local x,y,z = table.unpack(GetEntityCoords(vehicle))
- local heading = GetEntityHeading(vehicle)
- local PlateVeh = GetVehicleNumberPlateText(vehicle)
- TriggerServerEvent('save', PlateVeh, props)
- end
- Citizen.CreateThread(function()
- ped = GetPlayerPed(-1)
- local vehicle = 0
- local inVeh = false
- while true do
- print('Triggering save...')
- if IsPedInAnyVehicle(ped) then
- inVeh = true
- vehicle = GetVehiclePedIsUsing(ped)
- save(vehicle,ESX.Game.GetVehicleProperties(vehicle))
- else
- if inVeh then
- save(vehicle)
- end
- inVeh = false
- end
- Citizen.Wait(10000)
- end
- end)
- RegisterNetEvent('loadveh')
- AddEventHandler('loadveh', function (vehicle,x,y,z,a)
- ESX.Game.SpawnVehicle(vehicle.model, {},120, function(callback_vehicle)
- ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
- end)
- TriggerServerEvent('eden_garage:modifystate', vehicle, false)
- end)
Add Comment
Please, Sign In to add comment