SQL question
#1

Okay, basically, I have a money variable in my MySQL which is:
pawn Код:
PVar[playerid][money]
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.

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;
}
When the player spawns it gives them the money with this:

pawn Код:
public OnPlayerSpawn(playerid)
{
    GivePlayerMoney(playerid, PVar[playerid][money]);
    return 1;
}
What I am asking is if I could do every time a transaction is made in the server:

pawn Код:
PVar[playerid][money] + 100;
GivePlayerMoney(playerid, PVar[playerid][money]);
But it doesn't work for some odd reason.
Reply


Messages In This Thread
SQL question - by vIBIENNYx - 28.05.2012, 18:22
Re: SQL question - by jamiesage123 - 28.05.2012, 18:29
Re: SQL question - by ReneG - 28.05.2012, 18:35
Re: SQL question - by iGetty - 28.05.2012, 18:38
Re: SQL question - by vIBIENNYx - 28.05.2012, 19:44

Forum Jump:


Users browsing this thread: 1 Guest(s)