February 3, 20179 yr Sometimes when mining or woodcutting you might notice a ton of people just bombing your spot. Instead of losing out on gp/hr hop worlds! First we need these imports import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.Player; Now a function to detect local players and check if we should hop /** * Check if the current players in our area meets the limit * * @param area the area that the players will be calculated * @param playerLim the amount of players needed to perform a hop * @return true if the player count meets the limit */ private boolean shouldWeHop(Area area, int playerLim) { int playersInArea = 0; List<Player> nearbyPlayers = players.getAll(); //Remove our player from the list nearbyPlayers.remove(myPlayer()); for (Player player : nearbyPlayers) { if (area.contains(player)) { playersInArea++; } } return playersInArea >= playerLim; } Usage: int playerDetectionRadius = 5; //A radius of 5 steps is 5 steps in every direction from our player int playerLim = 3; //amount of players we should have before hopping if(shouldWeHop(myPlayer().getArea(playerDetectionRadius), playerLim)) { //true we should hop, let's hop! worlds.hopToF2PWorld(); } Edited February 4, 20179 yr by Hayase
February 3, 20179 yr or you can do: if (getPlayers().getAll().size() > 2) { worlds.hopToF2PWorld(); } note, 2 will mean if there is 1 player or more near you as it will return 1 for your own player
February 3, 20179 yr I've been using this a lot in my scripts and it seems to help counter bans. I find an isolated mining/woodcutting spot and put this in the code and it has lead to me not getting banned. You can also detect if anyone says part of your name/whole name and then world hop. They cant report you once you've hopped I believe
February 3, 20179 yr Author 4 minutes ago, Lewis said: or you can do: if (getPlayers().getAll().size() > 2) { worlds.hopToF2PWorld(); } note, 2 will mean if there is 1 player or more near you as it will return 1 for your own player Yes that does work, except it is too greedy when detecting nearby players. Sometimes when mining inside the dwarven mines the nearby players could pickup people that aren't even nearby. So to be more accurate with the nearby players--we count the players inside our players radius.
February 3, 20179 yr 6 minutes ago, Lewis said: or you can do: if (getPlayers().getAll().size() > 2) { worlds.hopToF2PWorld(); } note, 2 will mean if there is 1 player or more near you as it will return 1 for your own player shouldn't that be >= 2 or > 1? will be useful but what is playersInArea? 20 minutes ago, Hayase said: int playerDetectionRadius = 5; //A radius of 5 steps is 5 steps in every direction from our player int playerLim = 3; //amount of players we should have before hopping if(shouldWeHop(playersInArea(myPlayer().getArea(playerDetectionRadius)), playerLim)) { //true we should hop, let's hop! worlds.hopToF2PWorld(); }
February 3, 20179 yr 2 minutes ago, Stimpack said: shouldn't that be >= 2 or > 1? yeah, just using as an example. wrote it in 5 seconds lol i personally use > 1;
February 3, 20179 yr public boolean shouldHop() { return getPlayers().filter(p -> p != null && myPlayer().getArea(5).contains(p)).size() > 1; }
February 4, 20179 yr Author 5 hours ago, Stimpack said: shouldn't that be >= 2 or > 1? will be useful but what is playersInArea? oops, totally fucked up my own copy pasta
Create an account or sign in to comment