mysql not loading
#1

Can someone explain me why this mysql isn't loading player's stats after login?

pawn Код:
public OnAccountCheck(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, mysqlc);
    if(rows)
    {
        cache_get_field_content(0, "password", PlayerInfo[playerid][Password], mysqlc, 129);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login in your account", ""W"In order to play, you need to "R"login", "Login", "Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Create a new account", ""W"In order to play, you need to "R"register.", "Register", "Quit");
    }
    return 1;
}
This is the public that executes after login:

pawn Код:
public OnAccountLoad(playerid)
{
    PlayerInfo[playerid][Admin] = cache_get_row_int(0, 5);
    PlayerInfo[playerid][Deaths] = cache_get_row_int(0, 6);
    PlayerInfo[playerid][Nopm] = cache_get_row_int(0, 7);
    PlayerInfo[playerid][Muted] = cache_get_row_int(0, 8);
    PlayerInfo[playerid][Vip] = cache_get_row_int(0, 9);
    PlayerInfo[playerid][Warn] = cache_get_row_int(0, 10);
    PlayerInfo[playerid][RegisterDate] = cache_get_row_int(0, 11);
    PlayerInfo[playerid][Jailed] = cache_get_row_int(0, 12);
    PlayerInfo[playerid][AdminActions] = cache_get_row_int(0, 13);
    PlayerInfo[playerid][Cookies] = cache_get_row_int(0, 14);
    PlayerInfo[playerid][Rank] = cache_get_row_int(0, 15);
    PlayerInfo[playerid][VipTime] = cache_get_row_int(0, 16);
    PlayerInfo[playerid][Class] = cache_get_row_int(0, 17);
    PlayerInfo[playerid][PrototypesStolen] = cache_get_row_int(0, 18);
    PlayerInfo[playerid][KillAsUsaTeam] = cache_get_row_int(0, 19);
    PlayerInfo[playerid][KillAsGermanyTeam] = cache_get_row_int(0, 20);
    PlayerInfo[playerid][KillAsItalyTeam] = cache_get_row_int(0, 21);
    PlayerInfo[playerid][KillAsJapanTeam] = cache_get_row_int(0, 22);
    PlayerInfo[playerid][KillAsMercTeam] = cache_get_row_int(0, 23);
    PlayerInfo[playerid][KillAsMexicoTeam] = cache_get_row_int(0, 24);
    PlayerInfo[playerid][Exp] = cache_get_row_int(0, 26);
    PlayerInfo[playerid][Duty] = cache_get_row_int(0, 27);
    PlayerInfo[playerid][DaysAlive] = cache_get_row_int(0, 28);
   
    SetPlayerScore(playerid, PlayerInfo[playerid][Scores]);
    GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
    JustLogged[playerid] = 1;
    Logged[playerid] = 1;
    UpdateStatsTextdraw(playerid);
    SendClientMessage(playerid,red,"------------------------------------------------------");
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    new string[128];
    format(string,sizeof(string),"* System: Welcome back {F70505}%s (%d) {FFFFFF} - Your stats have been restored.",playername3,playerid);
    SCM(playerid,-1,string);
    SendClientMessage(playerid,red,"------------------------------------------------------");
    CheckVipTime(playerid);
    return 1;
}
Dialog login:

pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(!response)
        {
        SendClientMessage(playerid, COLOR_RED, "** To play you must be registered or logged in.");
        KickTimer[playerid] = SetTimerEx("KickPlayer",200,false,"d",playerid);
        }
        if(response)
        {
            new hpass[129];
            WP_Hash(hpass, 129, inputtext);
            new name[24];
            GetPlayerName(playerid, name, sizeof(name));
            printf("Hpass: %s Password: %s", hpass, PlayerInfo[playerid][Password]);
            if(!strcmp(hpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(mysqlc, query, sizeof(query), "SELECT * FROM `playerdata` WHERE `user` = '%e' LIMIT 1", name);
                mysql_tquery(mysqlc, query, "OnAccountLoad", "i", playerid);
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login in your account", ""W"In order to play, you need to "R"login\n"R"Wrong password!", "Login", "Quit");
            }
        }
    }
Screen of the database:

http://oi41.tinypic.com/23w193s.jpg

As you can see, im loading from the the "Admin" field, which is at number 5. Then other stats.

Whats wrong?

Log:

Quote:

[13:56:48] [DEBUG] Calling callback "OnAccountLoad"..
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 5, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '5', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 6, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '6', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 7, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '7', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 8, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '8', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 9, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '9', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 10, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '10', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 11, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '11', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 12, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '12', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 13, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '13', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 14, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '14', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 15, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '15', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 16, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '16', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 17, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '17', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 18, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '18', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 19, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '19', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 20, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '20', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 21, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '21', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 22, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '22', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 23, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '23', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 24, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '24', data: "192.168.1.3"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 26, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '26', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 27, connection: 1
[13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '27', data: "0"
[13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 28, connection: 1
Reply


Messages In This Thread
mysql not loading - by Face9000 - 27.01.2014, 11:46
Re: mysql not loading - by Konstantinos - 27.01.2014, 11:52
Re: mysql not loading - by CoaPsyFactor - 27.01.2014, 11:54
Re: mysql not loading - by Misiur - 27.01.2014, 11:57
Re: mysql not loading - by Face9000 - 27.01.2014, 11:58
Re: mysql not loading - by Misiur - 27.01.2014, 12:03
Re: mysql not loading - by Face9000 - 27.01.2014, 12:07
Re: mysql not loading - by CoaPsyFactor - 27.01.2014, 12:28
Re: mysql not loading - by Misiur - 27.01.2014, 13:11

Forum Jump:


Users browsing this thread: 1 Guest(s)