Problem with money syncing
#1

I am trying to sync money with this:
pawn Код:
Timer:MoneySync[2000]()
{
    new string[255];
    foreach(Player, i)
    {
        if(PlayerInfo[i][pCash] != GetPlayerMoney(i))
        {
            ResetPlayerMoney(i);
            GivePlayerMoney(i, PlayerInfo[i][pCash]);
        }
    }
    return 1;
}
And in the game I adjust the player's money with "PlayerInfo[playerid][pCash] (+=/-= amount)"

Now if I decrease the amount of money it syncs perfectly, when I increase the amount of money the moneybar keeps increasing and decreasing every single second, so it remains between old value and new value.
Reply
#2

Are you using GivePlayerCash Funcions ? Might be that check you gm for the money on server side functions.

Please give more details of the Problem i might be able to help.
Reply
#3

pawn Код:
stock GivePlayerMoneyEx(playerid, amount)
{
PlayerInfo[playerid][pCash] += amount
GivePlayerMoney(playerid, amount);
}
You should use something like this instead of the default GivePlayerMoney.
Reply
#4

I am using this way to add money to a player's account, it has to update the moneybar with the code I posted:

pawn Код:
PlayerInfo[playerid][pCash] -= HouseInfo[i][Price];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)