Advertisement
Guest User

AntiESCC

a guest
Jul 15th, 2011
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. /****************************************************
  2. SISTEMA ANTI-ESC
  3.  
  4. *****************************************************
  5. * *
  6. * Creditos *
  7. * *
  8. * Criador Geral: Dark.Angel_ *
  9. * Agradecimentos: Iron - Ajudou a testar o FS *
  10. * *
  11. * !!! Não retire os creditos !!! *
  12. ****************************************************/
  13.  
  14. #include <a_samp>
  15.  
  16. forward CheckarPosicao(playerid,giveplayerid,Float:X,Float:Y,Float:Z);
  17. forward LiberarCmd(playerid);
  18.  
  19. new String[128];
  20. new bool:AntiFloodCmdEsc[MAX_PLAYERS];
  21.  
  22. public OnPlayerCommandText(playerid,cmdtext[])
  23. {
  24. new tmp[128]; new cmd[256]; new idx; new giveplayerid;
  25. cmd = strtok(cmdtext,idx);
  26.  
  27. if (strcmp(cmd,"/esc",true) == 0)
  28. {
  29. tmp = strtok(cmdtext,idx);
  30. giveplayerid = strval(tmp);
  31. if (!strlen(tmp)) return SendClientMessage(playerid,0xF67100AA,"Digite: /esc [ID do Jogador]");
  32. if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Este jogador não esta conectado");
  33. if (AntiFloodCmdEsc[playerid] == true) return SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Você deve esperar alguns segundos para re-utilizar este comando");
  34. if (giveplayerid == playerid) return SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Digite um ID diferente do seu");
  35.  
  36. new Float:Posicao[3];
  37. GetPlayerPos(giveplayerid,Posicao[0],Posicao[1],Posicao[2]);
  38.  
  39. if (IsPlayerInRangeOfPoint(playerid,30.0,Posicao[0],Posicao[1],Posicao[2]))
  40. {
  41. SetTimerEx("CheckarPosicao",8000,false,"iifff",playerid,giveplayerid,Posicao[0],Posicao[1],Posicao[2]);
  42. format(String,128,"[ANTI-ESC] Você esta sendo reportado por ESC pelo jogador %s(id:%i), se você não se mover em 8 segundos você sera kickado do servidor",Nome(playerid),playerid);
  43. SendClientMessage(giveplayerid,0xF60000AA,String);
  44. SetTimerEx("LiberarCmd",45000,false,"i",playerid);
  45. format(String,128,"[ANTI-ESC] Você esta reportando o jogador %s(id:%i) por estar de ESC",Nome(giveplayerid),giveplayerid);
  46. SendClientMessage(playerid,0x32EDE0AA,String);
  47. AntiFloodCmdEsc[playerid] = true;
  48. }
  49. else SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Você deve estar a menos de 30 metros do reportado");
  50.  
  51. return true;
  52. }
  53. return false;
  54. }
  55.  
  56. public CheckarPosicao(playerid,giveplayerid,Float:X,Float:Y,Float:Z)
  57. {
  58. new Float:Position[3];
  59. GetPlayerPos(giveplayerid,Position[0],Position[1],Position[2]);
  60. if (Position[0] == X && Position[1] == Y && Position[2] == Z)
  61. {
  62. format(String,128,"[ANTI-ESC] O jogador %s(id:%i) foi kickado por ficar de ESC . %s(id:%i) usou o sistema ANTI-ESC para isso",Nome(giveplayerid),giveplayerid,Nome(playerid),playerid);
  63. SendClientMessageToAll(0x00BC9AAA,String);
  64. Kick(giveplayerid);
  65. }
  66. else
  67. {
  68. format(String,128,"[ANTI-ESC] O jogador %s(id:%i) não esta de ESC",Nome(giveplayerid),giveplayerid);
  69. SendClientMessage(playerid,0x00F6F6AA,String);
  70. }
  71. }
  72.  
  73. public LiberarCmd(playerid) AntiFloodCmdEsc[playerid] = false;
  74.  
  75. public OnPlayerConnect(playerid) SendClientMessage(playerid,0xF67500AA,"Este servidor utiliza Sistema Anti-ESC criado por Dark.Angel_");
  76.  
  77. stock Nome(playerid)
  78. {
  79. new Name[MAX_PLAYER_NAME];
  80. GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
  81. return Name;
  82. }
  83.  
  84. strtok(const string[], &index)
  85. {
  86. new length = strlen(string);
  87. while ((index < length) && (string[index] <= ' '))
  88. {
  89. index++;
  90. }
  91.  
  92. new offset = index;
  93. new result[20];
  94. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  95. {
  96. result[index - offset] = string[index];
  97. index++;
  98. }
  99. result[index - offset] = EOS;
  100. return result;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement