Random Team for event. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random Team for event. (
/showthread.php?tid=461387)
Random Team for event. -
Slepur - 01.09.2013
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...
Re: Random Team for event. -
DanishHaq - 01.09.2013
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);
Re: Random Team for event. -
Slepur - 01.09.2013
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);
}
Re: Random Team for event. -
Slepur - 01.09.2013
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...