• Assmod functions?
    6 replies, posted
Ok so i am totally out of ideas, I have been working on this Derma menu for a buddy, and i just cant figure out how to make it a + command (when you hold the button bound to it, you see it, when you let go it disappears, such as in assmod). Any ideas people of FP?
concommand.Add("+command", openMenu) concommand.Add("-command", closeMenu) Change the name of the command and the names of the functions to suit your script. Edit: Sweet, 600 posts of non-spam.
[QUOTE=yakahughes;21224092]concommand.Add("+command", openMenu) concommand.Add("-command", closeMenu) Change the name of the command and the names of the functions to suit your script.[/QUOTE] Would the openmenu and closemenu functions both be the same?
No, the function to open the menu, which would be in the + command, would open the menu, and the - command function would close it, by doing menuVariable:Close() or whatever it is.
Here i'll upload my entire err.. menu the entire derma so far
Sorry it took so long here it is. [lua] function mikeyderma() local frame = vgui.Create( "DFrame" ) frame:SetTitle( "Mikey's Requested Derma Menu" ) frame:SetSize( 215, 150 ) -- Let's set the size frame:SetPos( ScrW() / 2, ScrH() / 2 ) frame:SetDraggable( true ) --You can make it false if you'd like frame:SetVisible( true ) frame:ShowCloseButton( true ) --Once again, if you don't want it, change it frame:MakePopup() Button1 = vgui.Create( "DButton", frame ) Button1:SetParent( frame ) Button1:SetSize( 100, 20 ) Button1:SetPos( 5, 25 ) Button1:SetText("Button 1") Button1.DoClick = function() RunConsoleCommand( "kill" ) end Button2 = vgui.Create( "DButton", frame ) Button2:SetParent( frame ) Button2:SetSize( 100, 20 ) Button2:SetPos( 110, 25 ) Button2:SetText("Button 2") Button2.DoClick = function() RunConsoleCommand( "kill" ) end Button3 = vgui.Create( "DButton", frame ) Button3:SetParent( frame ) Button3:SetSize( 100, 20 ) Button3:SetPos( 5, 50 ) Button3:SetText("Button 3") Button3.DoClick = function() RunConsoleCommand( "kill" ) end Button4 = vgui.Create( "DButton", frame ) Button4:SetParent( frame ) Button4:SetSize( 100, 20 ) Button4:SetPos( 110, 50 ) Button4:SetText("Button 4") Button4.DoClick = function() RunConsoleCommand( "kill" ) end Button5 = vgui.Create( "DButton", frame ) Button5:SetParent( frame ) Button5:SetSize( 100, 20 ) Button5:SetPos( 5, 75 ) Button5:SetText("Button 5") Button5.DoClick = function() RunConsoleCommand( "kill" ) end Button6 = vgui.Create( "DButton", frame ) Button6:SetParent( frame ) Button6:SetSize( 100, 20 ) Button6:SetPos( 110, 75 ) Button6:SetText("Button 6") Button6.DoClick = function() RunConsoleCommand( "kill" ) end Button7 = vgui.Create( "DButton", frame ) Button7:SetParent( frame ) Button7:SetSize( 100, 20 ) Button7:SetPos( 5, 100 ) Button7:SetText("Button 7") Button7.DoClick = function() RunConsoleCommand( "kill" ) end Button8 = vgui.Create( "DButton", frame ) Button8:SetParent( frame ) Button8:SetSize( 100, 20 ) Button8:SetPos( 110, 100 ) Button8:SetText("Button 8") Button8.DoClick = function() RunConsoleCommand( "kill" ) end Button9 = vgui.Create( "DButton", frame ) Button9:SetParent( frame ) Button9:SetSize( 100, 20 ) Button9:SetPos( 5, 125 ) Button9:SetText("Button 9") Button9.DoClick = function() RunConsoleCommand( "kill" ) end Button10 = vgui.Create( "DButton", frame ) Button10:SetParent( frame ) Button10:SetSize( 100, 20 ) Button10:SetPos( 110, 125 ) Button10:SetText("Button 10") Button10.DoClick = function() RunConsoleCommand( "kill" ) end end concommand.Add( "+Perp_Menu", mikeyderma ) [/lua] What do i needa add
[lua] local frame function mikeyderma() frame = vgui.Create( "DFrame" ) frame:SetTitle( "Mikey's Requested Derma Menu" ) frame:SetSize( 215, 150 ) -- Let's set the size frame:SetPos( ScrW() / 2, ScrH() / 2 ) frame:SetDraggable( true ) --You can make it false if you'd like frame:SetVisible( true ) frame:ShowCloseButton( true ) --Once again, if you don't want it, change it frame:MakePopup() Button1 = vgui.Create( "DButton", frame ) Button1:SetParent( frame ) Button1:SetSize( 100, 20 ) Button1:SetPos( 5, 25 ) Button1:SetText("Button 1") Button1.DoClick = function() RunConsoleCommand( "kill" ) end Button2 = vgui.Create( "DButton", frame ) Button2:SetParent( frame ) Button2:SetSize( 100, 20 ) Button2:SetPos( 110, 25 ) Button2:SetText("Button 2") Button2.DoClick = function() RunConsoleCommand( "kill" ) end Button3 = vgui.Create( "DButton", frame ) Button3:SetParent( frame ) Button3:SetSize( 100, 20 ) Button3:SetPos( 5, 50 ) Button3:SetText("Button 3") Button3.DoClick = function() RunConsoleCommand( "kill" ) end Button4 = vgui.Create( "DButton", frame ) Button4:SetParent( frame ) Button4:SetSize( 100, 20 ) Button4:SetPos( 110, 50 ) Button4:SetText("Button 4") Button4.DoClick = function() RunConsoleCommand( "kill" ) end Button5 = vgui.Create( "DButton", frame ) Button5:SetParent( frame ) Button5:SetSize( 100, 20 ) Button5:SetPos( 5, 75 ) Button5:SetText("Button 5") Button5.DoClick = function() RunConsoleCommand( "kill" ) end Button6 = vgui.Create( "DButton", frame ) Button6:SetParent( frame ) Button6:SetSize( 100, 20 ) Button6:SetPos( 110, 75 ) Button6:SetText("Button 6") Button6.DoClick = function() RunConsoleCommand( "kill" ) end Button7 = vgui.Create( "DButton", frame ) Button7:SetParent( frame ) Button7:SetSize( 100, 20 ) Button7:SetPos( 5, 100 ) Button7:SetText("Button 7") Button7.DoClick = function() RunConsoleCommand( "kill" ) end Button8 = vgui.Create( "DButton", frame ) Button8:SetParent( frame ) Button8:SetSize( 100, 20 ) Button8:SetPos( 110, 100 ) Button8:SetText("Button 8") Button8.DoClick = function() RunConsoleCommand( "kill" ) end Button9 = vgui.Create( "DButton", frame ) Button9:SetParent( frame ) Button9:SetSize( 100, 20 ) Button9:SetPos( 5, 125 ) Button9:SetText("Button 9") Button9.DoClick = function() RunConsoleCommand( "kill" ) end Button10 = vgui.Create( "DButton", frame ) Button10:SetParent( frame ) Button10:SetSize( 100, 20 ) Button10:SetPos( 110, 125 ) Button10:SetText("Button 10") Button10.DoClick = function() RunConsoleCommand( "kill" ) end end concommand.Add( "+Perp_Menu", mikeyderma ) concommand.Add("-Perp_Menu", function() frame:Close() end) [/lua] [editline]03:32AM[/editline] It would be better to write the function, call it once, call frame:SetVisible(false), and make the two concommands just do frame:SetVisible(true) and frame:SetVisible(false) so you don't rebuild the frame every time.
Sorry, you need to Log In to post a reply to this thread.