Help Here cash got bugged or something
#1

Код:
if(GameHour == 23 && GameMinute == 59)
	{
    	for(new i = 0; i < GetMaxPlayers(); i++)
		{
			for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
			{
				if(IsPlayerConnected(playerid) && spawned[playerid] == 1)
				{
					pInfo[playerid][pDaysAlive] ++;
					if(pInfo[playerid][pDaysAlive] == 365)
					{
						pInfo[playerid][pBirthdays] ++;
						new pmoney, randcash;
						pmoney = GetPlayerMoney(i);
						randcash = random(pmoney);
						GiveCashToPlayer(playerid,-randcash);
						GivePlayerMoney(playerid, randcash);
						SCM(playerid,COLOR_RED,"Happy Birth Day (TESTING)");
					}
				}
			}
		}
	}
now when there it the birthday of someone and no one is online it will keep giving him the unlimited money
but i want to give him the money an random amount we get from all others from their total money
Код:
forward GiveCashToPlayer(playerid,const money);
public GiveCashToPlayer(playerid,const money)
{
   for(new i = 0; i < MAX_PLAYERS; i ++)
   {
      if(!IsPlayerConnected(i)) continue;
      if(playerid == i) continue;

      GivePlayerMoney(i,money);
   }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)