Jump to content
  • 0

Pvp Flag Time Inside Zone


Question

Posted (edited)

I have this code and still when my char kill another char inside zone the pvp flag is gone after 30sec.

public void updatePvPStatus()
	{
		if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.FLAG_ZONE)) 
			return;
		
		PvpFlagTaskManager.getInstance().add(this, Config.PVP_NORMAL_TIME);
		
		if (getPvpFlag() == 0)
			updatePvPFlag(1);
	}

and

public void updatePvPStatus(L2Character target)
	{
		final L2PcInstance player = target.getActingPlayer();
		if (player == null)
			return;
		
		if (isInDuel() && player.getDuelId() == getDuelId())
			return;
		
		if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0)
		{
			PvpFlagTaskManager.getInstance().add(this, checkIfPvP(player) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME);
			
			if (getPvpFlag() == 0)
				updatePvPFlag(1);
		}
	}

can someone point me what is wrong? thanks.

Edited by ton3

Recommended Posts

  • 0
Posted (edited)

Guess why.. While you walk inside the zone with flag, you break it all. Remove this

if (activeChar.getPvpFlag() == 0)

Use the code I gave you.

Edited by SweeTs
  • 0
Posted

well, the same thing is happening.

 

hit player outside zone> enter zone> flag is gone after 15sec and even if u hit flagged player inside zone ur pvp flag doesnt update.

  • 0
Posted

Are you sure you have registered the zone, is it working correctly? Do you see the msg onEnter to the zone? :D

 

I will check it on my own, then you can compare the code and check if you missed something.

  • 0
Posted

yes I registered zone and I can see onenter messages:

 

ZoneID.java

/*
 * 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;

/**
 * Zone Ids.
 * @author Zoey76
 */
public enum ZoneId
{
    PVP(0),
    PEACE(1),
    SIEGE(2),
    MOTHER_TREE(3),
    CLAN_HALL(4),
    NO_LANDING(5),
    WATER(6),
    JAIL(7),
    MONSTER_TRACK(8),
    CASTLE(9),
    SWAMP(10),
    NO_SUMMON_FRIEND(11),
    NO_STORE(12),
    TOWN(13),
    HQ(14),
    DANGER_AREA(15),
    CAST_ON_ARTIFACT(16),
    NO_RESTART(17),
    SCRIPT(18),
    FLAG_ZONE(19);
    
    private final int _id;
    
    private ZoneId(int id)
    {
        _id = id;
    }
    
    public int getId()
    {
        return _id;
    }
    
    public static int getZoneCount()
    {
        return values().length;
    }
}

L2FlagZone.java

/* 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 2, 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package net.sf.l2j.gameserver.model.zone.type;

import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
import net.sf.l2j.gameserver.model.zone.ZoneId;
import net.sf.l2j.gameserver.network.SystemMessageId;

public class L2FlagZone extends L2ZoneType
{
       public L2FlagZone(final int id)
       {
               super(id);
       }

       @Override
       protected void onEnter(L2Character character)
       {
           if (character instanceof L2PcInstance)
           {
               L2PcInstance activeChar = ((L2PcInstance) character);
               
               activeChar.updatePvPFlag(1);
               activeChar.sendPacket(SystemMessageId.ENTERED_COMBAT_ZONE);
           }
           
           character.setInsideZone(ZoneId.FLAG_ZONE, true);
           character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
       }

       @Override
       protected void onExit(final L2Character character)
       {
           if (character instanceof L2PcInstance)
           {
           L2PcInstance activeChar = ((L2PcInstance) character);
                   
                activeChar.updatePvPFlag(0);
                activeChar.sendPacket(SystemMessageId.LEFT_COMBAT_ZONE);
           }  
               
                character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
                character.setInsideZone(ZoneId.FLAG_ZONE, false);           
                  
               }
       

       @Override
       public void onDieInside(final L2Character character)
       {
           
       }
       @Override
       public void onReviveInside(final L2Character character)
       {
           
       }
}
  • 0
Posted
public void updatePvPStatus()
    {
        if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.FLAG_ZONE))
            return;
        
        PvpFlagTaskManager.getInstance().add(this, Config.PVP_NORMAL_TIME);
        
        if (getPvpFlag() == 0)
            updatePvPFlag(1);
    }

and

public void updatePvPStatus(L2Character target)
    {    
        final L2PcInstance player = target.getActingPlayer();
        if (player == null)
            return;
        
        if (isInDuel() && player.getDuelId() == getDuelId())
            return;
        
         if ((isInsideZone(ZoneId.FLAG_ZONE) && target.isInsideZone(ZoneId.FLAG_ZONE)))
         return;
                
         if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0)
        {
            PvpFlagTaskManager.getInstance().add(this, checkIfPvP(player) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME);
            
            if (getPvpFlag() == 0)
                updatePvPFlag(1);
        }
                
            
    }
  • 0
Posted (edited)

Add this check inside PvpFlagTaskManager

             final L2PcInstance player = entry.getKey();
             final long timeLeft = entry.getValue();
             
+            if (player.isInsideZone(ZoneId.FLAG_ZONE))
+                return;
+            
             // Time is running out, clear PvP flag and remove from list.
             if (currentTime > timeLeft)
             {
Edited by SweeTs
Guest
This topic is now closed to further replies.


  • Posts

    • We've added 5% discounts for bulk purchases of Google accounts for orders of 300 or more, and 10% for orders of 500 or more. The discount is applied automatically when you place your order! The discount is indicated in the product title and description for each category.  
    • 🎄 CHRISTMAS EVENT 🎄   ‼️ Information and details: https://forum.l2harbor.com/threads/rozhdestvenskie-xlopoty-christmas-chores.9430/post-171464
    • METATG.ORG Direct Telegram Service Provider A bonus of +7% on every order! *We add 7% more followers than your ordered amount to proactively cover potential drops and guarantee you an honest result." Telegram Followers - Price per 1000 SUBSCRIBERS Subscribers 3 days - $0.10 ~ 8 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 7 days - $0.17 ~ 13.6 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 14 days - $0.20 ~ 16 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 30 days - $0.30 ~ 24 RUB Subscribers. Daily Completion: 200,000,000 Subscribers 60 days - $0.40 ~ 32 RUB Subscribers, 14-day guarantee. Daily Completion: 200,000,000 Subscribers 90 days (Super Fast) - $0.50 ~ 40 RUB Subscribers, 14-day guarantee. Daily Completion: 200,000,000 Subscribers 120 days (Super Fast) - $0.60 ~ 48 RUB Subscribers, 14-day guarantee. Daily Completion: 200,000,000 Subscribers Lifetime (Super Fast) - $0.70 ~ 56 RUB Lifetime Subscribers. 14-day guarantee. Daily Completion: 200,000,000 Telegram Services - Price per 1000 Post Views - $0.06 ~ 5 RUB Reactions - $0.08 ~ 6.5 RUB Bot Starts - $0.10 ~ 8 RUB Bot Starts with referrals - $0.15 ~ 12 RUB DISCOUNTS and CASHBACK for large volumes Direct Supplier. We work from our own accounts with our own software! High execution speed. Multiple payment methods. We work 24/7! Additional discounts are discussed for volumes starting from $1000 per day. SUPPORT 24/7 - TELEGRAM WEBSITE 24/7 - METATG.ORG
    • Added: a brand-new default dashboard template. You can now add multiple game/login server builds. Full support for running both PTS & L2J servers simultaneously, with switching between them. Payment systems: added OmegaPay and Pally (new PayPal-style API). Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account. Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.     Look demo site: demo
  • Topics

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