Randomizing every players team?
#1

How the hell would I do that? I'm new to pawno, and I am sorry for such a simple question (At least it sounds so)
Reply
#2

can you explain what do you want..i didn't understand it correctly

Although, you can use the Random() function
Reply
#3

Well, I want to get every single player to randomize to eighter the team Murderer, but if there already is one murderer, the rest will go to the team SWAT.
Reply
#4

I'll try and explain it a bit better.

So, what I want to do, is simply have all the players check if someone is on the team "Murderer", if not, it'll pick one of the players, and the rest will go onto the SWAT team. This will happen every time I call StartRound(playerid)
Reply
#5

So you only want one person on the murder team?
Reply
#6

you can foreach player get if they are murderer or swat and place new player on the team with less or just a simple switch if a var ...lets say the var is "team"== 1 set player murderer and "team" =2 and if "team" == 2 set swat and "team"= 1
Reply
#7

Aha, I will try that.
Reply
#8

Well, the thing is, that every player has to be forced to switch team, and if I did a if check, wouldn't it check the person who has the best connection first?
Reply
#9

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
So you only want one person on the murder team?
Yeah, exactly
Reply
#10

Download and install foreach. Iter_Random(Player) selects a random connected player.
pawn Код:
new g_Murderer; // variable to hold the murderer's playerid

startRound()
{
    g_Murderer = Iter_Random(Player); // selects a random CONNECTED player
   
    SendClientMessage(g_Murderer, -1, "You are the murderer!");
   
    foreach(Player, i) // loops through all the connected players
    {
        if(i != g_Murderer) // if the player is not the murderer
        {
            // then the player is on the SWAT team.
            SendClientMessage(playerid, -1, "You are in the SWAT team!");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)