Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COLOR_YELLOW 0xFFFF00AA
- new ping[MAX_PLAYERS];
- new Text:Ping_Text[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("Anti-Ping And Ping TextDraw Loaded!");
- }
- public OnFilterScriptExit()
- {
- print("Anti-Ping And Ping TextDraw Unloaded!");
- }
- public OnPlayerConnect(playerid)
- {
- Ping_Text[playerid] = TextDrawCreate(380.0,430.0,"Ping:");
- TextDrawTextSize(Ping_Text[playerid], 3.0, 3.6);
- TextDrawSetProportional(Ping_Text[playerid],1);
- TextDrawColor(Ping_Text[playerid],COLOR_YELLOW);
- TextDrawSetShadow(Ping_Text[playerid],0);
- TextDrawSetOutline(Ping_Text[playerid],1);
- TextDrawLetterSize(Ping_Text[playerid],0.5,2);
- TextDrawBackgroundColor(Ping_Text[playerid],-1);
- TextDrawFont(Ping_Text[playerid],1);
- TextDrawShowForPlayer(playerid, Ping_Text[playerid]);
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- DisplayPing(playerid);
- return 1;
- }
- stock DisplayPing(playerid)
- {
- ping[playerid] = GetPlayerPing(playerid);
- if(GetPlayerPing(playerid) > 1000)return SendKick(playerid);
- else if(GetPlayerPing(playerid) < 1000)
- {
- new pings[256];
- format(pings,sizeof(pings),"Ping:%d",GetPlayerPing(playerid));
- TextDrawSetString(Ping_Text[playerid], pings);
- TextDrawShowForPlayer(playerid, Ping_Text[playerid]);
- }
- return 1;
- }
- stock SendKick(playerid)
- {
- new reason[256],name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(reason,sizeof(reason),"{FFFFFF}~ Player {00FF00}%s{FFFFFF} has been auto kicked.(reason:{FFFF00} MAX PING(1000){FFFFFF}) ~",name);
- SendClientMessageToAll(-1,reason);
- Kick(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement