[HELP] How to make iterators
#3

Iter_Add and Iter_Remove I assume?

PHP код:
new Iterator:gZero<100>, Iterator:gOne<100>;
public 
OnPlayerSpawn(playerid)
{
    if(
GetPlayerTeam(playerid) == 0)
    {
        if(!
Iter_Contains(gZeroplayerid))
            
Iter_Add(gZeroplayerid);
    }
    else if(
GetPlayerTeam(playerid) == 1)
    {
        if(!
Iter_Contains(gOneplayerid))
            
Iter_Add(gOneplayerid);
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
GetPlayerTeam(playerid) == 0)
    {
        if(
Iter_Contains(gZeroplayerid))
            
Iter_Remove(gZeroplayerid);
    }
    else if(
GetPlayerTeam(playerid) == 1)
    {
        if(
Iter_Contains(gOneplayerid))
            
Iter_Remove(gOneplayerid);
    }
    return 
1;
}
// ZCMD
CMD:teams(playeridparams[])
{
    foreach(new 
gZero)
    {
        
// Loops through iterator gZero (Team #0)
    
}
    foreach(new 
gOne)
    {
        
// Loops through iterator gOne (Team #1)
    
}
    return 
1;

Reply


Messages In This Thread
[HELP] How to make iterators - by Eoussama - 10.12.2016, 13:32
Re: [HELP] How to make iterators - by SyS - 10.12.2016, 13:35
Re: [HELP] How to make iterators - by JaKe Elite - 10.12.2016, 13:36
Re: [HELP] How to make iterators - by Eoussama - 10.12.2016, 13:38
Re: [HELP] How to make iterators - by JaKe Elite - 10.12.2016, 13:39
Re: [HELP] How to make iterators - by Eoussama - 10.12.2016, 13:42

Forum Jump:


Users browsing this thread: 2 Guest(s)