Release TeamkillKicker
#1
A plugin that kicks teamkillers after a number of warnings. When map changes, warnings are cleared.

Requires @Nukem's Addon v1.292+

sv_config.ini entries:
Code:
[TeamkillKicker] //How many warnings until an action is taken Warnings=2 //What action should be taken, valid: kickClient, banClient, tempBanClient Command=kickClient //Message to be display if an action is taken, valid placeholders {0} - Name, {1} - XUID //Example: ServerMsg=^1{0} has been kicked for teamkilling ServerMsg= //Reason to be display to the person being kicked (only kickClient and tempbanClient) CommandMsg= //Warning to be display, valid placeholder {0} - Name WarnMsg=^1{0} do not teamkill! //Show the warning public PubWarn=0 //Immune xuids, seperate by ',' ImmuneXUIDs=

Source code:
Code:
using System; using System.Collections.Generic; using System.Text; using Addon; using System.Threading; namespace TeamkillKicker { public class TeamkillKicker : CPlugin { //Store warnings Dictionary<string, int> PlayerWarnings = new Dictionary<string, int>(); //How many changes to take action int Warnings = 3; string command = "kickClient"; string commandMsg = string.Empty; string srvMsg = string.Empty; byte PubWarn = 0; string WarnMsg = "^1{0} do not teamkill!"; string[] ImmuneXUIDs; public override void OnMapChange() { PlayerWarnings.Clear(); } public override void OnServerLoad() { try { ServerPrint("\n TeamkillKicker loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz and Pozzuh\n"); ServerPrint(" youtube.com/zxz0O0 \n itsmods.com\n"); Warnings = int.Parse(GetServerCFG("TeamkillKicker", "Warnings", "3")); command = GetServerCFG("TeamkillKicker", "Command", "kickClient"); srvMsg = GetServerCFG("TeamkillKicker", "ServerMsg", string.Empty); commandMsg = GetServerCFG("TeamkillKicker", "CommandMsg", string.Empty); WarnMsg = GetServerCFG("TeamkillKicker", "WarnMsg", "^1{0} do not teamkill!"); ImmuneXUIDs = GetServerCFG("TeamkillKicker", "ImmuneXUIDs", string.Empty).Split(','); if (GetServerCFG("TeamkillKicker", "PubWarn", "0") == "1") PubWarn = 1; } catch (Exception e) { ServerPrint(e.Message); } } public override int OnPlayerDamaged(ServerClient Attacker, ServerClient Victim, string Weapon, int Damage) { //If the victim dies and Victim is not attacker if (Damage >= Victim.Other.Health && Attacker.Team == Victim.Team && Victim.XUID != Attacker.XUID) { foreach (string x in ImmuneXUIDs) if (x == Attacker.XUID) return Damage; //If already stored increase value if (PlayerWarnings.ContainsKey(Attacker.XUID)) PlayerWarnings[Attacker.XUID]++; else PlayerWarnings.Add(Attacker.XUID, 1); //Check if action should be taken if (Warnings <= PlayerWarnings[Attacker.XUID]) { if (!string.IsNullOrEmpty(srvMsg)) ServerSay(string.Format(srvMsg, Attacker.Name, Attacker.XUID), true); ServerPrint("TeamkillKicker executed: " + command + " " + Attacker.ClientNum + " \"" + commandMsg + "\""); ServerPrint("TeamkillKicker Last Name: " + Attacker.Name); ServerCommand(command + " " + Attacker.ClientNum + " \"" + commandMsg + "\""); } else { if (WarnMsg != string.Empty) { if (PubWarn == 1) ServerSay(string.Format(WarnMsg, Attacker.Name), true); else TellClient(Attacker.ClientNum, string.Format(WarnMsg, Attacker.Name), true); } } } return Damage; } } }


Attached Files
.zip   TeamkillKicker.zip (Size: 2.94 KB / Downloads: 261)
[Image: azuw.jpg]
Reply

#2
wish this was running on hardcore teknogods servers
[Image: lQDUjba.jpg]
Reply

#3
namespace AntiNameChanger

public class Class1

Watch out we got a badass coder over here.
Reply

#4
(04-04-2012, 18:42)SuperNovaAO Wrote: namespace AntiNameChanger

public class Class1

Watch out we got a badass coder over here.

How does that matter in the slightest?
[Image: MaEIQ.png]
Reply

#5
(04-04-2012, 18:42)SuperNovaAO Wrote: namespace AntiNameChanger

public class Class1

Watch out we got a badass coder over here.

Heart
[Image: azuw.jpg]
Reply

#6

FINALLY !!!

Was gonna request this Big Grin
Reply

#7
best plugin since promod +1
Reply

#8
Great plugin and working perfect.

Is it possible to have different msg's for each TK up to the maximum?

EG: If it is set to 3 TK before a Temp Ban
* After 1 TK it will msg: ''You have 2 TK's left before TempBan''
* After 2 TK it will msg: ''You have 1 TK left before Tempban''
* After 3 TK, it Kicks/Temp/Bans (Whatever the person has chosen)


Is it possible to make it so that Immune Members can remove a warning from a player.
EG: Sometimes TK is not intentional so it would be great if an admin/immune player could ( !remove krisis ) or similar to remove a warning level.


Is it possible to set it so that if someone TK's within the first 10 seconds of spawn - they are auto tempbanned without previous warnings ?
Reply

#9
Should this work ok with the latest versions of everything ?
Reply

#10
(05-15-2012, 17:58)fookaa Wrote: Should this work ok with the latest versions of everything ?

Yes.
[Image: azuw.jpg]
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.