Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <progress2>
- #define MaxPing 1000
- new PlayerBar:Ping[MAX_PLAYERS];
- new PlayerText:Textdraw0[MAX_PLAYERS];
- forward UpdateBars(playerid);
- forward KickPlayer(playerid);
- forward OnFilterScriptFullInit();
- public OnFilterScriptInit()
- {
- 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.
- SetTimer("OnFilterScriptFullInit", 1000, false);
- return 1;
- }
- public OnFilterScriptFullInit()
- {
- print("Loading Filterscript: PingBuster");
- print("--------------------");
- print("PingBuster has successfully loaded!");
- printf("Ticks Passed: %i", GetTickCount());
- print("Made by MafiaOink");
- print("---------------------------------");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Ping[playerid] = CreatePlayerProgressBar(playerid, 6.00, 306.00, 106.50, 4.50, 14535935, MaxPing.0, BAR_DIRECTION_RIGHT);
- ShowPlayerProgressBar(playerid, PlayerBar:Ping[playerid]);
- SetTimerEx("UpdateBars", 1, true, "i", playerid);
- Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 5.333332, 285.444427, "Ping: Low(1ms)");
- PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.346888, 1.677777);
- PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawColor(playerid, Textdraw0[playerid], 16777215);
- PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
- PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
- PlayerTextDrawFont(playerid, Textdraw0[playerid], 2);
- PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawShow(playerid, PlayerText:Textdraw0[playerid]);
- return 1;
- }
- public UpdateBars(playerid)
- {
- new GPing, iStr[128];
- GPing = GetPlayerPing(playerid);
- SetPlayerProgressBarValue(playerid, PlayerBar:Ping[playerid], GPing);
- if(GPing < 120)
- {
- format(iStr, sizeof(iStr), "Ping: Low(%ims)", GPing);
- PlayerTextDrawSetString(playerid, Textdraw0[playerid], iStr);
- }
- else if(GPing >= 120)
- {
- format(iStr, sizeof(iStr), "Ping: Normal(%ims)", GPing);
- PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
- }
- else if(GPing >= 300)
- {
- format(iStr, sizeof(iStr), "Ping: Medium(%ims)", GPing);
- PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
- }
- else if(GPing >= 500)
- {
- format(iStr, sizeof(iStr), "Ping: High(%ims)", GPing);
- PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
- }
- else if(GPing >= 800)
- {
- format(iStr, sizeof(iStr), "Ping: Extreme High(%ims)", GPing);
- PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
- }
- else if(GPing >= MaxPing)
- {
- format(iStr, sizeof(iStr), "Ping: Limit Crossed(%ims)", GPing);
- PlayerTextDrawSetString(playerid, PlayerText:Textdraw0[playerid], iStr);
- SetTimerEx("KickPlayer", 2000, false, "i", playerid);
- SendClientMessage(playerid, -1, "You have crossed the Ping Limit, You are being kicked for that.");
- }
- return 1;
- }
- public KickPlayer(playerid)
- {
- Kick(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement