iAlreadyExist Posted July 1, 2021 Posted July 1, 2021 hey guys can you tell me what is wrong with this it gives basicly everywhere reward if(isInsideZone(ZoneId.CUSTOMPVP)) { sendMessage("is it working?"); return; } else if (Config.ENABLE_PVP_FEATURES) { pvpReward(); }
0 melron Posted July 3, 2021 Posted July 3, 2021 if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CustomPvPZone)) pvpReward(); Go ahead
0 Irrelevant Posted July 1, 2021 Posted July 1, 2021 (edited) 24 minutes ago, haskovo said: hey guys can you tell me what is wrong with this it gives basicly everywhere reward if(isInsideZone(ZoneId.CUSTOMPVP)) { sendMessage("is it working?"); return; } else if (Config.ENABLE_PVP_FEATURES) { pvpReward(); } if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CUSTOMPVP) ) { pvpReward(); } Edited July 1, 2021 by Irrelevant
0 AbsolutePower Posted July 1, 2021 Posted July 1, 2021 1 hour ago, haskovo said: it doesnt give anything now make sure that you have create your custom zone in xml , if you dont know how you can check this : if you want you can add this code for easier creation : otherwise use the first guide and create your zone by hand. also make sure that you have create your customzone.java in zone type to read your new zone properly. the path in java may be gameserver.model.zone.type. depends your pack. if you dont know how to do this, you can take example by : to see how you can add a zone in java + datapack. 1
0 iAlreadyExist Posted July 1, 2021 Author Posted July 1, 2021 (edited) i have zone and it working it is respawning me gives me nobless etc i think the problem is that its not checking who is in that zone which player Edited July 1, 2021 by haskovo
0 LordPanic Posted July 1, 2021 Posted July 1, 2021 (edited) 2 hours ago, haskovo said: i have zone and it working it is respawning me gives me nobless etc i think the problem is that its not checking who is in that zone which player Player.java , method ---> onKillUpdatePvPKarma() /* * Basic antidual box check to avoid dual box farming pvp rewards */ Boolean checkIP = getClient().getConnection().getInetAddress().getHostAddress().equals(targetPlayer.getClient().getConnection().getInetAddress().getHostAddress()); if(Config.ENABLE_PVP_FEATURES) { if (isInsideZone(ZoneId.CUSTOMPVP) && targetPlayer.isInsideZone(ZoneId.CUSTOMPVP) && !checkIP) { pvpReward(); }else return; } Edited July 2, 2021 by LordPanic
0 Zake Posted July 2, 2021 Posted July 2, 2021 23 hours ago, haskovo said: hey guys can you tell me what is wrong with this it gives basicly everywhere reward if(isInsideZone(ZoneId.CUSTOMPVP)) { sendMessage("is it working?"); return; } else if (Config.ENABLE_PVP_FEATURES) { pvpReward(); } 21 hours ago, haskovo said: i have zone and it working it is respawning me gives me nobless etc i think the problem is that its not checking who is in that zone which player Can you please explain your issue in plain English? Also consider mentioning the pack that you are using.
0 arm4729 Posted July 3, 2021 Posted July 3, 2021 if(isInsideZone(ZoneId.CUSTOMPVP)&&(Config.ENABLE_PVP_FEATURES)) { pvpReward(); } else if (isInsideZone(ZoneId.CUSTOMPVP)&&(!Config.ENABLE_PVP_FEATURES)) { sendMessage("Reward Disabled"); return }
0 iAlreadyExist Posted July 3, 2021 Author Posted July 3, 2021 (edited) 1 hour ago, arm4729 said: if(isInsideZone(ZoneId.CUSTOMPVP)&&(Config.ENABLE_PVP_FEATURES)) { pvpReward(); } else if (isInsideZone(ZoneId.CUSTOMPVP)&&(!Config.ENABLE_PVP_FEATURES)) { sendMessage("Reward Disabled"); return } not working i want when they are inside the pvp zone only then to get reward im using acis Edited July 3, 2021 by haskovo
0 iAlreadyExist Posted July 3, 2021 Author Posted July 3, 2021 2 hours ago, arm4729 said: maybe you have same ip protection ? why do i need ip protection its just the code not working
0 nikpappa Posted July 3, 2021 Posted July 3, 2021 On 7/1/2021 at 9:31 PM, haskovo said: hey guys can you tell me what is wrong with this it gives basicly everywhere reward if(isInsideZone(ZoneId.CUSTOMPVP)) { sendMessage("is it working?"); return; } else if (Config.ENABLE_PVP_FEATURES) { pvpReward(); } It works everywhere cause your ifs are bad On 7/1/2021 at 9:54 PM, Irrelevant said: if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CUSTOMPVP) ) { pvpReward(); } This is the correct way
0 melron Posted July 3, 2021 Posted July 3, 2021 A correct code does not mean that it should work. Post the whole method
0 iAlreadyExist Posted July 3, 2021 Author Posted July 3, 2021 (edited) the pvpreward call is in pcInstance where is setting +1 pvp private void pvpReward() { for (PvpReward pvpFeatures : PvpFeaturesTable.getInstance().getPvpRewardsTable()) { if (Rnd.nextDouble() < pvpFeatures.getChance()) addItem("Pvp Reward", pvpFeatures.getItemId(), pvpFeatures.getItemCount(), this, true); } } Edited July 3, 2021 by haskovo
0 melron Posted July 3, 2021 Posted July 3, 2021 Assuming your reward table is not empty, the problem is located at your zone file. Perhaps there is no setIsInsideZone(ZoneId.CUSTOMPVP) (onEnter method of the zone). Check it ... System.out.println(String.format("Player is inside zone %s, Config: %s", isInsideZone(ZoneId.CUSTOMPVP),Config.ENABLE_PVP_FEATURES)); if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CUSTOMPVP)) pvpReward();
Question
iAlreadyExist
hey guys can you tell me what is wrong with this it gives basicly everywhere reward
24 answers to this question
Recommended Posts