Jump to content
  • 0

help only in pvp zone reward


iAlreadyExist
 Share

Question

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();
				}

 

Link to comment
Share on other sites

Recommended Posts

  • 0
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 by Irrelevant
Link to comment
Share on other sites

  • 0
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.

 

 

 

  • Like 1
Link to comment
Share on other sites

  • 0

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 by haskovo
Link to comment
Share on other sites

  • 0
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 by LordPanic
Link to comment
Share on other sites

  • 0
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.

 

Link to comment
Share on other sites

  • 0
if(isInsideZone(ZoneId.CUSTOMPVP)&&(Config.ENABLE_PVP_FEATURES))
{
 pvpReward();
 }
 else if (isInsideZone(ZoneId.CUSTOMPVP)&&(!Config.ENABLE_PVP_FEATURES))
{
sendMessage("Reward Disabled"); 
return

}

 

Link to comment
Share on other sites

  • 0
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 by haskovo
Link to comment
Share on other sites

  • 0
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

Link to comment
Share on other sites

  • 0

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 by haskovo
Link to comment
Share on other sites

  • 0

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();

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock