• Create Derma popup on Button press?
    1 replies, posted
As the title states how would I create a button to make a popup, I'm trying to make a menu in which you click a Ban button and a slider will popup with a slider and numeral input on it as well, and the wiki currently says DNumSlider is currently broken how would I substitute it? As for the slider how would I then pass this number to my concommand below. [CODE]concommand.Add( "admin_ban", function( player, command, arguments ) if ( player:IsAdmin() or player:IsSuperAdmin() ) then local steamid = arguments[1]; local reason = arguments[2]; local time = arguments[3]; if ( steamid ) then local offender = SteamIDSearch(steamid); if ( offender and offender:IsPlayer() ) then offender:Ban( reason, time ); end; end; end; end);[/CODE] [CODE]--Kick menufunction DermaTest() local width = ScrW(); local height = ScrH(); local base = vgui.Create( "DFrame" ); local list = vgui.Create( "DPanelList", base); base:SetPos(width / 3.5, height / 3); base:SetSize(600, 700); base:SetVisible(true); base:SetTitle("Menu"); base:SetDraggable(true); base:ShowCloseButton(true); base:MakePopup(); list:SetPos( 5,30 ); list:SetSize( base:GetWide() - 10, base:GetTall() - 10 ); list:SetSpacing( 5 ); list:EnableHorizontal( false ); list:EnableVerticalScrollbar( true ); for key,value in pairs( player.GetAll() ) do -- iterating through a table here local panel = vgui.Create( "DPanel", list); local label = vgui.Create( "DLabel", panel); local button = vgui.Create( "DButton", panel); panel:SetSize( list:GetWide(), 75) label:SetPos( 10, 45 ); label:SetText( value:Nick() ); label:SizeToContents(); button:SetText( "Kick" ) button:SetPos( 500, 48 ) button:SetSize ( 75, 25 ) button.DoClick = function() RunConsoleCommand( "admin_kick", value:SteamID(), "Fuck you" ) end; -- this ends the DoClick function button:SetText( "Ban" ) button:SetPos ( 500, 42) button:SetSize (75, 25 ) button.DoClick = vgui.Create( local slider = vgui.Create( "DSlider", slider) ) end; list:AddItem( panel ); end; -- this ends the for loop end; -- this ends your entire DermaTestFunction --Keybind to open above kick menu[/CODE]
[lua]button.DoClick = function() local Menu = vgui.Create("DFrame") --set menus properties here such as :SetPos(), :SetSize() end[/lua]
Sorry, you need to Log In to post a reply to this thread.