garfield

[FS]: Anti Rcon Attack

Jan 22nd, 2012
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.84 KB | None | 0 0
  1. #include a_samp
  2.  
  3. #define MAX_TENTATIVES              (3)             // Após errar 3 tentativas, o usuário é expulso do servidor.
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.     print( #);
  8.     print( #|-------------[ Sistema de Anti-bad-Rcon ]---------------|);
  9.     printf("O Usuário pode errar %d vezes antes de ser expulso.", MAX_TENTATIVES);
  10.     print( #|-------------[ Sistema de Anti-bad-Rcon ]---------------|);
  11.     return 1;
  12. }
  13.  
  14.  
  15. public OnRconLoginAttempt(ip[], password[], success)
  16. {
  17.     if(!success)
  18.     {
  19.         static Tentativas[MAX_PLAYERS], pip[16];
  20.         for(new i; i != MAX_PLAYERS; ++i)
  21.         {
  22.             GetPlayerIp(i, pip, 16);
  23.             if(!strcmp(pip, ip, true))
  24.             {
  25.                 if(Tentativas[i] == MAX_TENTATIVES)
  26.                 {
  27.                     Tentativas[i] = 0;
  28.                     Kick(i);
  29.                     break;
  30.                 }
  31.                 Tentativas[i]++;
  32.             }
  33.         }
  34.     }
  35.     return 1;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment