Ulysses
General => Developers Corner => Topic started by: Avoid on June 17, 2014, 11:13:11 AM
-
Hello guys,
to learn some more Lua and how GMod functions I have decided to start writing my own small gamemode.
Since it derives from sandbox users can use all sandbox functions. I went on and disabled the context menu aswell as the spawnmenu (qmenu)
local function DisallowSpawnMenu( )
if not LocalPlayer():IsAdmin() then
return false
end
end
hook.Add( "SpawnMenuOpen", "DisallowSpawnMenu", DisallowSpawnMenu)
local function DisallowContextMenu( )
if not LocalPlayer():IsAdmin() then
return false
end
end
hook.Add( "OnContextMenuOpen", "DisallowContextMenu", DisallowContextMenu)
But I just noticed users can still use gmod_spawnnpc and gmod_npcweapon, now I want to disable this aswell.
My question is where I should start looking and how to effectively disable those two commands.
Cheers,
Avoid
-
Hook.
Player:SpawnNPC (http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnNPC)
Might help with npcweapon too, but there's other hooks in that area for spawning stuff(and it's prevention). Sweps, objects, sents.
Poke around unless someone answers more exact.
-
What kind of gamemode is it?