sandbox menu admin only?

Hey guys, ive been making a dodgeball gamemode for me and some of my friends to play.
currently ive got a basic team menu set up and a menu to spawn ammo and dodgeballs which can be thrown and picked up by pressing E, these are opened using f3 and f4 and i plan to make a map for it too.

i have one problem though, i want the spawnmenu enabled but i have no idea how i can allow the “Q” spawnmenu to be opened only by people with admin ulx permissions or by Steam ID ?.

any help or advice would be appreciated thanks :slight_smile:

You can use the SpawnMenuOpen hook to prevent clients from opening the spawn menu, then you can check the player’s usergroup. Sadly this is only client side, it would be nice if it were server side, but oh well:
local allowed_groups = { “admin”, “moderator”, “owner” }
local steamids = { “STEAM_0:0:00000” }
function GM:SpawnMenuOpen()

if LocalPlayer():IsAdmin() -- Check admin status
	or table.HasValue( steamids, LocalPlayer():SteamID() ) -- Check steamid
	or table.HasValue( allowed_groups, LocalPlayer():GetNWString( "usergroup" ) ) then -- Check usergroup
	return true -- If any are true, allow it

return false -- Otherwise prevent it

Since you’re making a gamemode I guess you can override a gamemode function.
Remember that this is client side, put it in a client side file.
Also make sure that you prevent people from using the console command, or you might have to override the PlayerSpawn* hooks.

I’d recommend storing the data differently to avoid running through two loops to check data - use direct access…

Something similar to this:

Except, instead of looping through all players, just grab the LocalPlayer group and see if the index exists in the table; if it is defined then process as desired. Additionally, you can save to the same table SteamIDs, but since they are strings with numbers and characters in it, you’ll need to define that row as: [“STEAM_0:0:1234”] = xxx;