Pressing use on an entity opens multiple derma menus instead of one

Pressing use on the entity should only open one derma menu, but it’s opening like five.

cl_init:
[lua]
function MoneyPrinterSettings()
local DermaPanel = vgui.Create( “DFrame” )
DermaPanel:SetPos( 100,100 )
DermaPanel:SetSize( 500, 700 )
DermaPanel:SetTitle( “Money Printer” )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()

local DermaListView = vgui.Create("DListView")
DermaListView:SetParent(DermaPanel)
DermaListView:SetPos(25, 50)
DermaListView:SetSize(450, 625)
DermaListView:SetMultiSelect(false)
DermaListView:AddColumn("Name")

end
usermessage.Hook(“MoneyPrinterSettings”, MoneyPrinterSettings)
[/lua]

init:
[lua]
function ENT:AcceptInput( Name, Caller )

if Name == "Use" and Caller:IsPlayer() then
	
	umsg.Start("MoneyPrinterSettings", Caller) 
	umsg.End() 
end

end
[/lua]

That might be running continuously while use is held down, try ENT:Use instead

If you want it to only open one menu per press, the use type needs to be set to SIMPLE_USE. Use

Entity:SetUseType to, well, set the use type. Use this in conjunction with what Niandra said.

Use a variable. Use a variable!
This is a common errors!


function ENT:AcceptInput( Name, Caller )	
if Caller.is_in_menu == nil then Caller.is_in_menu=false end

	if Name == "Use" and Caller:IsPlayer() then
		if !Caller.is_in_menu then
		--umsg.Start("MoneyPrinterSettings", Caller) 
		--umsg.End()
                --Usermessage are deprecated.
                net.Start("MoneyPrinterSettings")
                net.Send(Caller)
                end
	end
	
end


function MoneyPrinterSettings()
	local DermaPanel = vgui.Create( "DFrame" )
	DermaPanel:SetPos( 100,100 )
	DermaPanel:SetSize( 500, 700 )
	DermaPanel:SetTitle( "Money Printer" )
	DermaPanel:SetVisible( true )
	DermaPanel:SetDraggable( true )
	DermaPanel:ShowCloseButton( true )
	DermaPanel:MakePopup()

	local DermaListView = vgui.Create("DListView")
	DermaListView:SetParent(DermaPanel)
	DermaListView:SetPos(25, 50)
	DermaListView:SetSize(450, 625)
	DermaListView:SetMultiSelect(false)
	DermaListView:AddColumn("Name")

end
net.Receive("MoneyPrinterSettings",function() MoneyPrinterSettings() end)

Where did you get “Caller.is_in_menu” from?

This is being your problem.
You have to set the use type to SIMPLE_USE for that to only be exed once

[editline]2nd October 2015[/editline]

What the fuck?

Alright, thank you all for your help. It’s working now!