Derma menu help

Okay i have a problem, i maybe a derma menu which is activated when i press “e” on my printer, but i have a problem.
When i press e, more than 20 menues get opened?

What could cause this?

cl_init

init

Firstly, you should really be using the net library for this; usermessages are outdated now:



util.AddNetworkString( "SomeUniqueName" )
function ENT:Use( ply, caller )
    net.Start( "SomeUniqueName" )
    net.Send( ply )
end


And clientside, replace the usermessage.Hook line with:



net.Receive( "SomeUniqueName", DrawTheMenu )


The cause of your problem is that your Use hook is being called loads of times, because you haven’t set the use type. You do this with

Entity:SetUseType. The following line needs to go in the Initialize() hook:



self:SetUseType( SIMPLE_USE )


Your hook will now only be called once when the player uses the entity. You might also want to add some defensive code in your DrawTheMenu function to ensure that you can’t open more than one menu.

Thank you for the help, the problem was that i forgot the "self:SetUseType( SIMPLE_USE )