Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3.  
  4. #define COLOR_YELLOW 0xFFFF00AA
  5.  
  6.  
  7. new ping[MAX_PLAYERS];
  8.  
  9. new Text:Ping_Text[MAX_PLAYERS];
  10.  
  11.  
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. print("Anti-Ping And Ping TextDraw Loaded!");
  16. }
  17.  
  18. public OnFilterScriptExit()
  19. {
  20. print("Anti-Ping And Ping TextDraw Unloaded!");
  21. }
  22.  
  23.  
  24.  
  25. public OnPlayerConnect(playerid)
  26. {
  27. Ping_Text[playerid] = TextDrawCreate(380.0,430.0,"Ping:");
  28. TextDrawTextSize(Ping_Text[playerid], 3.0, 3.6);
  29. TextDrawSetProportional(Ping_Text[playerid],1);
  30. TextDrawColor(Ping_Text[playerid],COLOR_YELLOW);
  31. TextDrawSetShadow(Ping_Text[playerid],0);
  32. TextDrawSetOutline(Ping_Text[playerid],1);
  33. TextDrawLetterSize(Ping_Text[playerid],0.5,2);
  34. TextDrawBackgroundColor(Ping_Text[playerid],-1);
  35. TextDrawFont(Ping_Text[playerid],1);
  36. TextDrawShowForPlayer(playerid, Ping_Text[playerid]);
  37.  
  38. return 1;
  39. }
  40.  
  41.  
  42. public OnPlayerUpdate(playerid)
  43. {
  44. DisplayPing(playerid);
  45. return 1;
  46. }
  47.  
  48.  
  49. stock DisplayPing(playerid)
  50. {
  51. ping[playerid] = GetPlayerPing(playerid);
  52. if(GetPlayerPing(playerid) > 1000)return SendKick(playerid);
  53. else if(GetPlayerPing(playerid) < 1000)
  54. {
  55. new pings[256];
  56. format(pings,sizeof(pings),"Ping:%d",GetPlayerPing(playerid));
  57. TextDrawSetString(Ping_Text[playerid], pings);
  58. TextDrawShowForPlayer(playerid, Ping_Text[playerid]);
  59. }
  60. return 1;
  61. }
  62.  
  63.  
  64. stock SendKick(playerid)
  65. {
  66. new reason[256],name[MAX_PLAYER_NAME];
  67. GetPlayerName(playerid,name,sizeof(name));
  68. format(reason,sizeof(reason),"{FFFFFF}~ Player {00FF00}%s{FFFFFF} has been auto kicked.(reason:{FFFF00} MAX PING(1000){FFFFFF}) ~",name);
  69. SendClientMessageToAll(-1,reason);
  70. Kick(playerid);
  71. return 1;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement