Spawn in vehicle on join?


#1

Title says it all, here is what i got so far:

AddEventHandler(‘playerSpawned’, function()
local pos = GetEntityCoords(PlayerPedId())
local vehicle = CreateVehicle(“zentorno”, pos, 0.0, true, false)
TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
end)

Seems like its not working, could you help me out?


#2

SetPedIntoVehicle(GetPlayerPed(-1), vehicle, -1)


#3

@ArmAGawD

Thanks, but its still not working:

AddEventHandler(‘playerSpawned’, function()
local pos = GetEntityCoords(PlayerPedId())
local vehicle = CreateVehicle(“zentorno”, pos, 0.0, true, false)
SetPedIntoVehicle(GetPlayerPed(-1), vehicle, -1)
end)


#4

fixed this myself.

no further help needed.


#5

for future reference all you needed to do is load the model before spawning it and replace pos with table.unpack(pos)