Code: Select all
nextvehicle = "vspawn" // initialize it this way because first vehicle spawn might have occurred before OnObjectInit is set up; "vspawn" is the name of the vehicle spawn in ZE
OnObjectInit(function(object)
if GetEntityClass(object) == FindEntityClass("your_vehicle_class_name") then
nextvehicle = object
end
end)Code: Select all
OnCharacterSpawn(function(player)
if nextvehicle then
local tmp = GetEntityMatrix(GetCharacterUnit(player))
EnterVehicle(player,nextvehicle)
nextvehicle = nil
end
end)


