Cxwh
Veteran
- Messages
- 64
- Reaction score
- 45
- Points
- 793
Would this return a random player from my team who is not me?
or could I also just do it like this?
Code:
function getRandPlayer()
{
players = GetPlayers();
rand = RandomIntRange(0, players.size)
if(players[rand].team != self.team && players[rand].name != self.name && players[rand].info["type"] != "bot") //don't worry i defined "bot" so when it's a bot that players.info["type"] is bot
continue;
return players[rand];
}
or could I also just do it like this?
Code:
function getRandPlayer()
{
foreach(player in self.team)
{
if(player.name != self.name && player.info["type"] != "bot")
return player; //does this return end the function? if not i'll use endon and a notify
}
}