Tracking NPC kills in console/scoreboard and console command to reset scores.

Since when players are killed by NPCs, a message appears in console noting such, I’d like it to work both ways, for example…

(name) killed (npc) with (weapon)

I’d also like each NPC kill to be tracked on the scoreboard, as well as a console command to set everyone’s scores (kills and deaths) to 0 (resetscores or something to that effect).

That’s pretty much it, thanks for reading.

EDIT: Apparently I already have NPC kills tracking on the scoreboard, so omit that from the code, but the rest is still stuff that I want.

ok well theres a hook in garrysmod that tracks player death:

function GM:OnNPCKilled(npc, attacker, weapon)
// oh shit an npc died :frowning:
print(npc:GetClass() … " was killed by " … attacker);

for k,v in pairs(player.GetHumans()) do


function GM:PlayerDeath(ply, attacker, killer)
// player died!
print(ply:GetName() … " was killed by " … killer);

all of this is server side

this code wasnt meant to solve your problem but it will get you on the right track :slight_smile: