GMOD Lua Spawning Vehicles

Hey everyone Merry Christmas Eve! I just wanted some help with a problem I am getting. I am trying to spawn in a vehicle (from the vehicle tab) with gmod lua. I tried to use it’s class name in ents.Create() but it does not work. I will post my code below



newcar = ents.Create("Jeep")
        newCar:SetModel("models/buggy.mdl")
	newCar:SetPos(plyr:GetPos())
	newcar:SetAngles(plyr:GetAngles())
	newcar:Spawn()
	newcar:Activate()


Error: Tried to use a NULL entity! (newCar:SetModel(“models/buggy.mdl”))

The class name for the Jeep is different. I think it’s prop_vehicle_jeep.
Take a look at the sandbox code for spawning vehicles, there’s a function MakeVehicle - it shows pretty good how it’s done.

Here you go: https://dl.dropboxusercontent.com/u/26074909/tutoring/entities/vehicle_spawning.lua.html

Vehicles require a vehicle-script and some require Activate to be called ( which you did ) to avoid crashing ( prop_vehicle_airboat ).