Sscanf/Mysql problem
#1

Hey guys, got another mysql issue.
So, I got this:
pawn Код:
enum pstats
{
    ID,
    pUsername[24],
        pPassword[129],
        pIPAddress[56],
    pAdminLevel,
    pMoney,
    pScore,
    pSkin,
    pPMStatus,
    pKills,
    pDeaths,
    pLogins,
    pWarns,
    pWarning1,
    pWarning2,
    pWarning3,
    hours,
    mins,
    secs,
    spawnwep
}

new pinfo2[MAX_PLAYERS][pstats];

public OnPlayerSpawn(playerid)
{
    LoadAccountVariables(playerid);
    GivePlayerMoney(playerid, pinfo2[playerid][pMoney]);
    SetPlayerScore(playerid, pinfo2[playerid][pScore]);
    SetPlayerSkin(playerid, pinfo2[playerid][pSkin]);
    return 1;
}

stock LoadAccountVariables(playerid)
{
    new EscapedName[MAX_PLAYER_NAME];
    mysql_real_escape_string(GetPName(playerid), EscapedName);
    format(Query, sizeof(Query), "SELECT * FROM `Accounts` WHERE `Username` = '%s'", GetPName(playerid));
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<ds[20]s[333]s[20]ddddddddds[128]s[128]s[128]dddd|>>", pinfo2[playerid]);
    mysql_free_result();
    return 1;
}

stock SaveStats(playerid)
{
    format(Query,sizeof(Query),"UPDATE `Accounts` SET `Money` = '%d', `Score` = '%d', `Skin` ='%d', `AdminLevel` = '%d' WHERE `Username` = '%s'",GetPlayerMoney(playerid),GetPlayerScore(playerid),GetPlayerSkin(playerid),pinfo2[playerid][pAdminLevel],GetPName(playerid));
    mysql_query(Query);
    return 1;
}
But for some reason, it prints the stats correctly, but ingame it doesn't actually load them, and I can't figure out the reason...
Thank you in advance for your help!
Reply
#2

pawn Код:
"e<p<|>ds[20]s[333]s[20]ddddddddds[128]s[128]s[128]dddd>"
Reply
#3

(Im scripting with him but since he's offline im with the script)
Well in the mysql log it writes this:
Quote:

[20:36:23] CMySQLHandler::Query(UPDATE `Accounts` SET `Money` = '32', `Score` = '0', `Skin` ='0', `AdminLevel` = '0' WHERE `Username` = 'Tho1killa') - Successfully executed.

So it writes, but then loading it wont
Reply
#4

Well now i changed it to this:
pawn Код:
sscanf(Query, "e<<|>ds[20]s[333]s[20]ddddddddds[128]s[128]s[128]dddd>", pinfo2[playerid]);
And still wont work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)