Repetitive code

I am creating an entity which gives the player +30 ammunition for their weapon, here is my code for the ENT:Use function:


function ENT:Use(a, c)
	local currentWeapon = a:GetActiveWeapon():GetClass()

	if currentWeapon == "weapon_ar2" then
		a:GiveAmmo(30,"AR2",false)
	end
end

Whenever I press E on the entity, it gives me a lot more than 30 rounds.
I’ve come to the conclusion that the code inside my ENT:Use function is being ran every tick of the game, because it is constantly checking whether or not I am ‘using’ the entity.
Is there a way I can change this so that it will give me an accurate amount of ammo?
Thank you for taking the time to help me out.

You have to use ent:SetUseType(SINGLE_USE)

Thank you!!