random picking people???
Moderator: Core Staff
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
random picking people???
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?
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?
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
Re: random picking people???
anyone?
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- Core Staff
- Posts: 2214
- Joined: February 6th, 2006, 3:18 pm
- Location: Germany/Bayern
Re: random picking people???
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
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
THAT HANDS WERE NOT TRACED!
visit my blog: Link
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
Re: random picking people???
hmm ok how would i do thatLev!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
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: random picking people???
spawnPlayer() thread.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
Re: random picking people???
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");
}
}
}
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: random picking people???
Its seem a little over complicate for simply picking a player on a team...
Which game are you working on?
Which game are you working on?

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
Re: random picking people???
cod5
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- Core Staff
- Posts: 2214
- Joined: February 6th, 2006, 3:18 pm
- Location: Germany/Bayern
Re: random picking people???
you can also
do
getplayersarray
random
if == allies
break
while(getplayersarray > 0)
kind of pseudocode
do
getplayersarray
random
if == allies
break
while(getplayersarray > 0)
kind of pseudocode
THAT HANDS WERE NOT TRACED!
visit my blog: Link
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
Re: random picking people???
would that be for setting the limit of player per team or random picking?Lev!athan wrote:you can also
do
getplayersarray
random
if == allies
break
while(getplayersarray > 0)
kind of pseudocode
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- CJ Newbie
- Posts: 96
- Joined: January 8th, 2009, 3:48 am
- Location: Ireland
- Contact:
Re: random picking people???
got it working
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: random picking people???
Grats! 


Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 3 guests