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

    • WIPE ! NEW SEASON GRAND OPENING FROM TODAY ! - 23/01/2026, FRIDAY, 20:00 +3 GMT !
    • https://vpslab.cloud/ Premium DDoS Protection now included with every server.
    • # Changelog - Public Updates   This changelog tracks user-facing updates and improvements to Top.MaxCheaters.com.   ---   ## [1.2.0] - 2026-01-XX   ### ⚡ Performance Improvements - **Faster Page Loads**: Implemented intelligent caching system that makes pages load significantly faster - **My Servers Page**: Now loads instantly when revisiting (no more loading delays) - **Main Page**: Server listings and filters now load faster on repeat visits - **Premium Ads**: Pricing information loads instantly - **Overall Performance**: Site now loads 60-80% faster with reduced server load   ### 🔄 Improvements - Pages now remember recent data, reducing wait times when navigating - Automatic cache refresh ensures you always see up-to-date information - Better user experience with instant page loads on repeat visits   ---   ## [1.1.1] - 2026-01-XX   ### 🐛 Bug Fixes - **VIP Server Filter**: Fixed "VIP L2 Servers" filter to correctly show all premium tier servers (VIP, Gold VIP, and Pinned) - **Ad Pricing Display**: Fixed ad pricing on Premium Ads page to automatically update when changed in admin panel   ### 🔄 Improvements - Ad pricing now syncs automatically across all pages - More accurate server filtering by tier   ---   ## [1.1.0] - 2026-01-XX   ### ✨ New Features - **Complete Chronicle List**: All chronicle options are now available in server forms and filters, including the latest Lineage 2 chronicles - **Improved Chronicle Display**: Server rows now show cleaner, shorter chronicle names for better readability   ### 🐛 Bug Fixes - **Chronicle Filter**: Fixed issue where "Infinite Odyssey" chronicle filter was not working correctly - **Missing Chronicles**: Fixed missing chronicle options in server creation and editing forms   ### 🔄 Improvements - Chronicle filters and dropdowns now stay in sync with the latest available chronicles - Better chronicle name formatting in server listings for improved visual clarity   ---   ## [1.0.0] - Initial Release   ### Features - 🎮 Server listings with multiple tiers (Normal, VIP, Gold VIP, Pinned) - 📊 Click tracking and server statistics - 🌍 Multi-language support (English, Spanish, Portuguese, Greek, Russian) - 💳 Payment system for premium server features - 🔐 Secure authentication system - 👑 Admin panel for server management - 📱 Fully responsive design for all devices - 🔍 Advanced filtering system (by chronicle, rate, server type, date) - 📅 Server opening date tracking - 🎯 Two viewing modes: By Date and By Votes (coming soon for all users)   ---   ## About This Changelog   This changelog focuses on updates that directly impact the user experience. Internal development changes and technical improvements are not included here.   For questions or feedback, please contact support.v
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..