• A Couple Questions
    2 replies, posted
I'm working on a new Game Mode and was curious 1. How I can make it to where if someone presses the Q menu, only a few props show up (and more for VIPs, etc.), and 2. How to disable all but a few tools from the toolgun. Thanks in advance!
For your second question, like this: [lua]local notools = { "dynamite", "turret", "duplicator", } hook.Add("CanTool","StopTooling",function(ply,tool) for _,v in ipairs(notools) do if tool == v then return false end end end)[/lua] You hook into "CanTool" to allow/disallow certain toolmodes. In this you just add the tools you don't want people to use. However, what you want is different; you want to disallow ALL tools except a few, which is this: [lua]local allowtools = { "im firin mah lazor", "wire_button", "axis", } hook.Add("CanTool","AllowTooling",function(ply,tool) for _,v in ipairs(allowtools) do if tool == v then return true end end end) [/lua] I'm not entirely sure about your first question; you would need to edit the sandbox source and block gm_spawn (otherwise people could spawn anything with concommands).
You would need to make a custom menu. Also, use the GM:PlayerSpawnProp hook to allow or disallow gm_spawn. Or whatever it's name was... looking for it :P [url]http://wiki.garrysmod.com/?title=Gamemode.PlayerSpawnProp[/url]
Sorry, you need to Log In to post a reply to this thread.