Entering a vehicle

Im making a function that spawns a jeep and puts the player inside it, but Gmod keeps crashing when run it!
This is the code so far:
[lua]
function LetsRace( ply )
local car = ents.Create(“prop_vehicle_jeep”)
car:SetPos(Vector(0, 0, 0))
car:SetKeyValue(“vehiclescript”,“scripts/vehicles/jeep.txt”)
car:Activate()
car:Spawn()
ply:EnterVehicle( car )
end
concommand.Add( “lets_race”, LetsRace )
[/lua]

Anyone know how to fix that?

Try making a 1 second timer THEN putting them inside, just to give it a chance to fully work everything out.

Also, does it still crash when the player isn’t told to enter it?

You need to set it’s model.

I’ve set it’s model, now i get this error:




Vehicle () unable to properly initialize due to script error in (scripts/vehicles/jeep.txt)!



EDIT: aha! Had to put the script to: scripts/vehicles/jeep_test.txt
Working!