SA-MP Forums Archive
Stats problem [Saving] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stats problem [Saving] (/showthread.php?tid=440801)



Stats problem [Saving] - zT KiNgKoNg - 31.05.2013

For some reason stat saving has randomly stopped working, But it was working a few days ago if anyone has enlighten me on this matter it would be fantastic.

pawn Код:
stock SaveStats(playerid)
{
    new Float: P_X, Float: P_Y, Float: P_Z, MySkin;

    if(OnAdminDuty[playerid] == 1)
    {

        MySkin = pData[playerid][Skin];
    } else {
   
        GetPlayerPos(playerid, P_X,P_Y,P_Z);
        MySkin = GetPlayerSkin(playerid);
    }
   
    format(Query,sizeof(Query),"UPDATE `Accounts` Email = '%s', `IP` = '%s', `P_X` = '%f', `P_Y` = '%f', `P_Z` = '%f', `StaffLevel` = '%d',`HelperLevel` = '%d', `DonatorLevel` = '%d', `Admin-Name` =  '%s', `Gender` = '%d', `Skin` = '%d', `Money` = '%d', `Level` = '%d' WHERE `Username` = '%s'",
    pData[playerid][Email],
    GetIP(playerid),
    P_X,
    P_Y,
    P_Z,
    pData[playerid][StaffLevel],
    pData[playerid][HelperLevel],
    pData[playerid][DonatorLevel],
    pData[playerid][aName],
    pData[playerid][Gender],
    MySkin,
    GetPlayerMoney(playerid),
    GetPlayerScore(playerid),
    GetPName(playerid));
   
    printf("Sarting Player Save (%s)",GetPName(playerid));
   
    mysql_query(Query);
    mysql_free_result();
   
    printf("%s Has left the server and his stats saved correctly",GetPName(playerid));
    return 1;
}



Re: Stats problem [Saving] - RyanPetersons - 31.05.2013

Have you changed this stock abit?


Re: Stats problem [Saving] - zT KiNgKoNg - 31.05.2013

Nope....


Re: Stats problem [Saving] - Rillo - 31.05.2013

Did you change or add anything just before it stopped working? Not in the stock but in the script. And are sure that you are connected to the MySQL database?


Re: Stats problem [Saving] - dubyabeast - 31.05.2013

Is the variable 'Query' a global variable?

EDIT: NEVERMind:

The problem is in your query.

pawn Код:
// You forgot a 'SET'

format(Query,sizeof(Query),"UPDATE `Accounts` SET Email = '%s', `IP` = '%s', `P_X` = '%f', `P_Y` = '%f', `P_Z` = '%f', `StaffLevel` = '%d',`HelperLevel` = '%d', `DonatorLevel` = '%d', `Admin-Name` =  '%s', `Gender` = '%d', `Skin` = '%d', `Money` = '%d', `Level` = '%d' WHERE `Username` = '%s'",



Re: Stats problem [Saving] - zT KiNgKoNg - 31.05.2013

Thank you, I was wondering what i had done.


Note: Working, CLOSED.