Advertisement
jamesmith

PingBuster by MafiaOink | Mirror By JamesSmith

Aug 5th, 2015
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. #include <a_samp>
  2. #include <progress2>
  3.  
  4. #define MaxPing 1000
  5.  
  6. new PlayerBar:Ping[MAX_PLAYERS];
  7. new PlayerText:Textdraw0[MAX_PLAYERS];
  8.  
  9. forward UpdateBars(playerid);
  10. forward KickPlayer(playerid);
  11. forward OnFilterScriptFullInit();
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. SendRconCommand("ackslimit 5000"); // wait 1 seconds for it to apply dont know why but I have problem in grandlarc for testing so I changed it.
  16. SetTimer("OnFilterScriptFullInit", 1000, false);
  17. return 1;
  18. }
  19.  
  20. public OnFilterScriptFullInit()
  21. {
  22. print("Loading Filterscript: PingBuster");
  23. print("--------------------");
  24. print("PingBuster has successfully loaded!");
  25. printf("Ticks Passed: %i", GetTickCount());
  26. print("Made by MafiaOink");
  27. print("---------------------------------");
  28. return 1;
  29. }
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33. Ping[playerid] = CreatePlayerProgressBar(playerid, 6.00, 306.00, 106.50, 4.50, 14535935, MaxPing.0, BAR_DIRECTION_RIGHT);
  34. ShowPlayerProgressBar(playerid, PlayerBar:Ping[playerid]);
  35. SetTimerEx("UpdateBars", 1, true, "i", playerid);
  36.  
  37. Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 5.333332, 285.444427, "Ping: Low(1ms)");
  38. PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.346888, 1.677777);
  39. PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
  40. PlayerTextDrawColor(playerid, Textdraw0[playerid], 16777215);
  41. PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
  42. PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
  43. PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
  44. PlayerTextDrawFont(playerid, Textdraw0[playerid], 2);
  45. PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
  46. PlayerTextDrawShow(playerid, PlayerText:Textdraw0[playerid]);
  47. return 1;
  48. }
  49.  
  50. public UpdateBars(playerid)
  51. {
  52. new GPing, iStr[128];
  53. GPing = GetPlayerPing(playerid);
  54. SetPlayerProgressBarValue(playerid, PlayerBar:Ping[playerid], GPing);
  55. if(GPing < 120)
  56. {
  57. format(iStr, sizeof(iStr), "Ping: Low(%ims)", GPing);
  58. PlayerTextDrawSetString(playerid, Textdraw0[playerid], iStr);
  59. }
  60. else if(GPing >= 120)
  61. {
  62. format(iStr, sizeof(iStr), "Ping: Normal(%ims)", GPing);
  63. PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
  64. }
  65. else if(GPing >= 300)
  66. {
  67. format(iStr, sizeof(iStr), "Ping: Medium(%ims)", GPing);
  68. PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
  69. }
  70. else if(GPing >= 500)
  71. {
  72. format(iStr, sizeof(iStr), "Ping: High(%ims)", GPing);
  73. PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
  74. }
  75. else if(GPing >= 800)
  76. {
  77. format(iStr, sizeof(iStr), "Ping: Extreme High(%ims)", GPing);
  78. PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
  79. }
  80. else if(GPing >= MaxPing)
  81. {
  82. format(iStr, sizeof(iStr), "Ping: Limit Crossed(%ims)", GPing);
  83. PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
  84. SetTimerEx("KickPlayer", 2000, false, "i", playerid);
  85. SendClientMessage(playerid, -1, "You have crossed the Ping Limit, You are being kicked for that.");
  86. }
  87. return 1;
  88. }
  89.  
  90. public KickPlayer(playerid)
  91. {
  92. Kick(playerid);
  93. return 1;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement