Marian / Posted January 17, 2020 Share Posted January 17, 2020 Guten Tag, ich programmiere derzeit den Spielmodus Cores und sobald ein Spieler in der nähe des Cores ist soll dieser erkannt werden, dies funktioniert auch super bis auf einen haken wenn sich beispielsweise 2 Leute in dem Team befinden funktioniert es bei einem Spieler immer und der 2 Spieler wird nicht erkannt. Hier der Code: for(Player blau : Cores.teamblau) { Location redleftcore = Manager.getMapLocation(Cores.map, "RedLeftCore"); Location redrightcore = Manager.getMapLocation(Cores.map, "RedRightCore"); if(blau.getLocation().distance(redleftcore) <= 5 && redleftcoredestroyed == false) { blau.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 1, 100)); redleftcorealive = false; redleftcoreattacked = true; } else { redleftcorealive = true; redleftcoreattacked = false; } if(blau.getLocation().distance(redrightcore) <= 5 && redrightcoredestroyed == false) { blau.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 1, 100)); redrightcorealive = false; redrightcoreattacked = true; } else { redrightcorealive = true; redrightcoreattacked = false; } } for(Player rot : Cores.teamrot) { Location blueleftcore = Manager.getMapLocation(Cores.map, "BlueLeftCore"); Location bluerightcore = Manager.getMapLocation(Cores.map, "BlueRightCore"); if(rot.getLocation().distance(blueleftcore) <= 5 && blueleftcoblueestroyed == false) { rot.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 1, 100)); blueleftcorealive = false; blueleftcoreattacked = true; } else { blueleftcorealive = true; blueleftcoreattacked = false; } if(rot.getLocation().distance(bluerightcore) <= 5 && bluerightcoblueestroyed == false) { rot.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 1, 100)); bluerightcorealive = false; bluerightcoreattacked= true; } else { bluerightcorealive = true; bluerightcoreattacked = false; } } Danke im vorraus! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now