SA-MP Forums Archive
foreach question - 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: foreach question (/showthread.php?tid=186776)



foreach question - Kitten - 30.10.2010

Solved


Re: foreach question - Kitten - 30.10.2010

so any help?


Re: foreach question - Retardedwolf - 30.10.2010

ItterRandom?


Re: foreach question - Brian_Furious - 30.10.2010

Quote:
Originally Posted by Kitten
Посмотреть сообщение
is it possible to make this with foreach include

i set a timer

pawn Код:
SetTimer("NewSkin",60000,true);
ok but in NewSkin function

pawn Код:
public NewSkin(playerid)
{
     // how would i make it so like it only gets 1 players out of TEAM_SPETNAZ to TEAM_NAVYSEALS
     return 1;
}
so is it possible to do it with foreach
What do you mean with // how would i make it so like it only gets 1 players out of TEAM_SPETNAZ to TEAM_NAVYSEALS


Re: foreach question - Kitten - 30.10.2010

i tryed making it but my mind cant figure it out

pawn Код:
public NewSkin(playerid)
{
    new randomplayer = Iter_Random(Player);
    // What do u mean iter random? how could i make it;P
    return 1;
}
and i mean that so like for a example after the timer runs out it will make 1 player from the other team to others team


Re: foreach question - The_Moddler - 30.10.2010

pawn Код:
public NewSkin(playerid)
{
    new rand;
    do
    {
        rand = random(MAX_PLAYERS);
    }
    while(!IsPlayerConnected(rand));
    if(gTeam[rand] != TEAM_NAVYSEALS)
    {
        gTeam[rand] = TEAM_NAVYSEALS;
    }
    else
    {
        gTeam[rand] = TEAM_SPETNAZ;
    }
    return 1;
    /* Remember to change gTeam[]
    to your actual team variable */

}
It should work..