Hey, I have a array for my bukkit plugin im working on, I also have a array holding a random user, and how can I get the other users from that array to a variable?
so
variable = <array>[rand(getsrandomplayer)]
others = the rest of the array?
How could I do that?
so
variable = <array>[rand(getsrandomplayer)]
others = the rest of the array?
How could I do that?
6
Ok thanks so much, if you want, I may need further help with my plugin if you wish to help me you may, cmedia.studios add me skype???
Thanks
~Hydri
Thanks
~Hydri
Corrected code:
int random = new Random().nextInt(Bukkit.getOnlinePlayers().length);//random select player
Player[] players = Bukkit.getOnlinePlayers();
Player player = players[random];//make a array with the chosen user in it
Player[] theNotChosen = new Player[PutTheMaxAmountOfPlayersHere];
public void onGameStart(CommandSender sender){
int lengh = 0;
for(Player player : players){
if(!player.equals(player)){
theNotChosen [lengh] = player;
lengh++;
}
}
player.sendMessage("Your It!");
}
I got
Correct Yes?
int random = new Random().nextInt(Bukkit.getOnlinePlayers().length);//random select player
Player player = Bukkit.getOnlinePlayers()[random];//make a array with the chosen user in it
public void onGameStart(CommandSender sender){
int lenght = 0;
for(Player player : array){
if(!player.equals(player)){
(theres?)[lenght] = player;
lenght++;
}
}
player.sendMessage("Your It!");
}
Correct Yes?
where dose theres come into play?
it was the others array mispelled that oops
Player chosen = array[getThePlayer];
Player[] others = new Player[maxPlayersHere];
int lengh = 0;
for(Player player : array){
if(!player.equals(chosen){
others[lengh] = player;
lengh++;
}
}
