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

local BlockedClasses = {

hook.Add(“OnEntityCreated”, “BlockVehicles”, function(class)
for _,cl in pairs(BlockedClasses) do
if class == cl then
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.


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

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?

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

return not table.HasValue( bad, vn )

end )

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.