Problem with money syncing - 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)
+--- Thread: Problem with money syncing (
/showthread.php?tid=452056)
Problem with money syncing -
Mado - 19.07.2013
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.
Re: Problem with money syncing -
SinCityRoleplay - 19.07.2013
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.
Re: Problem with money syncing -
RedFusion - 19.07.2013
pawn Код:
stock GivePlayerMoneyEx(playerid, amount)
{
PlayerInfo[playerid][pCash] += amount
GivePlayerMoney(playerid, amount);
}
You should use something like this instead of the default GivePlayerMoney.
Re: Problem with money syncing -
Mado - 20.07.2013
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];