Cannot Login in game!
#1

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(udb_hash(inputtext) == 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;
}
Hello, i've a problem with my server i can't login even i enter a correct password. please help me!
Reply
#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
#3

No didnt work.
Reply
#4

show your OnPlayerConnect

You HAVE TO load player password into "PlayerInfo[playerid][pPassword]" variable when player connects to server
Reply
#5

i've Timer

pawn Код:
public SecondEvents()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
       if(IsPlayerConnected(i) && !IsPlayerNPC(i))
       {
          if(PlayerInfo[i][pClassSelection] > 0) PlayerInfo[i][pClassSelection] --;
          {
             if(PlayerInfo[i][pClassSelection] == 1)
             {
                SetPlayerPosEx(i,1523.984619, -43.216495, 1002.130981, 179.918426,2,2);
                SetPlayerCameraPos(i,1523.980102, -47.354228, 1003.130981);
                SetPlayerCameraLookAt(i,1523.984619, -43.216495, 1002.130981);
               
                if(fexist(UserPath(i)) && !PlayerInfo[i][pLogged])
                {
                INI_ParseFile(UserPath(i), "LoadUser_%s", .bExtra = true, .extra = i);
                new LoginString[256];
                format(LoginString, sizeof(LoginString), "{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[i][pName],i);
                ShowPlayerDialog(i, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD , "CnR Login", LoginString, "Login", "Cancel");
                }
             }
          }
       }
    }
    return 1;
}
Reply
#6

please help!
Reply
#7

BUMP
Reply
#8

show OnPlayerConnect
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)