17.06.2014, 05:29
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 :
Here, I am calling this function.
hope you understood what my problem is.
Please Help
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;
}
pawn Код:
if (ServerMinutes == 3 && ServerSeconds == 54)
{
RandomBomb(playerid);
RandomDefuse(playerid);
}
Please Help