How can i make the spawn menu admin only

im a complete noob at lua, and i would appreciate some help with making the spawn menu admin only.
so far the only things i know is that i need to edit something in cl_spawnmenu in my gamemode.
sorry if my spelling isnt perfect.

and thanks for any help you will give me.

[lua]
function GM:SpawnMenuOpen()
return LocalPlayer():IsAdmin()
end
[/lua]

so i should put it something like this?

function GM:SpawnMenuOpen()
return LocalPlayer(false):IsAdmin(true)
end

that didnt work…

No, you put exactly what I said. :downs:

this doesnt work either…it seems it completely disable’s the spawn menu

Then you’re not an admin.

[editline]06:45PM[/editline]

You’re doing it in cl_init right?

nope, ill try that now…

If you don’t want it in cl_init and just a clientside file - you’ll need to hook it.

[lua]
hook.Add(“SpawnMenuOpen”, function()
return LocalPlayer:IsAdmin()
end )
[/lua]

You forgot the unique name.

oops

it still doesnt work, tried putting it into both cl_init and cl_spawnmenu, neither worked

[lua]
if SERVER then
AddCSLuaFile(“autorun/sh_adminspawnmenu.lua”)
else
hook.Add(“SpawnMenuOpen”, “AdminOnlySpawnMenu”, function()
return LocalPlayer:IsAdmin()
end )
end
[/lua]

Save that in lua/autorun as sh_adminspawnmenu.lua

Note that if you know a little about the hook system and your server is not script enforced, avoiding this block is very easy. You should block spawning serverside too.

Instead of opening a new thread, I have made a GUI and made the box that I need to show the players names in but I don’t know how I am going to get the player names in the boxes, I did it before I forgot how.

[lua]local DermaPanel = vgui.Create( “DFrame” )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 512, 512 )
DermaPanel:SetTitle( “Admin Menu” )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()

local PlayerNameBpx = vgui.Create( “DComboBox”, FrameParent )

PlayerNameBpx:SetPos( 10, 35 )
PlayerNameBpx:SetParent( DermaPanel )
PlayerNameBpx:SetSize( 200, 465 )
PlayerNameBpx:SetMultiple( false )

PlayerNameBpx:AddItem( “” )
PlayerNameBpx:AddItem( “” )
PlayerNameBpx:AddItem( “” )
PlayerNameBpx:AddItem( “” )
for _,v in ipairs(player.GetAll()) do combo:AddItem(v:Name()) end[/lua]

uhhh…what?