Am i missing something here?
#1

Ive created a payday function run off a 10 minute timer that gives all players 3000 every so often. When testing it for some reason the money given to the player gets doubled. Etc from 4411 to 8822 then from $7411 to $14822.

Can anyone see as to why this happens?

Код:
forward Payday(playerid);
public Payday(playerid)
{
	for(new i=0; i <= MAX_PLAYERS; i++)
	{
		if ( IsPlayerConnected(i) )
		{
  			new cash1 = GetPlayerMoney(i);
   			new string[48];
			SendClientMessage(i,0xFF9900AA,"-----------------------");
			SendClientMessage(i,0xFF9900AA,"--------PAYDAY---------");
			SendClientMessage(i,0xFF9900AA,"-----------------------");
			SendClientMessage(i,0xFF9900AA,"You have earned $3000");
			SendClientMessage(i,0xFF9900AA,"PREVIOUS BALANCE");
   			format(string, sizeof(string), "$%i",cash1);
   			SendClientMessage(playerid, 0xFFFFFFAA, string);
			new cash2 = GetPlayerMoney(i);
			GivePlayerMoney(i,3000);
			new cash3;
			cash3 = cash2 + cash1;
			new string2[48];
			SendClientMessage(i,0xFF9900AA,"NEW-BALANCE");
   			format(string2, sizeof(string2), "$%i",cash3);
   			SendClientMessage(playerid, 0xFFFFFFAA, string2);
			
		}
	}
    return 1;
}
Reply
#2

nevermind, fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)