Error login (y_ini, whirpool)
#1

When a player register, for example:

Код:
User: John_Prodan
Pass: 12345
After disconnecting and going back, when he tries enter to the server type a passsword:

Example:
Код:
User: John_Prodan
Pass: 98798797 (random password)
Or if not put any password, the player login as if the password is correct ! wtf ?


Login Code:

pawn Код:
if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if(!strcmp(hashpass, Info[playerid][pPass], false))
            {
                INI_ParseFile(Path(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                SetPlayerScore(playerid, Info[playerid][pLevel]);
                GivePlayerMoney(playerid, Info[playerid][pDinero]);
                SetPlayerSkin(playerid, Info[playerid][pSkin]);
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
                SendClientMessage(playerid, -1, "Has entrado a Napsix Roleplay.");
            }
            else
            {
                ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_PASSWORD, "Login", "Bienvenido a Napsix Roleplay.\nIngresa tu contraseсa.\nContraseсa Incorrecta!", "Aceptar", "Salir");
                return 1;
            }
        }
    }
Register Code:
pawn Код:
if(dialogid == dregistro)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid, dregistro, DIALOG_STYLE_PASSWORD, "Nueva Cuenta", "Bienvenido a Napsix Roleplay.\nPara crear una cuenta, ingresa una contraseсa.", "Aceptar", "Salir");
                return 1;
            }
            SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
            SetPlayerPos(playerid, 2770.641113, -1871.648925, 22.665542);
            InterpolateCameraPos(playerid, 2770.641113, -1871.648925, 22.665542, 2761.425292, -1992.413574, 18.984594, 12000);
            InterpolateCameraLookAt(playerid, 2770.638427, -1876.626953, 22.197479, 2764.325683, -1996.359497, 17.975938, 6000);

            new hashpass[129];
            WP_Hash(hashpass, sizeof(hashpass), inputtext);

            new INI:File = INI_Open(Path(playerid));
            INI_SetTag(File, "Player Data");
            INI_WriteString(File, "Contraseсa", hashpass);
            INI_WriteInt(File, "Admin", 0);
            INI_WriteInt(File, "Dinero", 0);
            INI_WriteInt(File, "Nivel", 0);
            INI_WriteInt(File, "Skin", 299);
            INI_Close(File);

            SendClientMessage(playerid, -1, "Te has registrado en Napsix Roleplay.");
            return 1;
        }
    }

LoadUser_data Code
pawn Код:
forward LoadUser_data(playerid, name[], value[]);
public LoadUser_data(playerid, name[], value[])
{
    INI_String("Contraseсa", Info[playerid][pPass], 129);
    INI_Int("Admin", Info[playerid][pAdmin]);
    INI_Int("Dinero", Info[playerid][pDinero]);
    INI_Int("Nivel", Info[playerid][pLevel]);
    INI_Int("Skin", Info[playerid][pSkin]);
    INI_Float("Vida", Info[playerid][pVida]);
    INI_Float("Chaleco", Info[playerid][pChaleco]);
    INI_Float("PosX", Info[playerid][pPosX]);
    INI_Float("PosY", Info[playerid][pPosX]);
    INI_Float("PosZ", Info[playerid][pPosZ]);
    INI_Float("PosR", Info[playerid][pPosR]);
    INI_Int("VirtualWorld", Info[playerid][pVW]);
    INI_Int("Interior", Info[playerid][pInt]);

    return 1;
}

I followed this tutorial: Login/Register system [YINI+Whirlpool] step by step

The other problem is that when I enter the correct password (12345) and then I disconnect, login again and put a random password, it tells me the password is incorrect .. till there all right .. but then when I try to put the correct password (12345) tells me it's wrong!


P.S.: Sorry bad english, im use translator
Reply
#2

Try this
pawn Код:
if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            INI_ParseFile(Path(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if(!strcmp(hashpass, Info[playerid][pPass], false))
            {
                SetPlayerScore(playerid, Info[playerid][pLevel]);
                GivePlayerMoney(playerid, Info[playerid][pDinero]);
                SetPlayerSkin(playerid, Info[playerid][pSkin]);
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
                SendClientMessage(playerid, -1, "Has entrado a Napsix Roleplay.");
            }
            else
            {
                ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_PASSWORD, "Login", "Bienvenido a Napsix Roleplay.\nIngresa tu contraseсa.\nContraseсa Incorrecta!", "Aceptar", "Salir");
                return 1;
            }
        }
    }
Reply
#3

Quote:
Originally Posted by aoEXE
Посмотреть сообщение
Try this
pawn Код:
if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            INI_ParseFile(Path(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if(!strcmp(hashpass, Info[playerid][pPass], false))
            {
                SetPlayerScore(playerid, Info[playerid][pLevel]);
                GivePlayerMoney(playerid, Info[playerid][pDinero]);
                SetPlayerSkin(playerid, Info[playerid][pSkin]);
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
                SendClientMessage(playerid, -1, "Has entrado a Napsix Roleplay.");
            }
            else
            {
                ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_PASSWORD, "Login", "Bienvenido a Napsix Roleplay.\nIngresa tu contraseсa.\nContraseсa Incorrecta!", "Aceptar", "Salir");
                return 1;
            }
        }
    }
Nope, incorrect password dialog when enter a correct password
Reply
#4

The error is in the tag

pawn Код:
if(dialogid == dregistro)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid, dregistro, DIALOG_STYLE_PASSWORD, "Nueva Cuenta", "Bienvenido a Napsix Roleplay.\nPara crear una cuenta, ingresa una contraseсa.", "Aceptar", "Salir");
                return 1;
            }
            SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
            SetPlayerPos(playerid, 2770.641113, -1871.648925, 22.665542);
            InterpolateCameraPos(playerid, 2770.641113, -1871.648925, 22.665542, 2761.425292, -1992.413574, 18.984594, 12000);
            InterpolateCameraLookAt(playerid, 2770.638427, -1876.626953, 22.197479, 2764.325683, -1996.359497, 17.975938, 6000);

            new hashpass[129];
            WP_Hash(hashpass, sizeof(hashpass), inputtext);

            new INI:File = INI_Open(Path(playerid));
            INI_SetTag(File, "data");
            INI_WriteString(File, "Contraseсa", hashpass);
            INI_WriteInt(File, "Admin", 0);
            INI_WriteInt(File, "Dinero", 0);
            INI_WriteInt(File, "Nivel", 0);
            INI_WriteInt(File, "Skin", 299);
            INI_Close(File);

            SendClientMessage(playerid, -1, "Te has registrado en Napsix Roleplay.");
            return 1;
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)