Spawning Vehicles with VU-Mod seats, headlights, and horns.

Hey FP,
So I currently got my script to spawn cars on the map, but they don’t come with VU-Mod features like Seats, etc.
How would I get to adding the entities into the entities?

Big thanks to whoever can help, greatly appreciated.

-JAY

[lua]gamemode.Call(“PlayerSpawnedVehicle”, ply, ent)[/lua]

Try putting that at after ent:Spawn() and ent:Activate() in your code.

Should it be included in EACH function?

Just after both of them.

Like this:
[lua]
local ent = ents.Create( “vehicle_class” )
– other stuff
ent:Spawn()
ent:Activate()
gamemode.Call( “PlayerSpawnedVehicle”, ply, ent )[/lua]

Yeah, apparently that doesn’t work.
Gives this error in console:


ERROR: GAMEMODE:'PlayerSpawnedVehicle' Failed: [@lua\includes\util.lua:176] bad
key to string index (number expected, got string)

Edit: Here’s my spawn code

[lua]function BuyJeep(ply, ent)
if not ply:CanAfford(1000) then
Notify(ply, 1, 4, string.format(“You can’t afford the Jeep.”)) return “” else
ply:AddMoney(-1000)
Class = “prop_vehicle_jeep_old”
local ent = ents.Create(Class)
local trace = ply:GetEyeTraceNoCursor()
local Ang = ply:GetAngles()
ent:SetKeyValue( “vehiclescript”, “scripts/vehicles/jeep_test.txt” )
ent:SetModel( “models/buggy.mdl” )
ent:SetAngles(Angle(0, 180, 0))
// ent:SetName(“Jeep”)
ent:SetPos( Vector(2176.619873, 1224.472168, -131.968750) )
ent:Spawn()
ent:Activate()
ent.ClassOverride = Class
end
gamemode.Call(“PlayerSpawnedVehicle”, ply, ent) – VUMod compatability
end
concommand.Add(“kix09”, BuyJeep)[/lua]

I had this problem awhile back, never got VU-MOD working properly though.

I ended up just scrapping the idea and creating the passenger seat myself.

This may help you.

I hope all of it is in that thread lol, thanks :slight_smile: