SA-MP Forums Archive
Get player position at OnPlayerDisconnect.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get player position at OnPlayerDisconnect.. (/showthread.php?tid=195541)



Get player position at OnPlayerDisconnect.. - The_Moddler - 03.12.2010

Is it me.. or it doens't get the player positions at on disconnect?

Becouse I have this:

pawn Код:
stock SaveStats(playerid)
{
    if(pInfo[playerid][Logged] != 0)
    {
        new Float: X, Float: Y, Float: Z;
        GetPlayerPos(playerid, X, Y, Z);
        djSetInt(strformat("Accounts/%s.ini", GetPName(playerid)), "Score", GetPlayerScore(playerid));
        djSetInt(strformat("Accounts/%s.ini", GetPName(playerid)), "Cash", GetPlayerMoney(playerid));
        djSetFloat(strformat("Accounts/%s.ini", GetPName(playerid)), "PosX", X);
        djSetFloat(strformat("Accounts/%s.ini", GetPName(playerid)), "PosY", Y);
        djSetFloat(strformat("Accounts/%s.ini", GetPName(playerid)), "PosZ", Z);
    }
    return 1;
}
And X, Y, Z keeps at default coords when you register..

Thanks.


Re: Get player position at OnPlayerDisconnect.. - Celson - 03.12.2010

Not to sure. But maybe OnPlayerDisconnect is called after the character has disappeared. So you can't get coords that are no longer there. Just a theory.


Re: Get player position at OnPlayerDisconnect.. - The_Moddler - 03.12.2010

Ah, no.. I'm stupid.. I had a function before calling SaveStats that was wrong.. anyways, now works fine..

Thanks.