Release BadPing
#1
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
Code:
[BADPING] max=500 seconds=20
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


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 { Timer timer = new Timer(); 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.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); } int maxping = 0; Hashtable warnings = new Hashtable(); 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


Attached Files
.zip   BadPing.zip (Size: 2.7 KB / Downloads: 345)

#2
Code:
timer.Interval = Convert.ToInt32(GetServerCFG("BADPING", "seconds", "20"))*100; should be timer.Interval = Convert.ToInt32(GetServerCFG("BADPING", "seconds", "20"))*1000;
[Image: MaEIQ.png]

#3
Which version of addon this plugin?
The plug-in version works, but does not delete 1.168 player with great ping the server, but warns him that he had big. Ping Wouldn't need to players with a ping Server 200-1000, or arms, threw from the players. analogue set sv_maxping "200".

#4
never understood why would you kick players with bad ping
[Image: lQDUjba.jpg]

#5
(01-04-2012, 11:20)OrangePL Wrote: never understood why would you kick players with bad ping

cause it sucks when you play against a lagging opponent

#6
get used to it like me Troll
[Image: lQDUjba.jpg]

#7
Maybe you should check if the high ping is just a lag spike or a stable high ping. Just an example: if the server loses connection to the internet for 1 second it would kick all players because of the high ping. So you could do:

Check 1: has the player high ping?- if yes continue
wait 5 seconds
Check 2: has the player still a high ping? - if yes kick

#8
nvm sorry :p
[Image: MaEIQ.png]

#9
Um, read the code before saying 'IT WILL KICK EVERYONE OMG'.
It runs every 20 secs and will give 3 warnings to people with high ping, after 3 warnings, it will kick
@Pozzuh no need to be sorry, it actually was a mistake, it should be 1000

#10
Flood on the screen.
Does not work.
[Image: y4mFo.png]



Forum Jump:


Users browsing this thread:
1 Guest(s)

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