A script that blocks the Jeep, Jalopy and Airboat only

I run a linux server, and those vehicles cause an instant crash.

Is there a script that blocks them from being spawned?

EDIT: I would still like seats to be spawned

[lua]
local BlockedClasses = {
“prop_vehicle_jeep”,
“prop_vehicle_airboat”}

hook.Add(“OnEntityCreated”, “BlockVehicles”, function(class)
for _,cl in pairs(BlockedClasses) do
if class == cl then
class:Remove()
return
end
end
end)
[/lua]
I don’t know if this will work, since the entity has already been created when this hook is called AFAIK. But it should work.

In case OnEntityCreated is too late, use this.
**[Gamemode.PlayerSpawnVehicle

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.PlayerSpawnVehicle)**

[lua]
local bad = {Airboat,Jeep}
hook.Add( “PlayerSpawnVehicle”, “NoVehicles”, function(ply,string,vn,tb)
if table.HasValue(bad,vn) then
return false
else
return true
end
end)[/lua]

Should work I wrote in quick reply-box

You’re missing an end King, also; Why are you not just using the bool from the table.HasValue function?
[lua]

local bad = { “Airboat”, “Jeep” }
hook.Add( “PlayerSpawnVehicle”, “NoVehicles”, function( ply, string, vn, tb )

return not table.HasValue( bad, vn )

end )
[/lua]

Thank you both so much. The last one works. It’s the best we can do without a fix from Garry

EDIT: Also had to add Jalopy to the list, seats work fine.

EDIT: Saw a link in another thread, thought this was relativly new, just necored. Please sort of ignore this.