Advertisement
GhostOwneD157

[INC] P/ Servidor de BOTS

Jan 23rd, 2012
2,213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.88 KB | None | 0 0
  1. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  2. /* ANTI-RECONNECT - © iPLEOMAX 2011 */
  3. /* Do not remove the credits!       */
  4. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  5. /*
  6.  
  7.      Include feito por: iPLEOMAX
  8.      Linguagem (include): BR/PT
  9.      Editado por: Skoolz.mk
  10.      Obrigado por baixar!        */
  11.  
  12. #if !defined _samp_included
  13.    #tryinclude <a_samp>
  14.    #if !defined _samp_included
  15.        #error a_samp.inc must be included before using this.
  16.    #endif
  17. #endif
  18.  
  19. /*
  20. native ARKick(playerid);
  21. native ARConnect(playerid);
  22. native ARDisconnect(playerid);
  23. native ARIgnore(playerid);
  24. */
  25.  
  26. #define ARConnect(%0) AR_OnPlayerConnect(%0)
  27. #define ARDisconnect(%0) AR_OnPlayerDisconnect(%0)
  28. #define ARIgnore(%0) IPDATA[%0][Ignore] = true
  29.  
  30. #define MAX_R_ATTEMPTS 3
  31. #define STATUS_SECONDS 20
  32. #define RESET_CHECK 10
  33.  
  34. #define PUB:%1(%2) forward %1(%2); public %1(%2)
  35.  
  36. enum IP_DATA
  37. {
  38.     IP_ADDRESS[16],
  39.     bool:Crashing,
  40.     bool:Ignore
  41. };
  42.  
  43. new
  44.     IPDATA[MAX_PLAYERS][IP_DATA],
  45.     Text:CrashTD,
  46.     JoinAttempts,
  47.     JoinIP[16]
  48. ;
  49.  
  50. PUB:AR_OnPlayerConnect(playerid)
  51. {
  52.     new CurIP[16]; GetPlayerIp(playerid, CurIP, sizeof CurIP);
  53.     for(new i=0; i<MAX_PLAYERS; i++)
  54.     {
  55.         if(strlen(IPDATA[i][IP_ADDRESS]) > 2 && !strcmp(CurIP,IPDATA[i][IP_ADDRESS],false))
  56.          {
  57.               printf("ID: %i Pode estar estar tentando fazer uma reconnect!",playerid);
  58.             CrashPlayer(playerid, CurIP);
  59.             break;
  60.         }
  61.     }
  62.     if (!strcmp(CurIP, JoinIP, false))
  63.     {
  64.         JoinAttempts++;
  65.         if (JoinAttempts >= MAX_R_ATTEMPTS)
  66.         {
  67.             CrashPlayer(playerid, CurIP);
  68.         }
  69.     } else JoinAttempts = 0;
  70.     GetPlayerIp(playerid, JoinIP, sizeof(JoinIP));
  71.     return true;
  72. }
  73.  
  74. PUB:AR_OnPlayerDisconnect(playerid)
  75. {
  76.     TextDrawHideForPlayer(playerid, CrashTD);
  77.     IPDATA[playerid][Crashing] = false;
  78.     IPDATA[playerid][Ignore] = false;
  79.     return true;
  80. }
  81.  
  82. PUB:CrashPlayer(playerid, playerIP[])
  83. {
  84.     new pName[MAX_PLAYER_NAME], string[566];
  85.     GetPlayerName(playerid, pName, sizeof(pName));
  86.     if(IPDATA[playerid][Crashing]) return true;
  87.     IPDATA[playerid][Crashing] = true;
  88.     printf("Houve uma RECONNECT no servidor %s(ID: %i)  IP: %s ",pName, playerid,playerIP);
  89.     GameTextForPlayer(playerid, "~RECONNECT# NEVER~!~*%~",1000,3);
  90.     GameTextForPlayer(playerid, "~MORRE*** ~HAHA",1000,3);
  91.     GameTextForPlayer(playerid, "OTARIO ~xD",1000,3);
  92.     TextDrawDestroy(CrashTD);
  93.     CrashTD = TextDrawCreate(320,240,"~WTF");
  94.     TextDrawShowForPlayer(playerid, CrashTD);
  95.     format(string, sizeof(string), "%s(%i) Foi automaticamente banido é crashado! MOTIVO: Reconnect de BOTS", pName, playerid);
  96.     SendClientMessageToAll(-1, string);
  97.     Ban(playerid);
  98.    
  99.     SetTimerEx("CrashStatus",STATUS_SECONDS*1000,false,"ds",playerid,playerIP);
  100.     return true;
  101. }
  102.  
  103. PUB:CrashStatus(playerid, playerIP[])
  104. {
  105.     new CurIP[16]; GetPlayerIp(playerid, CurIP, sizeof CurIP);
  106.     if(IsPlayerConnected(playerid) && !strcmp(CurIP,playerIP,false))
  107.     { printf("Não foi crashado o player: ID %i. [ERRO]",playerid); }
  108.     else
  109.     {
  110.     printf("(ID: %i) - (IP: %s) Foi CRASHADO com sucesso!",playerid,playerIP);
  111.     }
  112.     return true;
  113. }
  114.  
  115. PUB:ARKick(playerid)
  116. {
  117.     if(!IPDATA[playerid][Ignore])
  118.     {
  119.         GetPlayerIp(playerid, IPDATA[playerid][IP_ADDRESS], 16);
  120.         new rchck = RESET_CHECK;
  121.         if(rchck != 0) SetTimerEx("ResetIPSlot", RESET_CHECK*1000, false, "d", playerid);
  122.     }
  123.     printf("[AR-iPLEOMAX]: ARKick Foi usado no (ID: %i)",playerid);
  124.     Kick(playerid);
  125.     return true;
  126. }
  127.  
  128. PUB:ResetIPSlot(ipslotid)
  129. {
  130.     printf("[info] Resetted saved IP Slot %i [%s]",ipslotid, IPDATA[ipslotid][IP_ADDRESS]);
  131.     format(IPDATA[ipslotid][IP_ADDRESS],16,"_");
  132.     return true;
  133. }
  134.  
  135. /*
  136.  
  137.      Include feito por: iPLEOMAX
  138.      Linguagem (include): BR/PT
  139.      Editado por: Skoolz.mk
  140.      Obrigado por baixar!        */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement