Loop applies on ID 0 only..?
#1

My Payday works only on ID 0 for some reason,
PAYDAY CODE:
Код:
public Payday()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
	    new Hour, Minute, Second;
	    gettime(Hour, Minute, Second);
		if(Minute >= 59 && Second >= 59)
		{
      		if(PlayerStat[i][SecondsLoggedIn] < 100) return SendClientMessage(i, GREY, "You must be online for more then 100 seconds to get the paycheck.");
			SendClientMessage(i, WHITE, "----------------------------------------------------");
			SendClientMessage(i, WHITE, "                     Prison PayCheck                ");
			SendClientMessage(i, RED, "Prison Payday has arrived! Please use /paycheck to get your paycheck money.");
			SendClientMessage(i, WHITE, "----------------------------------------------------");
			PlayerStat[i][GotPaycheck] = 1;
	  		PlayerStat[i][PlayingHours]++;
		}
 	}
 	return 1;
}
Reply
#2

Don't use return in a loop unless you explicitely want to break out of the loop. If you need to skip a block of code then use continue instead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)