Restricting button_model for spawning banned props
2 replies, posted
[lua]
function GM:CanTool(ply, trace, mode, model)
if not self.BaseClass:CanTool(ply, trace, mode, model) then return false end
if ValidEntity(trace.Entity) then
if trace.Entity.onlyremover then
if mode == "remover" then
return (ply:IsAdmin() or ply:IsSuperAdmin())
else
return false
end
end
if trace.Entity.nodupe and (mode == "weld" or
mode == "weld_ez" or
mode == "spawner" or
mode == "duplicator" or
mode == "adv_duplicator" or
mode == "button") then
return false
end
if trace.Entity:IsVehicle() and mode == "nocollide" then
return false
end
end
if CfgVars["banprops"] == 1 then
for k, v in pairs(BannedProps) do
if string.lower(v) == string.lower(model) then
Notify(ply, 1, 4, "You can't spawn this prop as it is banned. "..model)
DB.Log(ply:SteamName().." ("..ply:SteamID()..") tried to spawn banned prop "..model)
return false
end
end
end
return true
end
[/lua]
I tried adding...
[lua] if CfgVars["banprops"] == 1 then
for k, v in pairs(BannedProps) do
if string.lower(v) == string.lower(model) then
Notify(ply, 1, 4, "You can't spawn this prop as it is banned. "..model)
DB.Log(ply:SteamName().." ("..ply:SteamID()..") tried to spawn banned prop "..model)
return false
end
end
end[/lua]
But it doesn't do anything, I can still spawn the banned props with the button tool.
CanTool only gets called when a player clicks with the tool, use PlayerSpawnProp to block props.
[url]http://wiki.garrysmod.com/?title=Gamemode.PlayerSpawnProp[/url]
[QUOTE=-TB-;26846328]CanTool only gets called when a player clicks with the tool, use PlayerSpawnProp to block props.
[url]http://wiki.garrysmod.com/?title=Gamemode.PlayerSpawnProp[/url][/QUOTE]
I know that. I am trying to stop spawning with the button tool.
Sorry, you need to Log In to post a reply to this thread.