Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include "../include/sscanf.inc"
- #include "../include/strtok.inc"
- #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
- // Color Defines-----------------------------------------------------------------
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_CONNECT 0x808080AA
- #define COLOR_BLUE 0x0000FFAA
- #define COLOR_ORANGE 0xFFA500AA
- #define COLOR_PURPLE 0x800080AA
- #define COLOR_ERROR 0xD2691EAA
- #define COLOR_LIGHTGREEN 0x9ACD32AA
- //-------------------------------------------------------------------------------
- //Moderator login password
- #define M_PASS "superman"
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext,"/mlogin",true))
- {
- new tmp[128],idx,pass[128]; //Create variables to store what the user types in.
- tmp = strtok(cmdtext,idx); // Seperate the commandtext from the password the user typed in.
- if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /mlogin [password]"); //Checks to see if the user typed anything in.
- 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.
- else
- {
- SetPVarInt(playerid,"MLoginTries",3); //Set the total number of tries a user is allowed.
- if(!strcmp(tmp,M_PASS,false))
- { //If they typed the right password in. NOTE: this is case-sensitive.
- if(!GetPVarInt(playerid,"Moderator"))
- {
- SetPVarInt(playerid,"Moderator",1);//Set The player to logged in as moderator
- }
- }
- else
- { // If they did not type the right password in.
- new LoginTries = GetPVarInt(playerid,"MLoginTries");
- if(LoginTries == 3)
- { //Failed the first try.
- SetPVarInt(playerid,"MLoginTries",2);
- return SendClientMessage(playerid,COLOR_RED,"You entered the wrong password, You have two tries left.");
- }
- else if(LoginTries == 2)
- {//Failed the second try.
- SetPVarInt(playerid,"MLoginTries",1);
- return SendClientMessage(playerid,COLOR_RED,"You entered the wrong password, You have one try left.");
- }
- else if(LoginTries == 1)
- {//Failed the third try.
- SendClientMessage(playerid,COLOR_RED,"You entered the wrong password too many times.");
- return Kick(playerid);
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement