Killstreak Modifier| A Garry's Mod Killstreak System

Welcome to KSM, a simple Killstreak addon that comes with pre-downloaded sounds for all players when reaching a certain killing streak.
If you don’t know what a STREAK is, its something that happens over and over again, for example; someone kills another player and continues killing other players without dying (Kill Streak)

This addon allows you to add custom sounds, custom functions after a player gets a kill and a very simple kill streak tracker.

The github repository explains how to use this addon, download below.

Please leave feedback!
Thanks, Jacob.

Good start, but a few suggestions to improve the script:

This file should be in lua/autorun/server, or ran serverside in some fashion.
You don’t have to include/AddCSLuaFile files in lua/autorun/*.
You only have to resource.AddSingleFile the sound/ directory files - not all three paths.
You also have to check if the attacker is a player in this function - it could be the world, an NPC, or even NULL if the attacker was not set in the damage info.
string.Replace already handles if the sub-string wasn’t found - you don’t have to have the string.find checks.
Just network directly to the client and tell them to play the sound - sending the code string is unneeded.
You can cache this since the table shouldn’t change during gameplay.
You can also just ping the client to display the message since the config table is shared.
If you allow this to repeat, once a player reach 12 kills, they’ll easily be able to snowball and get a ton of health.

Really, the entire loop can be eliminated if at hook creation time you re-arrange the config table into a separate numerically-indexed array that contains the kill data into tModifiers[streak] = {display message, sound}. You’ll also want to consider if you want

GM:PlayerSilentDeath to be included in resetting the streak.

Thanks for the feedback! I’ll fix some things up.
And the 12 kills is just an example of what the player can do :P, thanks Code.