Guest User

C' Rcon Security Essential

a guest
Sep 22nd, 2013
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.15 KB | None | 0 0
  1. // By Champ
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7.  
  8. // ******************** DEFINES *****************
  9. #define SecondaryRconPass "changeme2"
  10. #define DIALOG_TYPE_SecondaryRcon           2013
  11. // **********************************************
  12.  
  13. // ***** VARIABLES *******
  14. new Attempts[MAX_PLAYERS];
  15. // ***********************
  16.  
  17. //*********************************************************
  18. //    __                              __
  19. //   /              /      /         /    /              /
  20. //  (___  ___  ___    ___ (___      (___ (___  ___  ___ (___
  21. //      )|    |   )| |   )|             )|    |   )|   )|
  22. //   __/ |__  |    | |__/ |__        __/ |__  |__/||    |__
  23. //                   |
  24. //*********************************************************
  25.  
  26. #if defined FILTERSCRIPT
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     print("\n--------------------------------------");
  31.     print(" C' Rcon Security Essential - Loaded");
  32.     print("--------------------------------------\n");
  33.     return 1;
  34. }
  35.  
  36. public OnFilterScriptExit()
  37. {
  38.     print("\n--------------------------------------");
  39.     print(" C' Rcon Security Essential - UnLoaded");
  40.     print("--------------------------------------\n");
  41.     return 1;
  42. }
  43.  
  44. #endif
  45.  
  46. public OnRconLoginAttempt(ip[], password[], success)
  47. {
  48.     if(success)
  49.     {
  50.         for(new i = 0; i < MAX_PLAYERS; i++)
  51.         {
  52.             if(IsPlayerConnected(i))
  53.             {
  54.                 new pIP[16];
  55.                 GetPlayerIp(i, pIP, 16);
  56.                 if(!strcmp(pIP,ip,true))
  57.                 {
  58.                     new string[128];
  59.                     format(string,sizeof(string),"This Server Uses Rcon Security Essential by Champ.\n Please Enther the Secondary Rcon Password below.");
  60.                     ShowPlayerDialog(i, DIALOG_TYPE_SecondaryRcon, DIALOG_STYLE_INPUT,"C' Rcon Security Essential",string, "Enter", "Exit");
  61.                 }
  62.             }
  63.         }
  64.     }
  65.     return 1;
  66. }
  67.  
  68.  
  69. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  70. {
  71.     if(dialogid == DIALOG_TYPE_SecondaryRcon)
  72.     {
  73.         if (response)
  74.         {
  75.             if (!strcmp(SecondaryRconPass, inputtext) && !(!strlen(inputtext)))
  76.             {
  77.                 GameTextForPlayer(playerid, "~g~ Rcon ~w~ Authorized !",3000,3);
  78.             }
  79.             else
  80.             {
  81.                 if(Attempts[playerid] == 3)
  82.                 {
  83.                     SendClientMessage(playerid, 0xFF0000AA, "You are kicked for entering wrong Secondary Rcon Password");
  84.                     Kick(playerid);
  85.                 }
  86.                 Attempts[playerid] ++;
  87.                 new tmp[140];
  88.                 SendClientMessage(playerid, 0xFF0000AA, "|- Invalid Rcon Password! -|");
  89.                 format(tmp,sizeof(tmp),"Invalid Password!. \nEnter the correct Rcon Password!\n\nAttempts: %d/3", Attempts[playerid]);
  90.                 ShowPlayerDialog(playerid, DIALOG_TYPE_SecondaryRcon, DIALOG_STYLE_INPUT, "C' Rcon Security Essential",tmp, "Enter", "Exit");
  91.             }
  92.         }
  93.         else
  94.         {
  95.             SendClientMessage(playerid, 0xFF0000AA, "Kicked!");
  96.             return Kick(playerid);
  97.         }
  98.     }
  99.     return 1;
  100. }
  101.  
  102. //*************************************************
  103. //    __                              __
  104. //   /              /      /         /            |
  105. //  (___  ___  ___    ___ (___      (___  ___  ___|
  106. //      )|    |   )| |   )|         |    |   )|   )
  107. //   __/ |__  |    | |__/ |__       |__  |  / |__/
  108. //                   |
  109. //*************************************************
Advertisement
Add Comment
Please, Sign In to add comment