IT error.
#1

Not work.

Код HTML:
new Iterator:Gangs[MAX_PLAYERS]<4>;

Iter_Add(Gangs[playerid], 2);

foreach(new i : Gangs[i]<2>)
{
        // code ......
}
Reply
#2

Anyone?
Reply
#3

Never used foreach before, but could this work?

PHP код:

foreach(new Gangs[i]<2>)
{
        
// code ......

Reply
#4

Код:
new Iterator:Gangs[4]<MAX_PLAYERS>;

Iter_Init(Gangs); // You need to use this for multidimensional array
Iter_Add(Gangs[2], playerid);

foreach(new i : Gangs[2])
{
	print("Player id %d is a member of gang id 2", i);
}
You should use Iter_Init for multidimensional array.
And i guess you're trying to insert playerid into gang iterator, so i've changed the way you declare "Gangs" variable and the loop code.
Reply
#5

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
new Iterator:Gangs[4]<MAX_PLAYERS>;

Iter_Init(Gangs); // You need to use this for multidimensional array
Iter_Add(Gangs[2], playerid);

foreach(new i : Gangs[2])
{
	print("Player id %d is a member of gang id 2", i);
}
You should use Iter_Init for multidimensional array.
And i guess you're trying to insert playerid into gang iterator, so i've changed the way you declare "Gangs" variable and the loop code.
I must use the "Iter_Init(Gangs);" every time you add or remove a playerid of iterations?

Exemple:
Код HTML:
Iter_Init(Gangs), Iter_Add(Gangs[2], playerid); // code ....
Код HTML:
Iter_Init(Gangs), Iter_Remove(Gangs[2], playerid); // code ....
Reply
#6

No, only once in OnGameModeInit/OnFilterScriptInit callback.

If you use YSI 4, you can use a more optimized way:
pawn Код:
new Iterator:Gangs<4, MAX_PLAYERS>;
which is 4 + MAX_PLAYERS and not 4 * MAX_PLAYERS. With that, you don't need to call Iter_Init too.
Reply
#7

No, just once after you declare the "Gangs" variable
Reply
#8

thank you all.
Reply
#9

Quote:
Originally Posted by X337
Посмотреть сообщение
No, just once after you declare the "Gangs" variable
Код HTML:
if(hittype == 1 && (pInfo[playerid][pMember] == pInfo[hitid][pMember] || Iter_Contains(HuntEventPlayers, playerid)))
If they use "Iter_contains" in this "if" pawn has crash...
why?...
Reply
#10

Can you show me how you declare "HuntEventPlayers" ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)