Login Problems
#2

Didn't use response, and fixed the strcmp line.

Try now.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2)
    {
        if(response)
        {
            new string[128], escpass[100], escname[MAX_PLAYER_NAME];
            //GetPlayerName(playerid, Name, sizeof(Name));
            mysql_real_escape_string(inputtext, escpass);
            mysql_real_escape_string(UserStats[playerid][Name], escname);
            GetPlayerName(playerid, escname, MAX_PLAYER_NAME);
            //format(string,sizeof(string),"INSERT INTO `Users` (`Name`, `Password`) VALUES ('%s', '%s')",escname, escpass);
            //mysql_query(string);

            //if(!mysql_num_rows())
            //  return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Incorrect password!");

            new row[128];
            new field[7][32]; // [4] = Amount of fields, [24] = Max length of the bigest field.

            mysql_fetch_row_format(row, "|");
            explode(row, field, "|");
            mysql_free_result();

            if(!strlen(inputtext))
            {
                // ShowPlayerDialog for register
                return 1;
            }

            if(strcmp(inputtext, UserStats[playerid][Password], false) == 0)
            {
                // The field starts here with 1, because the field 'Name' = 0, and we already have the name in a variable.
                format(UserStats[playerid][Password], 32, "%s", field[1]);
                UserStats[playerid][Admin] = strval(field[2]);
                UserStats[playerid][Money] = strval(field[3]);
                UserStats[playerid][ppos_x] = strval(field[4]);
                UserStats[playerid][ppos_y] = strval(field[5]);
                UserStats[playerid][ppos_z] = strval(field[6]);
                GivePlayerCash(playerid, UserStats[playerid][Money]);
                SetPlayerPos(playerid, UserStats[playerid][ppos_x], UserStats[playerid][ppos_y], UserStats[playerid][ppos_z]);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Login Problems - by Anthonyx3' - 09.01.2011, 03:12
Re: Login Problems - by California - 09.01.2011, 05:04
Re: Login Problems - by Anthonyx3' - 09.01.2011, 05:16
Re: Login Problems - by California - 09.01.2011, 06:24
Re: Login Problems - by Calgon - 09.01.2011, 07:11

Forum Jump:


Users browsing this thread: 1 Guest(s)