Results 1 to 4 of 4

Hybrid View

  1. #1
    XviperGamingXVG's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    236

    Trouble with derma menu!

    So basically when i type derma_menu in console and submit it, the menu shows up, but when i submit derma_menu again nothing seems to happen (unless you moved the first derma menu), but when i moved the derma menu there was two of them, i tried it a third time and now there was three derma menus, i want it so that when you submit derm_menu in console it opens the derma menu and when you submit it again it closes/removes the derma menu, and when you submit it again it opens the derma menu, pretty much like a toggle.

    Man thats alot of "derma menu", lol :P Thank You for your help!

    Code:
    local function DrawMenu()
    	local frame = vgui.Create("DFrame")
    	frame:SetSize(1110, 650)
    	frame:Center()
    	frame:SetTitle("")
    	frame:MakePopup()
    	frame:SetVisible(true)
    	frame:ShowCloseButton(false)
    	frame:SetDraggable(true)
    	local button = vgui.Create("DButton", frame)
    	button:SetFont('marlett')
    	button:SetText('r')
    	button:SetColor(Color(20, 20, 20))
    	button:SetSize(15, 15)
    	button:SetDrawBackground(false)
    	button:SetPos(frame:GetWide() - 20, 5)
    	button.DoClick = function()
    		frame:Remove()
    	end
    end
    
    concommand.Add("derma_menu", DrawMenu)

  2. #2
    JayFromSubway's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Posts
    30
    Reputation
    10
    Thanks
    4
    Make another concommand called -derma_menu and tell it to remove the frame instead of drawling it, all you're doing at this point is telling it to drawl another.

  3. #3
    XviperGamingXVG's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    236
    Quote Originally Posted by JayFromSubway View Post
    Make another concommand called -derma_menu and tell it to remove the frame instead of drawling it, all you're doing at this point is telling it to drawl another.
    How would you do that im kinda new at lua :|

  4. #4
    iMythik's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    188
    Reputation
    15
    Thanks
    3,228
    maybe try this

    Code:
    local open = false;
    local frame;
    
    local function DrawMenu()
            open = !open
            
            if !open && frame then
                 frame:Remove()
                 return
            end        
    
    	frame = vgui.Create("DFrame")
    	frame:SetSize(1110, 650)
    	frame:Center()
    	frame:SetTitle("")
    	frame:MakePopup()
    	frame:SetVisible(true)
    	frame:ShowCloseButton(false)
    	frame:SetDraggable(true)
    	local button = vgui.Create("DButton", frame)
    	button:SetFont('marlett')
    	button:SetText('r')
    	button:SetColor(Color(20, 20, 20))
    	button:SetSize(15, 15)
    	button:SetDrawBackground(false)
    	button:SetPos(frame:GetWide() - 20, 5)
    	button.DoClick = function()
    		frame:Remove()
    	end
    end
    
    concommand.Add("derma_menu", DrawMenu)
    Last edited by iMythik; 05-13-2017 at 01:02 PM.
    got my account back

Similar Threads

  1. [Help Request] Trouble with derma menu!
    By XviperGamingXVG in forum Garry's Mod Discussions & Help
    Replies: 0
    Last Post: 05-02-2017, 05:58 PM
  2. For the people that are having trouble with the chams...
    By someguy876 in forum Combat Arms Hacks & Cheats
    Replies: 5
    Last Post: 08-31-2008, 10:57 PM
  3. having trouble with my sig
    By Paroxysm in forum Suggestions, Requests & General Help
    Replies: 6
    Last Post: 04-11-2008, 02:10 PM
  4. trouble with code
    By cool4345 in forum WarRock Korea Hacks
    Replies: 3
    Last Post: 05-28-2007, 11:36 AM