Unable to spawn then ride a prop_vehicle_airboat without GMOD server crashing

Hey people, I’m having a bit of a problem being able to jump in any form of airboat without the server crashing instantly.

So I spawn the airboat like so in a player function:

function plymeta:TestSpawn()
  local vec = ents.Create("prop_vehicle_airboat")

It appears, so I approach it. When I try and press the use key, the server just cannot handle this.

I tried spawning a vehicle the old fashion way in sandbox through the gui and it works fine. Could anybody throw me any pointers or anything I’m doing wrong?

Thanks, Turbine.


Did you read your script?

If vec = ents.Create(“prop_vehicle_airboat”), so all your line are:

function plymeta:TestSpawn()
  local vec = ents.Create("prop_vehicle_airboat")

Big problem on this ^^

Try this code :

function spawnairboat( ply )
	spawnairboat = ents.Create("prop_vehicle_airboat")
	spawnairboat:SetKeyValue("vehiclescript", "scripts/vehicles/airboat.txt")
	spawnairboat:SetPos( ply:GetEyeTrace().HitPos )
concommand.Add("TestAirboat", spawnairboat)

Put this code on a sv_ file. In game, type de command “TestAirboat” in console for spawn the airboat.

Same thing. :frowning:

They both work with any other vehicle, just this airboat.

BTW with
If vec = ents.Create(“prop_vehicle_airboat”)

It returns an instance of the object, not the function.

He was right the first time. The only change you’ve made is to make the variable global, and make it overwrite the function it’s in. Probably not the most ideal code.

Oh that right.

I try my script, we can spawn the airboat but when I press use on it, my game crash.

Changing the variable name will NOT help anything here, that was just stupid.

Has either of you managed to get this working in GMOD 13? It’s odd that in sandbox via gui it works. I even took the code, and it was when it sets the baseclass to airboat this happens shortly after.

Should I report this as a bug?

Check if you have crazy physics enabled. One way I had to bypass this when spawning the HL2 jetski was to set it to some random vehicle model, spawn it, then change it to the jetski. I think I had to do the same with the airboat.

You need to call Activate on the airboat or else it will crash you.

Thank you a bunch Tomasas! Activate did the trick, I’m uncertain why jeeps and any non-jetboat reliant vehicles worked without it.

And thanks Acecool for the tip on crazy physics, that will come in handy for a lesser problem I am having with something else.