local totalKilled = achievements.GetValue( "Pest Control", "total", 0 ) local function PlayerKilledNPC( msg ) if ( totalKilled == 500 ) then return end local class = msg:ReadString() local weapon = msg:ReadString() local ply = msg:ReadEntity() if ( ply == LocalPlayer() ) then if ( weapon == "weapon_crowbar" ) then totalKilled = math.Clamp( totalKilled + 1, 0, 500 ) achievements.SetValue( "Pest Control", "total", totalKilled ) achievements.Update( "Pest Control", totalKilled / 500, totalKilled .. "/500" ) end end return class, weapon, ply end usermessage.AddHook( "PlayerKilledNPC", "Achievements.PestControl", PlayerKilledNPC ) achievements.Register( "Pest Control", "Kill 500 NPCs with the crowbar.", "achievements/pestcontrol", totalKilled / 500, totalKilled .. "/500" )