Random Player
#1

ok i have a question ... how can i make a random player change team if all the players are in the same team !
i mean if all the player are in the same team : change a random player to an other team
Reply
#2

You can do this by using the Iter_Random function with foreach.
For example.
pawn Code:
randPlayer = Iter_Random(Player);
It will only select a random player that is connected. Make sure it says "Player". Player is the custom iterator in foreach for connected players.
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=318722
https://sampforum.blast.hk/showthread.php?tid=281692
https://sampforum.blast.hk/showthread.php?tid=261708
https://sampforum.blast.hk/showthread.php?tid=249450
https://sampforum.blast.hk/showthread.php?tid=269060
https://sampforum.blast.hk/showthread.php?tid=188307

Use search next time.
Reply
#4

pawn Code:
new randomsize = [MAX_PLAYERS];
new randomnumber = random(sizeof(randomsize));

for(new i = 0; i < [MAX_PLAYERS]);
{
       if( randomnumber == playerid(i))
       {
                // Your teamswitching code...
                return 1;
        }
        else
        {
            i++;
         }
         return 1;
}
Copy + paste might not work as I just wrote what came up to me, but the idea is simple.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)