SA-MP Forums Archive
for(); doesn't work - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: for(); doesn't work (/showthread.php?tid=107374)



for(); doesn't work - yoni0505 - 09.11.2009

I made a function in my mode.
In the function I got for(); command that for some reason cause function to don't work. there is no problem to compile the script, but the function does nothing.
When I remove the for(); line from the function it works fine(but I need the for(); ).

Why does it happen?

the code is:

Код:
#define MAX_BASES 3
new base_name[MAX_BASES][256];
new playerteam[MAX_PLAYERS]; //defined meanwhile the game

public OnGameModeInit()
{
    //example for base_name definition (name in hebrew, the modes language,seems that the forum doesn't support it)
    base_name[base_civ_HQ] = "оид шащй ажшзйн";
}
SpawnList(playerid)
{
	new str[1024];
	for(new n = 0; n <= MAX_BASES; n++)
	{
	  if(base_team[n] == playerteam[playerid])
 		{
			format(str,sizeof(str),"%s%s\n",str,base_name[n]);
		}
	}
	ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Spawn points",str,"OK","Cancel");
}
Please help me