Random Team for event.
#1

Hey, I'm trying to work out how to force players on to random teams when an event has been announced as started.

I want it so when a player does /join they get put on team 1 then if another player joins team 2 then if another play joins team 1 and so on...
Reply
#2

This'd be a good guidance: https://sampwiki.blast.hk/wiki/Random.

pawn Код:
new randomteam = 1 + random(5); //minimum 1 max 5
SetPlayerTeam(playerid, randomteam);
Reply
#3

So...

pawn Код:
new randomteam =1 + random(2)
Would make 2 teams?

Like so...
pawn Код:
new randomteam = 1+random(2);
SetPlayerTeam(playerid, randomteam);
        if(randomteam == 1)
        {
            SetPlayerPos(playerid, EventSpawn1[rSpawn][0], EventSpawn1[rSpawn][1], EventSpawn1[rSpawn][2]);
            SetPlayerFacingAngle(playerid, EventSpawn1[rSpawn][3]);
            SetPlayerInterior(playerid,10);
        }
        else if(randomteam == 2)
        {
            SetPlayerPos(playerid, EventSpawn2[rSpawn][0], EventSpawn2[rSpawn][1], EventSpawn2[rSpawn][2]);
            SetPlayerFacingAngle(playerid, EventSpawn2[rSpawn][3]);
            SetPlayerInterior(playerid,10);
        }
Reply
#4

Oh... I have it working after a bit of messing around, but now I have a problem of making the teams even... It turns out with 3 vs 7 etc...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)