Advertisement
Guest User

Untitled

a guest
Apr 18th, 2010
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.09 KB | None | 0 0
  1. #include <a_samp>
  2. #include "../include/sscanf.inc"
  3. #include "../include/strtok.inc"
  4. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  5.  
  6. // Color Defines-----------------------------------------------------------------
  7. #define COLOR_GREY 0xAFAFAFAA
  8. #define COLOR_GREEN 0x33AA33AA
  9. #define COLOR_RED 0xFF0000AA
  10. #define COLOR_YELLOW 0xFFFF00AA
  11. #define COLOR_WHITE 0xFFFFFFAA
  12. #define COLOR_CONNECT 0x808080AA
  13. #define COLOR_BLUE 0x0000FFAA
  14. #define COLOR_ORANGE 0xFFA500AA
  15. #define COLOR_PURPLE 0x800080AA
  16. #define COLOR_ERROR 0xD2691EAA
  17. #define COLOR_LIGHTGREEN 0x9ACD32AA
  18. //-------------------------------------------------------------------------------
  19. //Moderator login password
  20. #define M_PASS "superman"
  21.  
  22.  
  23. public OnFilterScriptInit()
  24. {
  25.     print("\n--------------------------------------");
  26.     print(" Blank Filterscript by your name here");
  27.     print("--------------------------------------\n");
  28.    
  29.     return 1;
  30. }
  31.  
  32. public OnFilterScriptExit()
  33. {
  34.     return 1;
  35. }
  36. public OnPlayerCommandText(playerid, cmdtext[])
  37. {
  38.  
  39.         if(!strcmp(cmdtext,"/mlogin",true))
  40.         {
  41.  
  42.                 new tmp[128],idx,pass[128]; //Create variables to store what the user types in.
  43.  
  44.                 tmp = strtok(cmdtext,idx); // Seperate the commandtext from the password the user typed in.
  45.  
  46.                 if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /mlogin [password]"); //Checks to see if the user typed anything in.
  47.                 else if(GetPVarInt(playerid,"Moderator") == 1) return SendClientMessage(playerid,COLOR_GREEN,"You are already logged in.");//Checks to see if the player is already logged in.
  48.                 else
  49.                 {
  50.                     SetPVarInt(playerid,"MLoginTries",3); //Set the total number of tries a user is allowed.
  51.                     if(!strcmp(tmp,M_PASS,false))
  52.                     { //If they typed the right password in. NOTE: this is case-sensitive.
  53.                         if(!GetPVarInt(playerid,"Moderator"))
  54.                         {
  55.                             SetPVarInt(playerid,"Moderator",1);//Set The player to logged in as moderator
  56.                         }
  57.                     }
  58.                     else
  59.                     { // If they did not type the right password in.
  60.                         new LoginTries = GetPVarInt(playerid,"MLoginTries");
  61.                         if(LoginTries == 3)
  62.                         { //Failed the first try.
  63.  
  64.                             SetPVarInt(playerid,"MLoginTries",2);
  65.                             return SendClientMessage(playerid,COLOR_RED,"You entered the wrong password, You have two tries left.");
  66.                         }
  67.                         else if(LoginTries == 2)
  68.                         {//Failed the second try.
  69.                             SetPVarInt(playerid,"MLoginTries",1);
  70.                             return SendClientMessage(playerid,COLOR_RED,"You entered the wrong password, You have one try left.");
  71.                         }
  72.                         else if(LoginTries == 1)
  73.                         {//Failed the third try.
  74.                             SendClientMessage(playerid,COLOR_RED,"You entered the wrong password too many times.");
  75.                             return Kick(playerid);
  76.                         }
  77.                   }
  78.                 }
  79.  
  80.         }
  81.         return 0;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement