SA-MP Forums Archive
randoms - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: randoms (/showthread.php?tid=77853)



randoms - Gamer007 - 15.05.2009

How to make when player types like /dm it throws him randomly into red or blue team ( I WOULD LIKE A BALANCE EX: 3red ppl and 2blue ppl so he joins BLUE team) Can anyone pretty please give me an example??


Re: randoms - Ignas1337 - 15.05.2009

firstly there should be two teams. gTeam[MAX_PLAYERS] or something. then you could check if player is assigned to a team. if it returns to false make a check. if team1count > team2count set the player team to 2 and else set it to 1. if it is one use the fucntion 'random'. add a new value like new team = random(2); note that random starts counting from 0. in this case the value 'team' would be equal to either 1 or 0. and that should represent the team id. Or if you'd like it to be 1 or 2 do it like

new team = random(2)+1;

then the result would be 1 or 2. good luck!


Re: randoms - Gamer007 - 15.05.2009

LT: Duok savo skype paaiskinsi man geriau as nelabai supratau.
EN: I didn't understand that can you give me your Skype name?