SA-MP Forums Archive
Loop applies on ID 0 only..? - 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: Loop applies on ID 0 only..? (/showthread.php?tid=433701)



Loop applies on ID 0 only..? - Ceez - 28.04.2013

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;
}



Re: Loop applies on ID 0 only..? - Vince - 28.04.2013

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.