need help in iter_random :(
#1

I am trying to make a function in which the system chooses on player from each team at a time. But it is not working perfectly. It only chooses one player from all player online. Not each player from one team.
I mean it chooses one player from all players whereas it has to chooses one player from each team randomly.

Here is the code :

pawn Код:
public RandomBomb(playerid)
{
    if(gTeam[playerid] == Terrorists)
    {
        new GangLeader[MAX_PLAYERS];
        new randPlayer = Iter_Random(Player);


        GangLeader[Terrorists] = randPlayer;
        SetPlayerAttachedObject(GangLeader[Terrorists], 0, 1252, 1, 0.039000, -0.192999, 0.000000, 0.000000, 87.299972, 1.000000, 1.000000, 1.000000, 1.000000, 0, 0);
        SendClientMessage(GangLeader[Terrorists], -1, " You have been chosen to Plant the bomb.");
        tChosen[playerid] = 1;
    }
    return 1;
}
   
public RandomDefuse(playerid)
{
    if(gTeam[playerid] == Counter_T)
    {
        new CGangLeader[MAX_PLAYERS];
        new CrandPlayer = Iter_Random(Player);


        CGangLeader[Counter_T] = CrandPlayer;
        SetPlayerAttachedObject(CGangLeader[Counter_T], 0, 1719, 1, 0.000000, -0.140999, -0.004999, 88.899978, 0.599999, 0.299999, 1.000000, 1.000000, 1.000000, 0, 0);
        SendClientMessage(CGangLeader[Counter_T], -1, " You have been chosen to Defuse the bomb.");
        cChosen[playerid] = 1;
    }
    return 1;
}
Here, I am calling this function.
pawn Код:
if (ServerMinutes == 3 && ServerSeconds == 54)
        {
            RandomBomb(playerid);
            RandomDefuse(playerid);
           
        }
hope you understood what my problem is.

Please Help
Reply


Messages In This Thread
need help in iter_random :( - by Champ - 17.06.2014, 05:29
Re: need help in iter_random :( - by Vince - 17.06.2014, 06:47
Re: need help in iter_random :( - by Champ - 17.06.2014, 06:53
Re: need help in iter_random :( - by Vince - 17.06.2014, 08:19
Re: need help in iter_random :( - by Champ - 17.06.2014, 09:30
Re: need help in iter_random :( - by Champ - 17.06.2014, 09:50
Re: need help in iter_random :( - by Champ - 17.06.2014, 14:47
Re: need help in iter_random :( - by Champ - 17.06.2014, 15:15
Re: need help in iter_random :( - by Konstantinos - 17.06.2014, 15:18
Re: need help in iter_random :( - by Champ - 17.06.2014, 15:37

Forum Jump:


Users browsing this thread: 1 Guest(s)