Sipmle script. Rate of fire.

This script doesn’t work. Plz. help me. :dance:
Works - dmg ,but rate of fire doesn’t work.


local function HookEntityTakeDamage(victim, dmg)
	if IsValid(dmg:GetAttacker()) and dmg:GetAttacker():IsPlayer() then
		dmg:ScaleDamage(1.25)
		local weapon = dmg:GetInflictor()
		if IsValid(weapon) and weapon.Primary and weapon.Primary.Delay then
			weapon.Primary.Delay = weapon.Primary.Delay/2
		end
	end
end

hook.Add("EntityTakeDamage", "hook_name", HookEntityTakeDamage)

That’s because that’s a damage scale hook

And what it is necessary a hook?

Well when do you want to change the rate of fire?

Yes I want to change rate of fire.
What hook to use?
Write please

Should be
[lua]
local weapon = dmg:GetAttacker():GetActiveWeapon()
[/lua]

Oh, yes as I forgot about the weapon?
It has to work!
Thanks, is my oversight!

Oh, yes it works!

[editline]23rd March 2015[/editline]

Thx everybody.

[editline]23rd March 2015[/editline]

Thx everybody.