Is it possible to have a SWEP which spawns a vehicle? If so, what is the code?
[lua]
function SWEP:PrimaryAttack()
if(SERVER)then
local trace = self.Owner:GetEyeTrace()
local vehicle = ents.Create("prop_vehicle_jeep")
vehicle:SetKeyValue("vehiclescript","scripts/vehicles/jeep_test.txt")
vehicle:SetModel("models/buggy.mdl")
vehicle:SetPos(trace.HitPos)
vehicle:Spawn()
end
end
[/lua]
thanks …I was failing so much at trying to do this part of my SWEP