[Ajuda] y_ini
#1

Fiz um sistema com yini e whirpool, o problema й que ele registra normal, mas quando vou logar eu digito qualquer senha e loga como se a senha estivesse certa. Acho que ja olhei todos topicos do forum, todos tut e pedido de ajuda sobre isso...

ai tudo que consegui fazer

pawn Код:
enum PLAYER_FILES
{
    senha[129]
}
new PlayerInfo[MAX_PLAYERS][PLAYER_FILES];

forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    INI_String("senha", PlayerInfo[playerid][senha],129);

    return 1;
}

stock PlayerFiles(playerid)
{
    new file[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(file,sizeof(file),DADOS,playername);
    return file;
}

public OnPlayerConnect(playerid)
{
    if(fexist(PlayerFiles(playerid)))
    {
        INI_ParseFile(PlayerFiles(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","senha logar","Entrar","Sair");
    }
    else
    {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"registro","senha registro","Register","Sair");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    PlayerInfo[playerid][senha] = -1;
    new INI:file = INI_Open(PlayerFiles(playerid));
    INI_SetTag(file,"files");
    INI_Close(file);
    return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"registrar","senha invalida , senha..","Register","Sair");

                new hash[129];
                WP_Hash(hash,sizeof(hash),inputtext);
                new INI:file = INI_Open(PlayerFiles(playerid));
                INI_SetTag(file,"files");
                INI_WriteString(file,"Password", hash);
                INI_Close(file);
                SendClientMessage(playerid,-1,"registrou");
            }
        }
        case DIALOG_LOGIN:
        {
            if(!response) Kick(playerid);
            if(response)
            {
                new hash[129];
                WP_Hash(hash,sizeof(hash),inputtext);
               
                //if (!strcmp(hash,PlayerInfo[playerid][senha]))
                printf("DEBUG: hash = \"%s\" and PlayerInfo[playerid][senha] = \"%s\"", hash, PlayerInfo[playerid][senha]);
                if(!strcmp(hash, PlayerInfo[playerid][senha], false))
                {
                    INI_ParseFile(PlayerFiles(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
                    SendClientMessage(playerid,-1,"logou");
                   
                   
                }
                else
                {
                    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","errou senha ... logar:","Entrar","Sair");
                    return 1;
                }
            }
        }
    }

    return 1;
}
Se alguem conseguir me ajudar +rep, obrigado.
Reply
#2

pawn Код:
case DIALOG_LOGIN:
{
    if(!response) Kick(playerid);
    if(response)
    {
        new hash[129];
        WP_Hash(hash,sizeof(hash),inputtext);
               
        printf("DEBUG: hash = \"%s\" and PlayerInfo[playerid][senha] = \"%s\"", hash, PlayerInfo[playerid][senha]);
        if(strcmp(hash, PlayerInfo[playerid][senha], true) == 0)
        {
            INI_ParseFile(PlayerFiles(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
            SendClientMessage(playerid,-1,"logou");
        }
        else ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","errou senha ... logar:","Entrar","Sair");
    }
}
Reply
#3

Agora, mesmo colocando a senha certa aparece que esta errado...
Reply
#4

me mostra o output disto:

pawn Код:
printf("DEBUG: hash = \"%s\" and PlayerInfo[playerid][senha] = \"%s\"", hash, PlayerInfo[playerid][senha]);
Reply
#5

EU consegui arrumar, agora comeзou pegar direito, mas msm assim obrigado pela ajuda =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)