28.05.2012, 18:22
Okay, basically, I have a money variable in my MySQL which is:
Is there a way to add or take away to the variable inside the MySQL and THEN get the player money from the variable, rather than updating the money then saving it?
This is my Save code for exiting the server.
When the player spawns it gives them the money with this:
What I am asking is if I could do every time a transaction is made in the server:
But it doesn't work for some odd reason.
pawn Код:
PVar[playerid][money]
This is my Save code for exiting the server.
pawn Код:
stock SavePVar(playerid)
{
if(IsPlayerConnected(playerid))
{
new
Query[600];
format(Query, sizeof(Query), "UPDATE `username` SET `username` = %s, `ppassword` = %s, `alevel` = %d, `kills` = %d, `deaths` = %d, `money` = %d, `level` = %d, `factionID` = %d, `factionRank` = %d, `clothes` = %d", // Also remember to update this...
PVar[playerid][username],
PVar[playerid][ppassword],
PVar[playerid][alevel],
PVar[playerid][kills],
PVar[playerid][deaths],
PVar[playerid][money],
PVar[playerid][level],
PVar[playerid][factionID],
PVar[playerid][factionRank],
GetPlayerSkin(playerid),
pName(playerid));
mysql_query(Query);
mysql_free_result();
return 1;
}
else return 0;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
GivePlayerMoney(playerid, PVar[playerid][money]);
return 1;
}
pawn Код:
PVar[playerid][money] + 100;
GivePlayerMoney(playerid, PVar[playerid][money]);