Spawn a vehicle.

I don’t know why, but I can’t seem to properly spawn a jeep with lua. It’s probably something I’m forgetting but I can’t get it to work. Here’s what I tried.

[lua]
jeep = ents.Create(“prop_vehicle_jeep”)
jeep:SetModel(“models/buggy.mdl”)
jeep:DropToFloor()
jeep:PhysicsInit( SOLID_VPHYSICS )
jeep:SetMoveType( MOVETYPE_VPHYSICS )
jeep:SetSolid( SOLID_VPHYSICS )
jeep:SetPos(Vector(3938, -4430, 128))
jeep:Spawn()
jeep:Activate()
[/lua]

Someone please help, it’s probably not that hard.

0 out of 246 people who viewed this doesn’t know how to do this?

You dont need PhysicsInit
SetMoveType
SetSolid
Ill find you my car script its somewhere on my pc

Untested but this should work:
[lua]
local Jeep = ents.Create(“prop_vehicle_jeep_old”)
Jeep:SetModel(“models/buggy.mdl”)
Jeep:SetKeyValue(“vehiclescript”, “scripts/vehicles/jeep_test.txt”)
Jeep:SetPos(Vector(3938, -4430, 128))
Jeep:Spawn()
Jeep:Activate()
[/lua]

You need to set the key value “vehiclescript” to whatever script you want it to use.

Thank you! It worked!