A bad ping kicker, if you don't want lagging players, install this.
WARNING: Not tested. Don't freak out when it doesn't work, just tell me and i'll fix it ASAP
Settings (not required, just when you want to change the settings do this: )
In addon\\sv_config.ini add
max is the max ping a user is able to have
seconds is the amount of seconds the plugin waits before checking if someone has a to high ping
Credits
- @JariZ
Download
WARNING: Not tested. Don't freak out when it doesn't work, just tell me and i'll fix it ASAP
Settings (not required, just when you want to change the settings do this: )
In addon\\sv_config.ini add
Code:
[BADPING]
max=500
seconds=20
seconds is the amount of seconds the plugin waits before checking if someone has a to high ping
Credits
- @JariZ
CSHARP Code
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Diagnostics;
- using Addon;
- using System.Timers;
- using System.Collections;
-
- namespace BadPing
- {
- public class BadPing : CPlugin
- {
- public override void OnServerLoad()
- {
- ServerPrint("BadPing by JariZ loaded.");
-
- maxping = Convert.ToInt32(GetServerCFG("BADPING", "max", "500"));
- timer.Interval = Convert.ToInt32(GetServerCFG("BADPING", "seconds", "20"))*100; //20 secs
- timer.Start();
- }
- int maxping = 0;
- void timer_Elapsed(object sender, ElapsedEventArgs e)
- {
- List<ServerClient> list = GetClients();
- foreach (ServerClient client in list)
- {
- if (client.Ping > maxping)
- {
- object nyancat = null;
- try
- {
- nyancat = warnings[client.XUID];
- }
- catch { }
- if (nyancat == null)
- {
- doWarn(client, 1);
- warnings.Add(client.XUID, 1);
- }
- else
- {
- doWarn(client, (int)warnings[client.XUID]);
- int curr = (int)warnings[client.XUID];
- warnings[client.XUID] = curr + 1;
- if(curr == 3) ByeBye(client);
- warnings[client.XUID] = 0; //reset warns
- }
- }
- }
- }
-
- void doWarn(ServerClient player, int warn)
- {
- iPrintLnBold("^2BadPing: ^3WARNING (" + warn + "/3 ^1Your ping is to high (max " + maxping + ")", player);
- ServerSay("^2BadPing: ^3WARNING (" + warn + "/3 ^1" + player.Name + "'s ping is to high (max " + maxping + ")", true);
- }
-
- void ByeBye(ServerClient player)
- {
- ServerCommand("clientkick " + player.ClientNum);
- ServerSay("^2BadPing: ^3" + player.Name + " ^1got kicked because of their high ping", true);
- }
- }
- }
Download