Command problem.
#1

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)
Reply
#2

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

Код:
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;
}
Reply
#4

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

PHP код:
foreach(GangZonesi
and try
Reply
#5

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!
Reply
#6

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

Ill rep whos helping me out
Reply
#7

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.
Reply
#8

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
Reply
#9

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)