SA-MP Forums Archive
MySQL - 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: MySQL (/showthread.php?tid=434971)



MySQL - BigGroter - 04.05.2013

pawn Код:
stock SaveAccountVariables(playerid)
{
    new Float:a, intid, vw, Float:x, Float:y, Float:z, szQuery[1024];
    GetPlayerPos(playerid, x,y,z);
    vw = GetPlayerVirtualWorld(playerid);
    intid = GetPlayerInterior(playerid);
    GetPlayerFacingAngle(playerid, a);
    format(szQuery, sizeof(szQuery), "UPDATE `Stats` SET `AdminLevel` = %d, `seeds` = %d, `weed` = %d, `pSkin` = %d, `pTier` = %d, `pFaction` = %d, `pLastx` = %f, `pLasty` = %f, `pLastz` = %f, `pRank` = '%s', `pIP` = '%s', `pInterior` = %d, `pVirtualWorld` = %d, `Money` = %d, `pLasta` = %f AND `BanReason` = '%s' WHERE `pDatabaseID` = %d",
    pInfo[playerid][AdminLevel], pInfo[playerid][seeds], pInfo[playerid][weed], GetPlayerSkin(playerid), pInfo[playerid][pTier], pInfo[playerid][pFaction],x,y,z, pInfo[playerid][pRank], pInfo[playerid][pIP], intid, vw, GetPlayerMoney(playerid), a, pInfo[playerid][BanReason], pInfo[playerid][pDatabaseID]);
    mysql_function_query(1, szQuery, false, "", "");
}
There's my saving function, however when a player disconnects and this is called, it's just printing 0 on every float/integer and nothing on the strings, why is this?


Re: MySQL - Vince - 04.05.2013

I hope you're not resetting their stuff before calling this?


Re: MySQL - BigGroter - 04.05.2013

Nah. I have it under onplayerdisconnect and I made a command to test it.
pawn Код:
CMD:savestats(playerid, params[])
{
    SaveAccountVariables(playerid);
    return 1;
}



Re: MySQL - BigGroter - 04.05.2013

sry double


Re: MySQL - BigGroter - 05.05.2013

Update: If you join then reconnect and add new stats, eg admin level, skin, it will save. It's really odd and I have no clue on how to fix this.
You can also log in with whatever password you want. If someone wants to see it in action PM me for the IP.


Re: MySQL - BigGroter - 05.05.2013

Bump, still got these issues.


Re: MySQL - BigGroter - 06.05.2013

Bumping again, I really need this issue dealt with.


Re: MySQL - BigGroter - 07.05.2013

Sorry for bumping, has NO ONE got a clue on how to fix this? There's got to be some MySQL pros around here.