Health Station

I am having an issue, I am working on a add-on for my server. This add-on is a really simple one at that but this one thing has me stuck.

The add-on is a health station and whenever it is used it emits a sound but the sound that I have created for it just gets spammed rapidly over and over again even tho I have it cut so that there is time after it. From time to time out of the blue the sound will play correctly but it doesn’t do it all the time. The sound is just a single beep from a EKG machine and about 2.5 seconds of nothing after it. The way it is written is the same way that printers work in DarkRP. Any insight on how to fix my issue is greatly appreciated.


		if self:GetNWInt("Health_amount") > 0 and caller:Health() < 100 then
			self:EmitSound("weapons/health_station/station.wav", 75, 100, 1, CHAN_AUTO)


What is the entity’s use type?

There isn’t one. I am not super new at Glua but I am still learning.


function ENT:Use( activator, caller )

	
		
		if self:GetNWInt("Health_amount") > 0 and caller:Health() < 100 then
			self:EmitSound("weapons/health_station/station.wav", 75, 100, 1, CHAN_AUTO)

		if hp_no_spam == 0 then
			hp_no_spam = 1
			local to_take = self:GetNWInt("Health_amount") - 1
			local to_add = caller:Health() + 1
			self:SetNWInt("Health_amount", to_take )
			caller:SetHealth( to_add )
			
			timer.Simple( Hp_plyfill_rate, function()
			hp_no_spam = 0
			end)
			end
		end
end



self:SetUseType(SIMPLE_USE) in the initialise hook

If you have a look at the TTT health station you will find the code you need.

Where is the health station? I’ve looked for it before and couldn’t find it. I’ll look again when I get home.

Garrysmod/gamemodes/terrortown/entities/entities/ttt_health_station

[LUA]terrortown\entities\entities tt_health_station.lua:96[/LUA]

Y’all are some good people, whenever I get home and change my code, I will mark as solved or ask another question. Thank you to everyone who has helped

This problem still exists…