"OnNPCKilled" hook not working

[lua]hook.Add(“OnNPCKilled”, “uniquenpckilled”, function(npc, attacker, inflictor)
if npc:GetClass() == “npc_citizen” then
attacker:RunConsoleCommand(“cleanercostz”)
end
end)[/lua]
Does not run the command. No errors, either. Help?

[lua]
function GM:OnNPCKilled( victim, killer, weapon )
Msg( victim:GetClass() … " was killed by " … killer:GetName()… " with a " … weapon:GetClass() … ".
" )
end
[/lua]

That’s not what I want. I want to use hook.Add. It IS possible.

[editline]reallydude[/editline]
[lua]function GM:OnNPCKilled( victim, killer, weapon )
Msg( victim:GetClass() … " was killed by " … killer:GetName()… " with a " … weapon:GetClass() … ".
" )
if victim:GetClass() == “npc_citizen” then
killer:RunConsoleCommand(“cleanercostz”)
end
end[/lua]

It doesn’t even work.

Doesn’t mean the hook isn’t working, could be your code in the function. Simply put print(“hi”) in the function and see if it prints it into the console to make sure the hook is working.