Jump to content

Question

Posted

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

 

Recommended Posts

  • 0
Posted
if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CustomPvPZone))
	pvpReward();

 

 

Go ahead

  • 0
Posted (edited)
  On 7/1/2021 at 6: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();
				}

 

Expand  

 

if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CUSTOMPVP) )       
  {                     

pvpReward();            
   }               
 

Edited by Irrelevant
  • 0
Posted
  On 7/1/2021 at 7:04 PM, haskovo said:

it doesnt give anything now

Expand  

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
  • 0
Posted (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 by haskovo
  • 0
Posted (edited)
  On 7/1/2021 at 9:18 PM, 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

Expand  

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
  • 0
Posted
  On 7/1/2021 at 6: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();
				}

 

Expand  

 

  On 7/1/2021 at 9:18 PM, 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

Expand  

Can you please explain your issue in plain English? Also consider mentioning the pack that you are using.

 

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

}

 

  • 0
Posted (edited)
  On 7/3/2021 at 12:40 PM, arm4729 said:
if(isInsideZone(ZoneId.CUSTOMPVP)&&(Config.ENABLE_PVP_FEATURES))
{
 pvpReward();
 }
 else if (isInsideZone(ZoneId.CUSTOMPVP)&&(!Config.ENABLE_PVP_FEATURES))
{
sendMessage("Reward Disabled"); 
return

}

 

Expand  

not working i want when they are inside the pvp zone only then to get reward im using acis

Edited by haskovo
  • 0
Posted
  On 7/1/2021 at 6: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();
				}

 

Expand  

It works everywhere cause your ifs are bad

  On 7/1/2021 at 6:54 PM, Irrelevant said:

if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CUSTOMPVP) )       
  {                     

pvpReward();            
   }               

Expand  

This is the correct way

  • 0
Posted (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 by haskovo
  • 0
Posted

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

 

Guest
This topic is now closed to further replies.


×
×
  • Create New...