I need help with Derma buttons, is there any way to make it so the button is only visible/clickable by superadmins? Also would like to know if it is possible to open a certain DFrame through the button, like an admin CP button.
[CODE]local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "Kill yourself" )
DermaButton:SetPos( 25, 50 )
DermaButton:SetSize( 150, 50 )
DermaButton.DoClick = function ()
RunConsoleCommand( "kill" ) -- What happens when you press the button
end[/CODE]
You can do a simple condition check like this:
[lua]
local ply = LocalPlayer()
if !IsValid(ply) or !ply:IsSuperAdmin() then return end
[/lua]
Does that restrict everything below it to SuperAdmin only?
[editline]21st March 2014[/editline]
Nvm, got it working, thank you so much.
Sorry, you need to Log In to post a reply to this thread.