Help Lua


function ClientKeyPress()	
	if (!LocalPlayer():IsTyping() and input.IsButtonDown(KEY_Q) == true) then
		if (!Cpress) then
			cantUse = false
		else
			cantUse = true		
		end
		Qpress = true
		
	    if cantUse then return end
		if dFrame_Main_Menu and dFrame_Main_Menu:IsValid() then
			dFrame_Main_Menu:Remove()
			dFrame_Main_Menu = nil
		else
			MainMenu()
		end
		
		Qpress = false
		end
end

this code.

q = not toggle.
toggle code… please…

sorry my bad english

For starters something needs to call this function, like a hook, and based on the code it looks like a think hook is what it was meant for.

[quote=“dmsrb9999, post:1, topic:237146”]


function MainMenu()
	if !LocalPlayer():Alive() then return false end
	
	dFrame_Main_Menu = vgui.Create("DFrame")
	dFrame_Main_Menu:SetTitle("")
	dFrame_Main_Menu:SetSize(mainMenuWidth ,mainMenuHeight)
	dFrame_Main_Menu:Center()
	dFrame_Main_Menu:SetDraggable(false)
	dFrame_Main_Menu:MakePopup()
	dFrame_Main_Menu:ShowCloseButton(true)	
	dFrame_Main_Menu.Paint = function()
		local width, height = dFrame_Main_Menu:GetWide(), dFrame_Main_Menu:GetTall()
		draw.RoundedBox(0,0,0,width,height,Color( 0, 0, 0, 35 ))
		
		surface.SetMaterial( Material( "icons/background_cracks") );
		surface.SetDrawColor( Color(0,0,0,20) );
		surface.DrawTexturedRectUV( 0, 0, width, height, 0, 0, width*0.001, height*0.001 );
	
	end
	
	local tabX,tabY = 11,22
	local tabW,tabH = subMenuWidth, subMenuHeight
	
	local DPropSheet_MenuContents = vgui.Create("DPropertySheet")
	DPropSheet_MenuContents:SetParent(dFrame_Main_Menu)
	DPropSheet_MenuContents:SetPos(12,10)
	DPropSheet_MenuContents:SetSize(tabW,tabH+45)
	DPropSheet_MenuContents.Paint = function() 
	end

	DPanel_Inventory_Tab = vgui.Create("DPanel")
	
	local mainMenuPanels = {DPanel_Inventory_Tab}
	
	for i = 1, table.Count(mainMenuPanels) do
		mainMenuPanels*:SetParent(DPropSheet_MenuContents)
		mainMenuPanels*:SetSize(tabW,tabH)
		mainMenuPanels*:SetPos(tabX,tabY)
		mainMenuPanels*.Paint = function() end
	end
	
	DPropSheet_MenuContents:AddSheet( "인벤토리", 			DPanel_Inventory_Tab, 	"gui/silkicons/backpack", 			true, 	true, "인벤토리의 내용물을 확인할수있습니다.." )
	
	for i = 1, table.Count(DPropSheet_MenuContents.Items) do
		DPropSheet_MenuContents.Items*.Tab:SetAutoStretchVertical(false)
		DPropSheet_MenuContents.Items*.Tab:SetSize(50,50)
		DPropSheet_MenuContents.Items*.Tab:SetFont("DebugFixed")
		DPropSheet_MenuContents.Items*.Tab.Paint = function() 
			draw.RoundedBox(0,0,0,1,18,Color( 0, 0, 0, 255 ))
		end
	end
	
	Inventory_List(DPanel_Inventory_Tab)

end

this?