Foreach loop check
#1

The problem is that I want it to loop through all players however it only loops through first 20, at times just 10 or just 5 and at times 25.. what could be the problem?
Код:
public AchievementProcess()
{
			foreach(Player,i)
			{
			if(forbes[i] == 0) continue;
			if(pInfo[i][achievement1] == 0)
			{
				if(pInfo[i][Kills] >= 50)
			    {
                                //code
                                SaveStatus(i);
			    }
			 }
		 	if(pInfo[i][achievementno2] == 0)
	 		{
			    if(pInfo[i][Kills] >= 400)
			    {
                                //code
                                SaveStatus(i);
				}
			 }
		 	if(pInfo[i][achievementno3] == 0)
			{
			    if(pInfo[i][Kills] >= 1600)
			    {
                               //code
                                SaveStatus(i);
                            }
                         }

		 	if(pInfo[i][achievementno5] == 0)
		 	{
			    if(pInfo[i][Kills] >= 7000)
			    {
                                //code
                                SaveStatus(i);

				}
			 }
                   }
           }

public SaveStatus(playerid)
{
// INT saving //
return 1;
}
Reply
#2

Your foreach syntax use is old and probably your include is old too!.

download latest one and use the latest syntax for your foreachs.
https://sampforum.blast.hk/showthread.php?tid=570868

PHP код:
foreach (new Player
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)