SA-MP Forums Archive
Command problem. - 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: Command problem. (/showthread.php?tid=616113)



Command problem. - Frank901 - 31.08.2016

Hello SA-MP Community

Im trying to add a gangzones command, so you can see which zones are available and who are owning the zones at the moment
Код:
COMMAND:gangzones(playerid, params[])
{
	new msg[512], p;
	foreach(new i : GangZones)
	{
		p = GangZone[i][ZoneOwner];
		if(p == -1)
			format(msg, sizeof(msg), "%s{B7B7B7}%s (-)\n", msg, GangZone[i][ZoneName]);
		else
			format(msg, sizeof(msg), "%s{%s}%s (%s)\n", msg, Gang[p][GangColor], GangZone[i][ZoneName], Gang[p][GangName]);
	}
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Territory", msg, "Close", "");
	return 1;
}
I added this to my command.inc
After compiling i'm getting a errors
Код:
pawno\include\cnr/command.inc(1734) : error 017: undefined symbol "Iterator@GangZones"
pawno\include\cnr/command.inc(1734) : error 017: undefined symbol "Iterator@GangZones"
pawno\include\cnr/command.inc(1734) : error 017: undefined symbol "Iterator@GangZones"
pawno\include\cnr/command.inc(1734) : fatal error 107: too many error messages on one line
I did add below #endif this
Код:
new Iterator:GangZones<MAX_ZONES>;
But still getting errors,

LINE 1734 -
Код:
	foreach(new i : GangZones)



Re: Command problem. - oMa37 - 31.08.2016

Try this:
PHP код:
for (new isizeof(GangZones); <= ji++) 



Re: Command problem. - K0P - 31.08.2016

Код:
COMMAND:gangzones(playerid, params[])
{
	new msg[512], p;
	foreach(new i : GangZones<MAX_ZONES>)
	{
		p = GangZone[i][ZoneOwner];
		if(p == -1)
			format(msg, sizeof(msg), "%s{B7B7B7}%s (-)\n", msg, GangZone[i][ZoneName]);
		else
			format(msg, sizeof(msg), "%s{%s}%s (%s)\n", msg, Gang[p][GangColor], GangZone[i][ZoneName], Gang[p][GangName]);
	}
	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Territory", msg, "Close", "");
	return 1;
}



Re: Command problem. - IceBilizard - 31.08.2016

Replace line
PHP код:
foreach(new GangZones
with

PHP код:
foreach(GangZonesi
and try


Re: Command problem. - AndySedeyn - 31.08.2016

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Replace line
PHP код:
foreach(new GangZones
with

PHP код:
foreach(GangZonesi
and try
That would indicate that OP is using a deprecated version of foreach!


Re: Command problem. - Frank901 - 31.08.2016

I tried what you guys suggestion me, but still nothing, gives same error.

Ill rep whos helping me out


Re: Command problem. - GoldenLion - 31.08.2016

What about just doing it like that:
Код:
for(new i = 0; i < MAX_ZONES; i++)
But by the way what I think is that you had to put the define before #endif.


Re: Command problem. - Frank901 - 31.08.2016

Gives me this error

Код:
error 017: undefined symbol "MAX_ZONES"
 error 017: undefined symbol "GangZone"
 warning 215: expression has no effect
 error 001: expected token: ";", but found "]"
 error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line



Re: Command problem. - Marricio - 31.08.2016

You probably forgot to specify the array size. Show us the line where you define Iterator:GangZones.


Re: Command problem. - Frank901 - 31.08.2016

Код:
#define DISALLOWED_ADDRESS "--"
native gpci( playerid , const serial[] , maxlen );

#endif
new Iterator:GangZones<MAX_ZONES>;
Thats it.