• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
High Ping block still badly needed here
#1
Have tried all others and nothing works properly.
Why is it that so many plugins work great but not for ping?

Help, anyone able to make one that will do the job?
[RBC] Choobie

Ratbag Clan

  Reply
#2
UNTESTED
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using Addon;
  4. using System.Diagnostics;
  5.  
  6. namespace uh
  7. {
  8. public class Class1:CPlugin
  9. {
  10. Stopwatch Time = new Stopwatch();
  11. int Seconds = 10;
  12. public override void OnServerLoad()
  13. {
  14. Time.Start();
  15. ServerPrint("Ping plugin by Archit loaded!");
  16. Seconds=int.Parse(GetServerCFG("Ping", "Re-Check", "10"));
  17. base.OnServerLoad();
  18. }
  19. Dictionary<int, int> Warns = new Dictionary<int, int>();
  20. public override void OnServerFrame()
  21. {
  22. if (GetClients() != null&&Time.Elapsed.Seconds==Seconds)
  23. {
  24. Time.Reset();
  25. foreach (ServerClient Client in GetClients())
  26. {
  27. if (Client.Ping > int.Parse(GetServerCFG("Ping", "MaxPing", "300")))
  28. {
  29. if (Warns.ContainsKey(Client.ClientNum) && Warns[Client.ClientNum] < int.Parse(GetServerCFG("Ping", "MaxWarns", "5")))
  30. {
  31. Warns[Client.ClientNum]++;
  32. TellClient(Client.ClientNum, "Reduce your ping else you will be kicked", true);
  33. }
  34. else if (!Warns.ContainsKey(Client.ClientNum))
  35. {
  36. Warns.Add(Client.ClientNum, 1);
  37. }
  38. else if (Warns[Client.ClientNum] == int.Parse(GetServerCFG("Ping", "MaxWarns", "5")))
  39. {
  40. ServerCommand("dropclient " + Client.ClientNum + " \"You have been kicked because of excess ping\"");
  41. Warns.Remove(Client.ClientNum);
  42. }
  43.  
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }

Add to sv_config.ini
Code:
[Ping]
Re-Check=5
//seconds after which ping is checked again
MaxPing=200
//Ping limit
MaxWarns=5
//Number of warnings followed by a kick
  Reply
#3
(09-30-2012, 08:22)archit Wrote: UNTESTED
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using Addon;
  4. using System.Diagnostics;
  5.  
  6. namespace uh
  7. {
  8. public class Class1:CPlugin
  9. {
  10. Stopwatch Time = new Stopwatch();
  11. int Seconds = 10;
  12. public override void OnServerLoad()
  13. {
  14. Time.Start();
  15. ServerPrint("Ping plugin by Archit loaded!");
  16. Seconds=int.Parse(GetServerCFG("Ping", "Re-Check", "10"));
  17. base.OnServerLoad();
  18. }
  19. Dictionary<int, int> Warns = new Dictionary<int, int>();
  20. public override void OnServerFrame()
  21. {
  22. if (GetClients() != null&&Time.Elapsed.Seconds==Seconds)
  23. {
  24. Time.Reset();
  25. foreach (ServerClient Client in GetClients())
  26. {
  27. if (Client.Ping > int.Parse(GetServerCFG("Ping", "MaxPing", "300")))
  28. {
  29. if (Warns.ContainsKey(Client.ClientNum) && Warns[Client.ClientNum] < int.Parse(GetServerCFG("Ping", "MaxWarns", "5")))
  30. {
  31. Warns[Client.ClientNum]++;
  32. TellClient(Client.ClientNum, "Reduce your ping else you will be kicked", true);
  33. }
  34. else if (!Warns.ContainsKey(Client.ClientNum))
  35. {
  36. Warns.Add(Client.ClientNum, 1);
  37. }
  38. else if (Warns[Client.ClientNum] == int.Parse(GetServerCFG("Ping", "MaxWarns", "5")))
  39. {
  40. ServerCommand("dropclient " + Client.ClientNum + " \"You have been kicked because of excess ping\"");
  41. Warns.Remove(Client.ClientNum);
  42. }
  43.  
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }

Add to sv_config.ini
Code:
[Ping]
Re-Check=5
//seconds after which ping is checked again
MaxPing=200
//Ping limit
MaxWarns=5
//Number of warnings followed by a kick

thanks but I need a plugin not just the code. don't know how to make plugins.
[RBC] Choobie

Ratbag Clan

  Reply
#4
As stated it's untested

here u go.


Attached Files
.rar   ping.rar (Size: 2.42 KB / Downloads: 25)
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

  Reply
#5
(09-30-2012, 14:19)hillbilly Wrote: As stated it's untested

here u go.

Thanks Hillbilly
will test it now
Smile

(10-01-2012, 00:18)choobie Wrote:
(09-30-2012, 14:19)hillbilly Wrote: As stated it's untested

here u go.

Thanks Hillbilly
will test it now
Smile

Tested and not working
tried different settings still no warning.
anyone else wanna give it a test?
[RBC] Choobie

Ratbag Clan

  Reply
#6
Had a quick test and it's not working, no messages no kick.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

  Reply
#7
http://www.itsmods.com/forum/Thread-Rele...block.html
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tutorial] How-To, Mod menu picture-REVISED/no iwifix needed rotceh_dnih 52 29,450 09-28-2013, 02:08
Last Post: Monkey Arms
Its My Birthday! Happy birthday, higH! Party Bot 0 1,595 08-31-2013, 00:00
Last Post: Party Bot
  [Release] Ping Warn Plugin v1.1 master131 28 22,213 07-10-2013, 09:34
Last Post: spike17
  IW5 .EXE and .DLL needed jotape99 7 6,378 06-13-2013, 11:27
Last Post: surtek
  Server console needed joey 1 2,293 06-12-2013, 21:19
Last Post: joey
  headphones <help needed> Arteq 11 5,687 06-08-2013, 16:44
Last Post: xfxtroll
  ping warn 1.1, I passed from the server kpoviv 1 2,190 12-13-2012, 09:47
Last Post: XxBRxX
  Black Ops II IWI block decompression/decryption function kokole 7 4,862 12-07-2012, 22:53
Last Post: master131
  Help cOd IV help needed House 5 3,531 10-27-2012, 19:42
Last Post: House
  [Release] Ping block 1.3 archit 17 9,493 10-07-2012, 02:48
Last Post: archit

Forum Jump:


Users browsing this thread: 1 Guest(s)