[Ajuda] Ajuda em registro.
#1

Galera, eu to querendo fazer com que o que o player digite no dialog seja a senha, porйm nгo estou sabendo como fazer.

Quote:

Segui esse tutorial
https://sampforum.blast.hk/showthread.php?tid=273088
To usando y_ini

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registrando...",""COL_RED"Vocк escreveu uma senha invбlida\n"COL_WHITE"Escreva sua senha para criar uma nova conta.","Registre","Quit");
                new INI:File = INI_Open(playerPASTA(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Senha",inputtext);  //linha do erro
                INI_WriteInt(File,"Dinheiro",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Skin",0);
                INI_Close(File);

                SpawnPlayer(playerid);
               
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(inputtext == info[playerid][Senha]) //linha do erro
                {
                    INI_ParseFile(playerPASTA(playerid), "Carregandoplayer_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, info[playerid][Dinheiro]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Sucesso!",""COL_GREEN"Vocк logou!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Senha incorreta.\n"COL_WHITE"Escreva sua senha para logar.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}

Erros:
PHP код:
C:\Users\Vitor\Desktop\Vitor\samp03z_svr_R1_win32\gamemodes\rpg.pwn(106) : error 035argument type mismatch (argument 3)
C:\Users\Vitor\Desktop\Vitor\samp03z_svr_R1_win32\gamemodes\rpg.pwn(122) : error 033: array must be indexed (variable "inputtext"
Reply
#2

Nunca usei y_ini, mas creio que o erro consiste em vocк estб manipulando strings como se fossem inteiros.
Se a senha consiste em apenas nъmeros, experimente trocar inputtext por strval(inputtext)

Caso nгo seja apenas nъmeros, resolva os erros fazendo:
1є erro:
Tente usar INI_WriteString no lugar de INI_WriteInt

2є erro:
Compare a senha usando strcmp
ex:
pawn Код:
if(strcmp(inputtext, info[playerid][Senha], false) == 0 && strlen(info[playerid][Senha]))
{
//...Logou
Espero ter ajudado.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)