Entity Use Creates A Lot Of Derma Panels?

So I am coding an entity that when you hit e on it, it opens a menu that you can deposit money and withdraw and stuff. I just started so there is no coding for money or buttons yet. But, I have everything working except for the fact that the longer I hold e on the entity, the more derma panels it opens. For example, if I hold it for 3 seconds, its opens 117 derma panels… My question is, how do I make it so even if you hold e, it only opens 1 derma panel? Here is all of my coding so far.

cl_init.lua


include("shared.lua")

function ENT:Draw()

	self:DrawModel()

end

local function DrawMenu()
	local Frame = vgui.Create( "DFrame" )
	Frame:SetSize( 100, 100 )
	Frame:Center()
	Frame:SetTitle("Options")
	Frame:ShowCloseButton(true)
	Frame:SetSizable(false)
	Frame:SetDeleteOnClose(true)
	Frame:MakePopup()

end
usermessage.Hook( "DrawMenu", DrawMenu )

init.lua


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")

function ENT:Initialize()

	self:SetModel("models/props_wasteland/controlroom_desk001b.mdl")
	self:PhysicsInit(SOLID_VPHYSICS)
	self:SetMoveType(MOVETYPE_VPHYSICS)
	self:SetSolid(SOLID_VPHYSICS)

	local phys = self:GetPhysicsObject()

	if phys:IsValid() then

		phys:Wake()

	end

end

function ENT:Use( ply, caller )
	umsg.Start( "DrawMenu", ply )
		umsg.Short( "1" )
	umsg.End()
end

shared.lua


ENT.Type = "anim"
ENT.Base = "base_gmodentity"

ENT.PrintName = "Test Entity"

ENT.Spawnable = true

Entity:SetUseType

And when you create your panel, store it somewhere you can actually access it. And get into the habit of using the net library instead of usermessages.

In your ENT:Initialize() function, do this:


self:SetUseType(SIMPLE_USE)

EDIT:

ok ninja me

Ok so like you both said I added self:SetUseType(SIMPLE_USE) to my serverside. That didn’t do anything though. Also, what do you mean by store it somewhere and if I were to use the net library, what would I change?

[editline]27th November 2016[/editline]

EDIT: Nvm I just reloaded by console and game and it worked my bad but again what do you mean by store it somewhere and if I were to use the net library, what would I change?


--server

util.AddNetworkString("sendDerma") --must add this to send net messages

function ENT:Use(ply, caller)
      net.Start("sendDerma")
      net.Send(caller)
end



--client

net.Receive("sendDerma", function(len)
--derma code
end)


And I’m assuming that sannys means is that you would wanna create a variable like


menu = false;

Then check to see if it has a value, then assign it to a derma menu and then just use the function menu:SetVisible(boolean) to make it open/close. You’d just have to set
the menu variable to true/false.