NeoDark Posted April 18, 2012 Posted April 18, 2012 Hello again, I have further questions on the flag, as could put that if the players are pvp so they can not drain hp from mobs. If I could help would be appreciated.
0 Rizlaaa Posted April 18, 2012 Posted April 18, 2012 ### Eclipse Workspace Patch 1.0 #P Chr.6GMS Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -238,6 +238,8 @@ public static final int STORE_PRIVATE_BUY = 3; public static final int STORE_PRIVATE_MANUFACTURE = 5; public static final int STORE_PRIVATE_PACKAGE_SELL = 8; + + private int[] drainIds = {0,25,2}; /** The table containing all minimum level needed for each Expertise (None, D, C, B, A, S)*/ private static final int[] EXPERTISE_LEVELS = @@ -284,6 +286,21 @@ public void doCast(L2Skill skill) { super.doCast(skill); + + //--Cannot use drain skills in mobs-- + L2Object target = getTarget(); + L2MonsterInstance m = null; + if(target instanceof L2MonsterInstance) + m = (L2MonsterInstance) target; + if(m != null && getPvpFlag() > 0){ + for(int i=0; i < drainIds.length; i ++) + { + if(skill.getId() == drainIds[i]){ + sendMessage("You can't drain hp from mobs"); + return; + } + } + } // cancel the recent fake-death protection instantly if the player attacks or casts spells getPlayer().setRecentFakeDeath(false); private int[] drainIds = {0,25,2}; Put the ids there, 0,25,2 are just lucky ids . It can be done also from skill handlers.
0 NeoDark Posted April 18, 2012 Author Posted April 18, 2012 Thanks friend, you're a genius ^ ^, thank you.
0 Dask Posted April 18, 2012 Posted April 18, 2012 Thanks friend, you're a genius ^ ^, thank you. Locked
Question
NeoDark
Hello again, I have further questions on the flag, as could put that if the players are pvp so they can not drain hp from mobs.
If I could help would be appreciated.
3 answers to this question
Recommended Posts