Advertisement
Gireada

RCON Protectie

Apr 21st, 2014
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.48 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. forward GetIDFromIp(ip[]);
  4.  
  5. new password2[] = "parola2"; //aici schimbi parola
  6. #define DIALOG_RCON 96
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.     print( "\n[FS] *****************************" );
  11.     print( "[FS] * RCON Protection  by Gireada *" );
  12.     print( "[FS] * Loaded ...            *" );
  13.     print( "[FS] *******************************\n" );
  14. }
  15.  
  16. public GetIDFromIp(ip[])
  17. {
  18.     new ip2[16];
  19.     for(new i = 0; i<MAX_PLAYERS; i++)
  20.     {
  21.         if(IsPlayerConnected(i))
  22.         {
  23.             GetPlayerIp(i, ip2, sizeof(ip2));
  24.             if(strcmp(ip, ip2, true) == 0)
  25.             {
  26.                 return i;
  27.             }
  28.         }
  29.     }
  30.     return -1;
  31. }  
  32.  
  33. public OnRconLoginAttempt(ip[], password[], success)
  34. {
  35.     if(GetIDFromIp(ip) == -1) printf("[%s] nu este connectat.",ip);
  36.     printf("[%s] a incercat parola %s la RCON", ip, password);
  37.     if(success)
  38.     {
  39.         printf("[%s] a ghicit parola %s la RCON", ip, password);
  40.         ShowPlayerDialog(GetIDFromIp(ip), DIALOG_RCON, DIALOG_STYLE_INPUT, "RCON LOGIN", "Te rugam sa introduci parola2 de la RCON. \n\
  41.         Ai o singura incercare.", "OK", "KICK");
  42.     }
  43.     return 1;
  44. }  
  45.  
  46. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  47. {
  48.     if(dialogid == DIALOG_RCON)
  49.     {
  50.         if(response)
  51.         {
  52.             if(strcmp(password2, inputtext, true) == 0)
  53.             {
  54.                 SendClientMessage(playerid, -1, "Bine ai venit stapane");
  55.             }
  56.             else
  57.             {
  58.                 Kick(playerid);
  59.             }  
  60.         }
  61.         else
  62.         {
  63.             Kick(playerid);
  64.         }
  65.         return 1;
  66.     }
  67.  
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement