Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- KillStreaks = KillStreaks or {}; -- The main table for the addon
- local kills = {}; -- The table containing players kill streaks;
- hook.Add("PlayerConnect", "KillStreaks.PlayerConnect", function(ply)
- kills[ply:SteamID()] = 0;
- end);
- hook.Add("PlayerDisconnect", "KillStreaks.PlayerDisconnect", function(ply)
- table.Remove(kills, ply:SteamID());
- end);
- hook.Add("PlayerDeath", "KillStreaks.PlayerDeath", function(victim, inflictor, attacker)
- if (IsValid(attacker) and attacker:IsPlayer() and IsValid(victim) and victim:IsPlayer()) then
- kills[attacker:SteamID()] = KillStreaks:GetKills(ply) + 1;
- end
- end);
- function KillStreaks:GetKills(ply)
- return kills[ply:SteamID()] or 0;
- end
- function KillStreaks:Reset(ply)
- kills[ply:SteamID()] = 0;
- end
- function KillStreaks:Subtract(ply, amount)
- kills[ply:SteamID()] = self:GetKills(ply) - amount;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement