Jump to content

[Share]Auto Flag at PvP Zones


Recommended Posts

Hello , it's my first share at this forum and i hope u will like it . It's not tested yet (if u test it please leave a reply) . With this code when someone is teleporting at pvp zone then he's autoflagged .

 

L2Characters.java

		/** Zone system */
      +public static final byte ZONE_FLAG_PVP = 0;
public static final byte ZONE_PVP = 0;

find

public final boolean isInsideZone(final byte zone)
{
	return zone == ZONE_PVP ? _zones[ZONE_PVP] > 0 && _zones[ZONE_PEACE] == 0 : _zones[zone] > 0;
}

make it

public final boolean isInsideZone(final byte zone)
{
	return zone == ZONE_PVP ? _zones[ZONE_PVP] > 0 && ZONE_FLAG_PVP ? _zones[ZONE_FLAG_PVP] > 0 && _zones[ZONE_PEACE] == 0 : _zones[zone] > 0;
}

 

L2PvPAreaZone.java

package com.l2jserver.gameserver.model.zone.type;

import com.l2jserver.gameserver.datatables.MapRegionTable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.model.actor.instance.L2PcInstance;
import com.l2jserver.model.zone.L2SpawnZone;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;

/**
* @author  Zaldron
*/
public class L2PvpAreaZone extends L2SpawnZone
{	
private L2PcInstance activeChar;

public PvpArea(int id)
{
	super(11037);
}
        	
protected void onEnter(L2Character character)
{

	if (character instanceof L2PcInstance)
	{
		if (!character.isInsideZone(L2Character.ZONE_FLAG_PVP))
			((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));

	}

	character.setInsideZone(L2Character.ZONE_FLAG_PVP, true);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);
	activeChar.decayMe();
	activeChar.spawnMe();
                activeChar.isNoblesseBlessed();
	activeChar.setPvpFlag(1);
	activeChar.setTitle("Lets Fight");
	activeChar.broadcastUserInfo();
}

protected void onExit(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_FLAG_PVP, false);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);
	activeChar.decayMe();
	activeChar.spawnMe();
	activeChar.stopNoblesseBlessing(null);
	activeChar.setPvpFlag(0);
	activeChar.setTitle("");
	activeChar.broadcastUserInfo();

	if (character instanceof L2PcInstance)
	{
		if (!character.isInsideZone(L2Character.ZONE_FLAG_PVP))
			((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.LEFT_COMBAT_ZONE));
	}
}

public void onDieInside(L2Character character) {MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);}

public void onReviveInside(L2Character character) {}
}


</zone>

<zone id="11037" type="ZONE_FLAG_PVP" shape="NPoly" minZ="-3600" maxZ="-3400">
	<stat name="isPeaceZone" val="false" />
	<spawn X="x" Y="y5" Z="z" /> 

</zone>

/**
* On "x" "y" "z" you can put your pvp zone.
*/ 

 

L2Zonetype.java

+								else if(zoneType.equals("PvpFlagZone"))
+								{
+									temp = new PvpAreaZone(11037);
+								}

 

SQL

 

+INSERT INTO `zone_vertices` VALUES

+(11037,0,x,-x),

+(11037,1,x,-x),

+(110370,1,x,-x),

+(11037,2,,-x),

 

-- PVP FLAG AREA

INSERT INTO `zone_vertices` VALUES

(11037,0,x,-x),

(11037,1,x,-x),

 

 

All kind of comments are accepted . Also thanks for your time by watching the topic !

Link to comment
Share on other sites

Pathetic

Haters gonna hate , why you are posting here since there is another topic ? And yes that code was already shared on l2jfrozen forums and i dont like reshares so mutch.
Link to comment
Share on other sites

  • 3 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now



×
×
  • Create New...