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
21 minutes ago, melron said:

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

 

Player is inside zone false, Config: true

 

this is what i have inside my zone

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.model.zone.type;

import net.sf.l2j.commons.random.Rnd;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.zone.L2SpawnZone;
import net.sf.l2j.gameserver.model.zone.ZoneId;


/**
 * An Custom PvP Zone
 *
 * @author  NeverMore
 */
public class L2CustomPvPZone extends L2SpawnZone
{
	//Ramdom Locations configs
    static int[] _x = {182240, 180199, 182296, 180185, 183254};
    static int[] _y = {22295, 22307, 18294, 18289, 20343};
    static int[] _z = {-3174, -3174, -3173, -3173, -3169};
    L2Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
    
	public L2CustomPvPZone(int id)
	{
		super(id);
	}
	
	@Override
	protected void onEnter(L2Character character)
	{
		character.setInsideZone(ZoneId.CustomPvPZone, true);
		character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
	}
	
	@Override
	protected void onExit(L2Character character)
	{
		character.setInsideZone(ZoneId.CustomPvPZone, false);
		character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
	}
	
	static class BackToPvp implements Runnable
	{
		private L2Character _activeChar;

		BackToPvp(L2Character character)
		{
			_activeChar = character;
		}

        @Override
        public void run()
        {
            int r = Rnd.get(5);
            _activeChar.teleToLocation(_x[r] , _y[r], _z[r], r); 
        }
	}
	
	@Override
	public void onDieInside(L2Character character)
	{
	       if (character instanceof L2PcInstance)
	       {
	       }
	}

	@Override
	public void onReviveInside(L2Character character)
	{
        ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 500);
        ((L2PcInstance) character).isNoblesseBlessed();
        noblesse.getEffects(character, character);
	}
}

 

  • 0
Posted
13 minutes ago, melron said:
if(Config.ENABLE_PVP_FEATURES && isInsideZone(ZoneId.CustomPvPZone))
	pvpReward();

 

 

Go ahead

it doesnt work even if im out of the zone...

  • 0
Posted
2 minutes ago, haskovo said:

it doesnt work even if im out of the zone...

Put the debug again. If both conditions are true, you have empty reward data

  • 0
Posted (edited)
7 minutes ago, melron said:

Put the debug again. If both conditions are true, you have empty reward data

i dont have empty reward it was working but i want to give the reward when im inside the pvp zone maybe this is the problem ?

Player is inside zone false

Edited by haskovo
  • 0
Posted

onEnter() function in this zone is not set for the character correctly if your code not work.

debug the setter

or you are simply not in a pvp zone

 

plus be sure the zone is loaded 🙂

  • 0
Posted
18 hours ago, haskovo said:

why do i need ip protection its just the code not working

Maybe you code is working , and your zones work too , but you have ip protection to avoid players dual box get reward , did you try with other player / pc ? 

  • 0
Posted (edited)
10 hours ago, haskovo said:

someone lock 🙂

 

ok, locked.

Edited by Vision
Guest
This topic is now closed to further replies.
×
×
  • Create New...