Props - banned

Sorry, I just started coding again recently and I can’t remember well. How could I go about getting the props listed in the table below banned from the server and a usermessage coming up saying, “This prop has been banned.”

Wouldn’t it be something like

[lua]local bannedprops = { }
bannedprops[1] = “models/prop_combine/example”

for k, v in pairs (bannedprops.GetAll())
[/lua]
I am not sure, my memory can’t remember.

[lua]local models = { “crane_frame.mdl” } --All or part of model name.
local function blockProps( ply, mdl )
for _, v in pairs( models ) do
if string.find( mdl, v ) then
return false
end
end
end
hook.Add( “PlayerSpawnProp”, “blockProps”, blockProps )[/lua]
:eng101:

Directly taken from the wiki!
http://wiki.garrysmod.com/?title=Gamemode.PlayerSpawnProp

Thank you, so it would look like this with multiple models?

[lua]local models = { “crane_frame.mdl”, “blame_game.mdl”, “example_example.mdl”, “snoggles.mdl” }
local function blockProps( ply, mdl )
for _, v in pairs( models ) do
if string.find( mdl, v ) then
return false
end
end
end
hook.Add( “PlayerSpawnProp”, “blockProps”, blockProps ) [/lua]

Just try it.

Yup, that’s the point of having a table. It checks the model of the prop against each element of the table. If they’re the same it will return false, thus stopping the prop from being spawned.