• Disabling Spawn Menu?
    8 replies, posted
Im learning to script gamemodes and i was wondering if anyone knew how to disable the spawn menu (Q menu) Im guessing you have to use the keypress function
The Q menu is sandbox only.
[QUOTE=commandhat;26269960]The Q menu is sandbox only.[/QUOTE] I know but the gamemode i am currently working on is derived from sandbox so the q menu is still there
function GM:SpawnMenuOpen() return LocalPlayer():IsAdmin() end --Can't be opened unless you are an admin. Put in cl_init.lua. I am using this code on mine. I am sure it can be modified if you don't want admins to use it either.
[b][url=wiki.garrysmod.com/?title=Gamemode.SpawnMenuEnabled]Gamemode.SpawnMenuEnabled [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[QUOTE=kodan50;26270177]function GM:SpawnMenuOpen() return LocalPlayer():IsAdmin() end --Can't be opened unless you are an admin. Put in cl_init.lua. I am using this code on mine. I am sure it can be modified if you don't want admins to use it either.[/QUOTE] Thank you [QUOTE=ralle105;26270190][b][url=wiki.garrysmod.com/?title=Gamemode.SpawnMenuEnabled]Gamemode.SpawnMenuEnabled [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/url][/b][/QUOTE] And Thank you too
You might also want to use concommand.Remove and remove commands like gm_spawn so skiddies wont spawn something using console
Where does the file check the Admin method? How would I get it so a ULX group I created has access to building as well? I know this forum is old but I was wondering... This is what I tried and it's really bad... but I hope you guys can understand what i am trying to do... function GM:SpawnMenuOpen() if LocalPlayer():IsAdmin() or LocalPlayer():IsBuilder() then     return true else return false end end Same thing happens if I use the original code and add Builder function GM:SpawnMenuOpen() return LocalPlayer():IsAdmin() or LocalPlayer():IsAdmin() end I changed the code a little bit but it does the same thing, if the user is admin they can build but no one else can. I wanted to add a group I made called builder to this permission... This is the error I get.. [ERROR] gamemodes/starwarsrp/gamemode/cl_init.lua:33: attempt to call method 'IsBuilder' (a nil value)   1. Run - gamemodes/starwarsrp/gamemode/cl_init.lua:33    2. Call - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:222     3. unknown - gamemodes/base/gamemode/cl_spawnmenu.lua:56      4. unknown - lua/includes/modules/concommand.lua:54 How would I do this? I know this is bad coding on my behalf but I wanted to try doing it myself... How would I do it?
local localPlayer = LocalPlayer(); local meta = FindMetaTable("Player"); function meta:IsBuilder() return self:IsUserGroup("builder"); end; function GM:SpawnMenuOpen() if localPlayer:IsAdmin() then return true; end; if localPlayer:IsBuilder() then return true; end; return false; end;
Sorry, you need to Log In to post a reply to this thread.