Page 1 of 1
					
				random picking people???
				Posted: May 20th, 2009, 5:39 am
				by IrishStorm
				hey there,
how would i go about getting my mod to pick random people from axis?
or setting it so that only one player can join allies?
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 2:48 pm
				by IrishStorm
				anyone?
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 3:11 pm
				by waywaaaard
				first problem:
you have the players array and the you can check if the player is allies or axis, so place all axis in one array and then go over random 0 - array.length to get a player of the axis
2nd:
I am not sure 'cause I don't know if you can restrict that, but you can force all people if already one is axis to autoset to allies
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 5:51 pm
				by IrishStorm
				Lev!athan wrote:first problem:
2nd:
I am not sure 'cause I don't know if you can restrict that, but you can force all people if already one is axis to autoset to allies
hmm ok how would i do that
 
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 8:46 pm
				by Drofder2004
				spawnPlayer() thread.
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 11:43 pm
				by IrishStorm
				ok this is what i have 
Code: Select all
random_pick()
{
    while(1)
    {
       temp = [];
       players = getentarray("player","classname");
       for(i=0;i<players.size;i++)
    {
       if(players[i].sessionstate != "spectator" && !players[i].ispicked)temp[temp.size] = players[i];
    }
       if(!temp.size)return;picked = temp[randomInt(temp.size)];
       if(temp.size == 1)
       break;
       wait 1;
       if(numofplayers("allies") > 0)
       return;
       continue;
    }
        break;
    }
        picked endon("disconnect");
        picked.isfirstpicked = true;
        picked.ispicked = true;
        picked.switching_teams = true;
        picked.madepicked = true;
        iprintln(picked.name + " ^2is the ^1Hunter");
        }
	}
}
 
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 11:45 pm
				by Drofder2004
				Its seem a little over complicate for simply picking a player on a team...
Which game are you working on?
			 
			
					
				Re: random picking people???
				Posted: May 20th, 2009, 11:47 pm
				by IrishStorm
				cod5
			 
			
					
				Re: random picking people???
				Posted: May 21st, 2009, 9:21 am
				by waywaaaard
				you can also 
do
getplayersarray
random
if == allies
break
while(getplayersarray > 0)
kind of pseudocode
			 
			
					
				Re: random picking people???
				Posted: May 22nd, 2009, 12:14 pm
				by IrishStorm
				Lev!athan wrote:you can also 
do
getplayersarray
random
if == allies
break
while(getplayersarray > 0)
kind of pseudocode
would that be for setting the limit of player per team or random picking?
 
			 
			
					
				Re: random picking people???
				Posted: May 26th, 2009, 1:08 am
				by IrishStorm
				got it working
			 
			
					
				Re: random picking people???
				Posted: May 26th, 2009, 10:18 pm
				by Drofder2004
				Grats! 
