Cannot Login in game!
#2

try this maybe?
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            new string[256];
           
            if(!response ) return Kick(playerid);
            if( response )
            {
                if(strlen(inputtext) < 6)
                {
                SendClientMessage(playerid, COLOR_ERROR, "Your Password Is Too Short, Enter a Long Password.");
               
                format(string, sizeof(string), "{0835C7}Cruel World Cops And Robbers\n \n{FFFFFF}New Registration\nName: {146AC7}%s\n \n{FFFFFF}Do {FF0000}Not {FFFFFF}Register Multiple Accounts\nDo {FF0000}Not {FFFFFF}Use The Same Password That You Use Elsewhere\nMinimum {FF0000}6 Chars {FFFFFF}Maximum {FF0000}12 Chars\n \nPlease {D6D631}Enter A Password {FFFFFF}For Your Account:",PlayerInfo[playerid][pName],playerid);
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT , "CnR Registration",string, "Register", "Cancel");
                return 1;
                }

                if(strlen(inputtext) > 12)
                {
                SendClientMessage(playerid, COLOR_ERROR, "Your Password Is Too Long, Enter a Short Password.");
               
                format(string, sizeof(string), "{0835C7}Cruel World Cops And Robbers\n \n{FFFFFF}New Registration\nName: {146AC7}%s\n \n{FFFFFF}Do {FF0000}Not {FFFFFF}Register Multiple Accounts\nDo {FF0000}Not {FFFFFF}Use The Same Password That You Use Elsewhere\nMinimum {FF0000}6 Chars {FFFFFF}Maximum {FF0000}12 Chars\n \nPlease {D6D631}Enter A Password {FFFFFF}For Your Account:",PlayerInfo[playerid][pName],playerid);
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT , "CnR Registration",string, "Register", "Cancel");
                return 1;
                }

                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"PlayerInfo");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Registered",1);
                INI_WriteInt(File,"Adminlevel",0);
                INI_WriteInt(File,"Money",0);
                INI_WriteInt(File,"Score",0);
                INI_Close(File);

                PlayerInfo[playerid][pLogged] = 1;
                PlayerInfo[playerid][pRegistered] = 1;
                GivePlayerMoney(playerid,25000);
               
                SendClientMessage(playerid, -1, "New Account Created.  Your Are Now Logged In.");
                SendClientMessage(playerid, -1, "Type /help  and  /commands  For Game Information, or visit "WEBSITE"");
            }
        }

        case DIALOG_LOGIN:
        {
            new string[256];
           
            if(!response ) return Kick (playerid);
            if( response )
            {
                if(!strcmp(udb_hash, PlayerInfo[playerid][pPassword]))
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    PlayerInfo[playerid][pLogged] = 1;

                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                }
                else
                {
                    new loginstr[128];
                    LoginAttempts[playerid]++;

                    if(LoginAttempts[playerid] == 1)
                    {
                    format(string, sizeof(string), "{0835C7}Cruel World Cops And Robbers\n \n{146AC7}Player Login\n \n{FFFFFF}This Nick, {146AC7}%s, {FFFFFF}is Rgistered.\nIf This Is Not Your Account, Please Quit And Change Your Name.\n \nPlease {D6D631}Enter Your Password {FFFFFF}To Login:",PlayerInfo[playerid][pName],playerid);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT , "CnR Login", string, "Login", "Cancel");
                   
                    SendClientMessage(playerid, COLOR_ERROR,"* You Have Entered Wrong Password. (1/3) - 2 Attempts Remaining.");
                    }
                    if(LoginAttempts[playerid] == 2)
                    {
                    format(string, sizeof(string), "{0835C7}Cruel World Cops And Robbers\n \n{146AC7}Player Login\n \n{FFFFFF}This Nick, {146AC7}%s, {FFFFFF}is Rgistered.\nIf This Is Not Your Account, Please Quit And Change Your Name.\n \nPlease {D6D631}Enter Your Password {FFFFFF}To Login:",PlayerInfo[playerid][pName],playerid);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT , "CnR Login", string, "Login", "Cancel");
                   
                    SendClientMessage(playerid, COLOR_ERROR,"* You Have Entered Wrong Password. (2/3) - 1 Attempts Remaining.");
                    }
                    if(LoginAttempts[playerid] == 3)
                    {
                    SendClientMessage(playerid,COLOR_ERROR,"* You Have Been Kicked - Multiple Fail Login Attempts. (3/3).");

                    format(loginstr, sizeof(loginstr), "***KICK: %s (%i) (Failed Logins) Failed To Login.",PlayerInfo[playerid][pName],playerid);
                    SendClientMessageToOthers(playerid,COLOR_ADMIN,loginstr);
                    LoginAttempts[playerid] = 0;
                    KickEx(playerid);
                    }
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Cannot Login in game! - by danish007 - 18.01.2015, 13:42
Re: Cannot Login in game! - by ReD_HunTeR - 18.01.2015, 13:53
Re: Cannot Login in game! - by danish007 - 18.01.2015, 14:06
Re: Cannot Login in game! - by M4D - 18.01.2015, 14:19
Re: Cannot Login in game! - by danish007 - 18.01.2015, 15:55
Re: Cannot Login in game! - by danish007 - 18.01.2015, 19:34
Re: Cannot Login in game! - by danish007 - 19.01.2015, 02:13
Re: Cannot Login in game! - by Karolukas123 - 19.01.2015, 03:07

Forum Jump:


Users browsing this thread: 1 Guest(s)