MySQL R7 Cache Issue
#1

Hello,

I am scripting a gamemode from scratch using the new MySQL R7 include. My issue is, when I login to the server, it registers my account properly, and I can login properly. However, it does not load my statistics. This is where the issue resides:

pawn Код:
stock LoadAccount(playerid)
{
    format(Query, sizeof(Query), "SELECT * FROM `Accounts` WHERE `AccountID` = %d", PlayerInfo[playerid][AccountID]);
    mysql_function_query(MySQL, Query, true, "AccountLoad", "d", playerid);
    #if defined DEBUG
    printf("[DEBUG] Loading Account For %s",GetPName(playerid));
    #endif
    return 1;
}

forward AccountLoad(playerid);
public AccountLoad(playerid)
{
    #if defined DEBUG
    print("[DEBUG] Account Load 1");
    #endif
    new rows, fields;
    cache_get_data(rows, fields, MySQL);
    if(rows)
    {
        new temp[11];
        cache_get_row(0, 6, temp); PlayerInfo[playerid][pCash] = strval(temp);
        cache_get_row(0, 7, temp); PlayerInfo[playerid][pScore] = strval(temp);
        cache_get_row(0, 8, temp); PlayerInfo[playerid][pRank] = strval(temp);
        cache_get_row(0, 9, temp); PlayerInfo[playerid][pKills] = strval(temp);
        cache_get_row(0, 10, temp); PlayerInfo[playerid][pDeaths] = strval(temp);
        cache_get_row(0, 11, temp); PlayerInfo[playerid][pAdmin] = strval(temp);
        cache_get_row(0, 12, temp); PlayerInfo[playerid][pWarns] = strval(temp);
        cache_get_row(0, 13, temp); PlayerInfo[playerid][pMuted] = strval(temp);
        cache_get_row(0, 14, temp); PlayerInfo[playerid][pJail] = strval(temp);
        print("Works");
    }
    #if defined DEBUG
    printf("[DEBUG] Loading Stats For %s",GetPName(playerid));
    #endif
    return 1;
}
It performs the query, and prints "Works" in the console, so I know it is being called successfully. However, the cache_get_row is not storing the statistics into the player variables. When I do /stats, it returns PlayerInfo[playerid][pCash] as $0, when it should be $10,000.

Thank you for taking a look at this, if you need more information let me know.
Reply


Messages In This Thread
MySQL R7 Cache Issue - by Camacorn - 12.02.2013, 16:22
Re: MySQL R7 Cache Issue - by adsy - 12.02.2013, 18:30
Re: MySQL R7 Cache Issue - by Camacorn - 12.02.2013, 19:11

Forum Jump:


Users browsing this thread: 1 Guest(s)