"/q" not saving data -
eikzdej - 24.01.2017
I use this login/registration system:
https://sampforum.blast.hk/showthread.php?tid=574714
I noticed when i'm using /q, it does not saves character data, ex: Last position
Anybody can help me with this?
Respuesta: "/q" not saving data -
Eloy - 24.01.2017
Check callback OnPlayerDisconnect
Quote:
public OnPlayerDisconnect(playerid, reason)
{
new
query[128],
Floatos[4];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Money` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d",
GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]);
mysql_tquery(mysql, query, "", "");
return true;
}
|
Re: "/q" not saving data -
Loinal - 24.01.2017
Do you have a saving part on OnPlayerDisconnect?
Edit: Eloy replied faster than me
Re: "/q" not saving data -
Vince - 24.01.2017
GetPlayer_ functions do NOT work reliably in OnPlayerDisconnect because the client is already disconnected at that point.
Re: "/q" not saving data -
eikzdej - 24.01.2017
Quote:
Originally Posted by Vince
GetPlayer_ functions do NOT work reliably in OnPlayerDisconnect because the client is already disconnected at that point.
|
Hmmm.. How can I able to do a workaround fix for it?
Re: "/q" not saving data -
saffierr - 24.01.2017
Just try it, because I use the GetPlayer_ functions under OnPlayerDisconnect() and I've never witnessed problems nor bugs til now.
Re: "/q" not saving data -
eikzdej - 24.01.2017
I do have a call function for OnPlayerDisconnect. But as vince said, maybe the force quit doesn't connected to GetPlayer_ functions.
Re: "/q" not saving data -
BroZeus - 24.01.2017
Create separate variable for storing money, score etc. Increment/decrement their value whenever the the change is needed. Now use this variable in OnPlayerDisconnect(). Do not forget to reset them after saving it in OnPlayerDisconnect().
Storing money in variable also helps to detect money hack. As if player uses a money cheat GetPlayerMoney will return then money value at from client side which could be changed with help of a hack but the value stored in variable you made in script won't change as it is server sided.
Re: "/q" not saving data -
eikzdej - 24.01.2017
Quote:
Originally Posted by BroZeus
Create separate variable for storing money, score etc. Increment/decrement their value whenever the the change is needed. Now use this variable in OnPlayerDisconnect(). Do not forget to reset them after saving it in OnPlayerDisconnect().
Storing money in variable also helps to detect money hack. As if player uses a money cheat GetPlayerMoney will return then money value at from client side which could be changed with help of a hack but the value stored in variable you made in script won't change as it is server sided.
|
Can you give me a example of a code for it?
Re: "/q" not saving data -
YouHack - 25.01.2017
Search in SA-MP forums for existing threads before posting
Check
OnPlayerDisconnect
Also, a similar thread :
https://sampforum.blast.hk/showthread.php?tid=512511