add all used Coordinates to an ArrayList, or something similar and use
Code:if(coordsList.contains(whatever)) { //do stuff }
|
fixed
add all used Coordinates to an ArrayList, or something similar and use
Code:if(coordsList.contains(whatever)) { //do stuff }
i already thought that it would be something with arrays but i dont understand it.
{ { 2559, 3449 }, { 2557, 3449 } };
Yeah been searching pretty much everywhere but have no clue how to add it, can someone else explain me/or write down a simple code? or is there another way to do this..
tried something diffrent
didn't workCode:int spot = 0; switch(spot) { case 0: c.sendMessage("spot 0 taken"); spot += 1; c.sendMessage("int spot = "+spot); break; case 1: c.getPA().movePlayer(xxxx,xxxx,0); spot += 1; c.sendMessage("Spot 1 taken"); c.sendMessage("int spot = "+spot); break; case 2: c.getPA().movePlayer(xxxx,xxxx,0); spot += 1; c.sendMessage("Spot 2 taken"); c.sendMessage("int spot = "+spot); break;
Code:public static boolean spotTaken(int x, int y, int z) { for(Player player : PlayerHandler.players) { if(player != null && player.absX == x && player.absY == y && player.heightLevel == z) { return true; } } return false; }
Thanks but i dont understand it
It checks whether a specific coordinate is taken
use like
if (spotTaken(x, y, height)) {
teleElseWhere();
}
thanks, repped you both
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |