Release AntiCamp Plugin
#1
A plugin that warns if player does not move a specific distance within a specific time.

Requires:
@Nukem's Server Addon v1.320 or higher

sv_config.ini entries:
Code:
[AntiCamp] //Minimal distance Distance=5 //Within this time Time=4 //Message when someone is camping, use {0} for name, example: {0} stop camping! Message= //After how many warnings is the AdditionalAction executed Warnings=2 //Additional action after too many warnings, kickClient, dropClient, tempBanClient, banClient AdditionalAction= //Plugin enabled, disabled Enabled=1

Chat commands:
Code:
//Enable plugin !camp 1 //Disable plugin !camp 0

Thanks to @makavel for idea and testing

Source code:
Code:
using System; using System.Collections.Generic; using System.Text; using Addon; namespace AntiCamp { public class Class1 : CPlugin { bool PluginEnabled = true; float distance = 5; uint time = 4; uint timer = 16; byte warnings = 2; string message = string.Empty; string AdditionalAction = string.Empty; // ClientNum, Origin Dictionary<int, Vector> Players = new Dictionary<int, Vector>(); // ClientNum, Number of warnings Dictionary<int, uint> WarningDic = new Dictionary<int, uint>(); // ClientNum, Ignores Dictionary<int, uint> IgnoreList = new Dictionary<int, uint>(); public override void OnServerLoad() { ServerPrint("\n AntiCamp loaded \n Author: zxz0O0 \n Idea and testing: Makavel \n Thanks to Nukem, Jariz and Pozzuh\n"); ServerPrint(" youtube.com/zxz0O0 \n itsmods.com\n"); try { distance = float.Parse(GetServerCFG("AntiCamp", "Distance", "5")); time = uint.Parse(GetServerCFG("AntiCamp", "Time", "4")); timer = 4 * time; message = GetServerCFG("AntiCamp", "Message", string.Empty); AdditionalAction = GetServerCFG("AntiCamp", "AdditionalAction", string.Empty); warnings = byte.Parse(GetServerCFG("AntiCamp", "Warnings", "2")); if (GetServerCFG("AntiCamp", "Enabled", "1") == "0") PluginEnabled = false; } catch (Exception e) { ServerPrint(e.ToString()); } } public override void OnPlayerChangeWeapon(ServerClient Client, int WeaponID) { if (WeaponID == GetWeapon("briefcase_bomb_mp")) { if(!IgnoreList.ContainsKey(Client.ClientNum)) IgnoreList.Add(Client.ClientNum, 1); else if (IgnoreList[Client.ClientNum]<2) IgnoreList[Client.ClientNum]++; } } public override void OnPlayerUse(ServerClient Client) { if (!IgnoreList.ContainsKey(Client.ClientNum)) IgnoreList.Add(Client.ClientNum, 1); else if (IgnoreList[Client.ClientNum] < 2) IgnoreList[Client.ClientNum]++; } public override void OnPlayerSpawned(ServerClient Client) { if (!IgnoreList.ContainsKey(Client.ClientNum)) IgnoreList.Add(Client.ClientNum, 2); else IgnoreList[Client.ClientNum] = 2; } //4FPS public override void OnAddonFrame() { if (PluginEnabled) { timer--; if (timer == 0) { timer = 4 * time; foreach (ServerClient c in GetClients()) { if (c.Ping == 999) continue; if (c.Team == Teams.Spectator) continue; if (CheckContinue(c.ClientNum)) continue; if (!Players.ContainsKey(c.ClientNum)) Players.Add(c.ClientNum, new Vector(c.OriginX, c.OriginY, c.OriginZ)); else if (CalculateDistance(c.ClientNum) < distance) { if (!string.IsNullOrEmpty(message)) ServerSay(string.Format(message, c.Name), true); if (!string.IsNullOrEmpty(AdditionalAction)) { if (!WarningDic.ContainsKey(c.ClientNum)) WarningDic.Add(c.ClientNum, 1); else WarningDic[c.ClientNum]++; if (WarningDic[c.ClientNum] > warnings) ServerCommand(AdditionalAction + " " + c.ClientNum); } } } } } } public override ChatType OnSay(string Message, ServerClient Client) { if (Message == "!camp 1") { TellClient(Client.ClientNum, "AntiCamp enabled", true); PluginEnabled = true; return ChatType.ChatNone; } else if (Message == "!camp 0") { TellClient(Client.ClientNum, "AntiCamp disabled", true); PluginEnabled = false; Players.Clear(); WarningDic.Clear(); return ChatType.ChatNone; } return ChatType.ChatContinue; } private float CalculateDistance(int ClientNum) { try { ServerClient c = GetClient(ClientNum); Vector PlayerVec = Players[ClientNum]; float x = PlayerVec.X - c.OriginX; x *= x; float y = PlayerVec.Y - c.OriginY; y *= y; float z = PlayerVec.Z - c.OriginZ; z *= z; Players[ClientNum] = new Vector(c.OriginX, c.OriginY, c.OriginZ); return (float)Math.Sqrt(x + y + z); } catch (Exception e) { ServerPrint(e.ToString()); } return 0; } private bool CheckContinue(int ClientNum) { if (IgnoreList.ContainsKey(ClientNum) && IgnoreList[ClientNum] > 0) { IgnoreList[ClientNum]--; return true; } return false; } public override void OnPlayerDisconnect(ServerClient Client) { if (Players.ContainsKey(Client.ClientNum)) Players.Remove(Client.ClientNum); if (WarningDic.ContainsKey(Client.ClientNum)) WarningDic.Remove(Client.ClientNum); if (IgnoreList.ContainsKey(Client.ClientNum)) IgnoreList.Remove(Client.ClientNum); } } }


Attached Files
.zip   AntiCamp.zip (Size: 3.5 KB / Downloads: 1,367)
[Image: azuw.jpg]
Reply

#2
Fuu Anticamp.... Fuu Angry
Reply

#3
Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu Fuu
Reply

#4
oma faggots can't camp anymore booohoooh
[Image: MaEIQ.png]
Reply

#5
what is the range of the distance?
i presume the time is in seconds?
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#6
(05-19-2012, 13:25)hillbilly Wrote: what is the range of the distance?
i presume the time is in seconds?

Time is seconds, distance, well I don't know what CoD uses, I suppose it's feets. In my plugin distance is a float so the range is 1.5e45 to 3.4e38
[Image: azuw.jpg]
Reply

#7
You are great zxz0O0! Smile

Someone can tell me the difference between:
Kickclient
Dropclient

Another question:
The time camping, when you also account Turret, AC130, etc?
[Image: b_560_95_1.png]
Reply

#8
(05-19-2012, 18:03)Canta Wrote: You are great zxz0O0! Smile

Someone can tell me the difference between:
Kickclient
Dropclient

Another question:
The time camping, when you also account Turret, AC130, etc?

KickClient is like a tempBan. DropClient just kicks the client :S

Yes, though when you are 'using' something you get ignored for one cycle (planting, taking care package, using sentry)
[Image: azuw.jpg]
Reply

#9
@zxz0O0 is now a Company of Heroes Camper Troll
Reply

#10
I was flying with "Reaper" and expelled me from the server with this message:

G_GetPlayerViewDrigin():Couldn't Find

edit:
The full server stopped working. Console.log:
[01:01:16] System.NullReferenceException: Object reference not set to an instance of an object.

at AntiCamp.Class1.OnAddonFrame()

at Addon.PluginCode.TriggerAddonFrame()
[Image: b_560_95_1.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 6,495 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,593 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 55,811 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 7,644 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,298 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 82,124 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 25,163 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,655 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 44,671 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 3,979 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

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