• Derma stuffz
    6 replies, posted
So I've been messing around with derma recently, how would I make it so that admin+ can use the menu? [lua]local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50,50 ) DermaPanel:SetSize( 250, 300 ) DermaPanel:SetTitle( "TTT Quick Settings" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:MakePopup() local TTTSettings = vgui.Create("DCollapsibleCategory", DermaPanel) TTTSettings:SetPos( 25,50 ) TTTSettings:SetSize( 200, 50 ) -- Keep the second number at 50 TTTSettings:SetExpanded( 0 ) -- Expanded when popped up TTTSettings:SetLabel( "Settings" ) CategoryList = vgui.Create( "DPanelList" ) CategoryList:SetAutoSize( true ) CategoryList:SetSpacing( 5 ) CategoryList:EnableHorizontal( false ) CategoryList:EnableVerticalScrollbar( true ) TTTSettings:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category local CategoryContentOne = vgui.Create( "DCheckBoxLabel" ) CategoryContentOne:SetText( "God Mode" ) CategoryContentOne:SetConVar( "ulx god" ) CategoryContentOne:SetValue( 1 ) CategoryContentOne:SizeToContents() CategoryList:AddItem( CategoryContentOne ) -- Add the above item to our list local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" ) CategoryContentTwo:SetText( "NoClip" ) CategoryContentTwo:SetConVar( "ulx noclip" ) CategoryContentTwo:SetValue( 1 ) CategoryContentTwo:SizeToContents() CategoryList:AddItem( CategoryContentTwo ) local CategoryContentThree = vgui.Create( "DCheckBoxLabel" ) CategoryContentThree:SetText( "Allow ClientSide Lua" ) CategoryContentThree:SetConVar( "sv_allowcslua 1" ) CategoryContentThree:SetValue( 1 ) CategoryContentThree:SizeToContents() CategoryList:AddItem( CategoryContentThree ) local CategoryContentFour = vgui.Create( "DCheckBoxLabel" ) CategoryContentFour:SetText( "Gag whole server" ) CategoryContentFour:SetConVar( "ulx gag *" ) CategoryContentFour:SetValue( 1 ) CategoryContentFour:SizeToContents() CategoryList:AddItem( CategoryContentFour ) local CategoryContentFive = vgui.Create( "DCheckBoxLabel" ) CategoryContentFive:SetText( "Mute whole server" ) CategoryContentFive:SetConVar( "ulx mute *" ) CategoryContentFive:SetValue( 1 ) CategoryContentFive:SizeToContents() CategoryList:AddItem( CategoryContentFive ) hook.Add("ShowHelp", "TTTSettings",function( ply ) if ply:IsUserGroup("admin") then return true else return false end)[/lua] So I've been messing around with derma recently, how would I make it so that admin+ can use the menu? Would it be something like this? [lua]hook.Add("ShowHelp", "TTTSettings",function( ply ) if ply:IsUserGroup("admin") then return true else return false end)[/lua] Would it be something like this? Any help would be greatly appreciated. Thanks!
[LUA] if(CLIENT) then function BaseTTTSettingFrame() BaseTTTSettingFrame = vgui.Create( "DFrame" ) BaseTTTSettingFrame:SetPos( 50,50 ) BaseTTTSettingFrame:SetSize( 250, 300 ) BaseTTTSettingFrame:SetTitle( "TTT Quick Settings" ) BaseTTTSettingFrame:SetVisible( true ) BaseTTTSettingFrame:SetDraggable( true ) BaseTTTSettingFrame:ShowCloseButton( true ) BaseTTTSettingFrame:MakePopup() local TTTSettings = vgui.Create("DCollapsibleCategory", BaseTTTSettingFrame) TTTSettings:SetPos( 25,50 ) TTTSettings:SetSize( 200, 50 ) -- Keep the second number at 50 TTTSettings:SetExpanded( 0 ) -- Expanded when popped up TTTSettings:SetLabel( "Settings" ) CategoryList = vgui.Create( "DPanelList" ) CategoryList:SetAutoSize( true ) CategoryList:SetSpacing( 5 ) CategoryList:EnableHorizontal( false ) CategoryList:EnableVerticalScrollbar( true ) TTTSettings:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category local CategoryContentOne = vgui.Create( "DCheckBoxLabel" ) CategoryContentOne:SetText( "God Mode" ) CategoryContentOne:SetConVar( "ulx god" ) CategoryContentOne:SetValue( 1 ) CategoryContentOne:SizeToContents() CategoryList:AddItem( CategoryContentOne ) -- Add the above item to our list local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" ) CategoryContentTwo:SetText( "NoClip" ) CategoryContentTwo:SetConVar( "ulx noclip" ) CategoryContentTwo:SetValue( 1 ) CategoryContentTwo:SizeToContents() CategoryList:AddItem( CategoryContentTwo ) local CategoryContentThree = vgui.Create( "DCheckBoxLabel" ) CategoryContentThree:SetText( "Allow ClientSide Lua" ) CategoryContentThree:SetConVar( "sv_allowcslua 1" ) CategoryContentThree:SetValue( 1 ) CategoryContentThree:SizeToContents() CategoryList:AddItem( CategoryContentThree ) local CategoryContentFour = vgui.Create( "DCheckBoxLabel" ) CategoryContentFour:SetText( "Gag whole server" ) CategoryContentFour:SetConVar( "ulx gag *" ) CategoryContentFour:SetValue( 1 ) CategoryContentFour:SizeToContents() CategoryList:AddItem( CategoryContentFour ) local CategoryContentFive = vgui.Create( "DCheckBoxLabel" ) CategoryContentFive:SetText( "Mute whole server" ) CategoryContentFive:SetConVar( "ulx mute *" ) CategoryContentFive:SetValue( 1 ) CategoryContentFive:SizeToContents() CategoryList:AddItem( CategoryContentFive ) end concommand.Add("BaseTTTSettingFrame",BaseTTTSettingFrame) end if(SERVER) then hook.Add("ShowHelp", "TTTSettings",function( ply ) if LocalPlayer():GetUserGroup() == "admin" then ply:ConCommand("BaseTTTSettingFrame") end end) end[/LUA] This would work, however you should look at your commands..:v: By the way, place it in /lua/autorun as it's a shared file
That wouldn't prevent a player from using the concommand while being a default user, you have to verify what rank or status the user is that is calling the concommand, instead of checking it in the hook do it when you create the menu's and while adding the concommand.
That wouldn't work because you're not sending the file to clients anyways Also the ulx commands do their own checking so while it's a bad idea this doesn't really pose any problems
[CODE] function testing(ply) if ply:IsAdmin() or ply:IsSuperAdmin then local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50,50 ) DermaPanel:SetSize( 250, 300 ) DermaPanel:SetTitle( "TTT Quick Settings" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:MakePopup() local TTTSettings = vgui.Create("DCollapsibleCategory", DermaPanel) TTTSettings:SetPos( 25,50 ) TTTSettings:SetSize( 200, 50 ) -- Keep the second number at 50 TTTSettings:SetExpanded( 0 ) -- Expanded when popped up TTTSettings:SetLabel( "Settings" ) CategoryList = vgui.Create( "DPanelList" ) CategoryList:SetAutoSize( true ) CategoryList:SetSpacing( 5 ) CategoryList:EnableHorizontal( false ) CategoryList:EnableVerticalScrollbar( true ) TTTSettings:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category local CategoryContentOne = vgui.Create( "DCheckBoxLabel" ) CategoryContentOne:SetText( "God Mode" ) CategoryContentOne:SetConVar( "ulx god" ) CategoryContentOne:SetValue( 1 ) CategoryContentOne:SizeToContents() CategoryList:AddItem( CategoryContentOne ) -- Add the above item to our list local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" ) CategoryContentTwo:SetText( "NoClip" ) CategoryContentTwo:SetConVar( "ulx noclip" ) CategoryContentTwo:SetValue( 1 ) CategoryContentTwo:SizeToContents() CategoryList:AddItem( CategoryContentTwo ) local CategoryContentThree = vgui.Create( "DCheckBoxLabel" ) CategoryContentThree:SetText( "Allow ClientSide Lua" ) CategoryContentThree:SetConVar( "sv_allowcslua 1" ) CategoryContentThree:SetValue( 1 ) CategoryContentThree:SizeToContents() CategoryList:AddItem( CategoryContentThree ) local CategoryContentFour = vgui.Create( "DCheckBoxLabel" ) CategoryContentFour:SetText( "Gag whole server" ) CategoryContentFour:SetConVar( "ulx gag *" ) CategoryContentFour:SetValue( 1 ) CategoryContentFour:SizeToContents() CategoryList:AddItem( CategoryContentFour ) local CategoryContentFive = vgui.Create( "DCheckBoxLabel" ) CategoryContentFive:SetText( "Mute whole server" ) CategoryContentFive:SetConVar( "ulx mute *" ) CategoryContentFive:SetValue( 1 ) CategoryContentFive:SizeToContents() CategoryList:AddItem( CategoryContentFive ) else chat.AddText("This is for admins only.") end hook.Add("ShowHelp", "TTTSettings",function( ply ) if ply:IsUserGroup("admin") then return true else return false end)[/CODE] Its early in the morning, Im sure i forgot something but something along them lines should work.
[QUOTE=AIX-Who;44242365]snip Its early in the morning, Im sure i forgot something but something along them lines should work.[/QUOTE] Youre not even opening the menu :v:
bump
Sorry, you need to Log In to post a reply to this thread.