Press one time only

Hey, I have this code and its working fine, but you can “spam press” on it and that fucks up the timer.
So i was wondering if there is a way to make so the timer only works the first time you press ore make so
you can only press one time.

[lua]function ENT:AcceptInput( Name, Activator, Caller )
if Name == “Use” and Caller:IsPlayer() then

    timer.Simple( 1, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	timer.Simple( 2, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	timer.Simple( 3, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	timer.Simple( 4, function( )
	
	 self:Explode();
	 self:Remove();
	
	 gm.entity.openDoor(self._Door, 0, true, true);
	end )
end;	

end;[/lua]

You need to set the use type http://wiki.garrysmod.com/?title=Entity.SetUseType in the ENT:Initialize() hook

Oh okay, thanks for helping i will try working with that.

EDIT: Im using SIMPLE_USE maybe you misunderstood me i mean, can i make so it only allowes you to press one time on the object/ent.

Oh ok, sorry try this
[lua]
function ENT:AcceptInput( Name, Activator, Caller )

if Name == "Use" and Caller:IsPlayer() then
if !(self.UsedOnce == nil ) then return end -- Add
    self.UsedOnce = true --Add
    timer.Simple( 1, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	timer.Simple( 2, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	timer.Simple( 3, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	timer.Simple( 4, function( )
	
	 self:Explode();
	 self:Remove();
	
	 gm.entity.openDoor(self._Door, 0, true, true);
	end )
end;	

end;[/lua]

Add these lines like above
[lua]
if !(self.UsedOnce == nil ) then return end – Add
self.UsedOnce = true --Add
[/lua]

[lua]function ENT:AcceptInput( Name, Activator, Caller )
if Name == “Use” and Caller:IsPlayer() then
if( self.UsedOnce )then return; end
if( not self.UsedOnce )then self.UsedOnce = true; end

    timer.Simple( 1, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
    timer.Simple( 2, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
    timer.Simple( 3, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
    timer.Simple( 4, function( )

    self:Explode();
    self:Remove();

    gm.entity.openDoor(self._Door, 0, true, true);
    end )
    timer.Simple( 5, function() self.UsedOnce = false end )
end;

end;[/lua]

How I’d do it.

[editline]24th February 2011[/editline]

Wait I misread it. Use Fantys one.

Thanks allot it works :).