Posts: 26
Threads: 11
Joined: Feb 2018
Reputation:
0
Hello, recently i was trying to create an event system everything else works except one thing, i can't set a random team for each player.
For example when player 1 joins the event, he gets into team A, player 2 Team B, player 3 Team A, player 4 Team B like this.
Can someone give me a code example how to do that?
Posts: 357
Threads: 6
Joined: Feb 2018
Код:
new PlayersTeam1=0;
new PlayersTeam2=0;
if(PlayersTeam1 <= PlayersTeam2)
{
SetPlayerTeamA(playerid);
}
else if(PlayersTeam2 <= PlayersTeam1)
{
SetPlayerTeamB(playerid);
}
SetPlayerTeamA(playerid)
{
// codes for Team A
PlayersTeam1++;
}
SetPlayerTeamB(playerid)
{
// codes for Team B
PlayersTeam2++;
}
Posts: 357
Threads: 6
Joined: Feb 2018
Quote:
Originally Posted by DaniceMcHarley
pawn Код:
#define MAX_TEAMS 4 new rteam = random(MAX_TEAMS); switch(rteam) { case 0: // Team 1 case 1: // Team 2 case 2: // Team 3 case 3: // Team 4 }
|
Well bro,
He meant, 2 random teams for a event system.
Quote:
when player 1 joins the event, he gets into team A, player 2 Team B, player 3 Team A, player 4 Team B like this.
|
and the code which you provided will not work for perfect balance for teams.