Hello, I would like help because I do not understand very well, I made a restriction so that players of the same team do not kill themselves more players who do not participate can kill the participants.
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java
index 70589d9..ba98048 100644--- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java
@@-133,6+133,7@@import net.sf.l2j.gameserver.model.entity.Castle;import net.sf.l2j.gameserver.model.entity.Duel.DuelState;import net.sf.l2j.gameserver.model.entity.events.Event;+import net.sf.l2j.gameserver.model.entity.events.TvTEvent;import net.sf.l2j.gameserver.model.entity.Siege;import net.sf.l2j.gameserver.model.group.CommandChannel;import net.sf.l2j.gameserver.model.group.Party;@@-2899,6+2900,12@@@Overridepublicvoid onAction(Player player){+if(!TvTEvent.getInstance().canTarget(this, player))+{+ player.sendPacket(ActionFailed.STATIC_PACKET);+return;+}+// Set the target of the playerif(player.getTarget()!=this)
player.setTarget(this);
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/entity/events/TvTEvent.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/entity/events/TvTEvent.java
index 017c0d5..70c66e4100644--- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/entity/events/TvTEvent.java
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/entity/events/TvTEvent.java
@@-523,6+523,18@@}@Override+public boolean canTarget(Player player,Player target)+{+if(player.getTeam()==TeamType.BLUE && target.getTeam()==TeamType.BLUE)+returnfalse;++if(player.getTeam()==TeamType.RED && target.getTeam()==TeamType.RED)+returnfalse;++returntrue;+}++@Overridepublicvoid onRevive(Creature killer){if(killer == null)
I define my teams by TeamType, BLUE and RED
I added this check for players without a team it works, unregistered players can't kill registered players and RED and Azul team players can't kill themselves what did I do wrong?
@Override
public boolean canTarget(Player player, Player target)
{
+ if (player.getTeam().getId() > 0 && player.getTeam() == target.getTeam())
+ return false;
+
if (player.getTeam() == TeamType.BLUE && target.getTeam() == TeamType.BLUE)
return false;
if (player.getTeam() == TeamType.RED && target.getTeam() == TeamType.RED)
return false;
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
hello everyone !
I need help with a l2script Rev H5-Salvation/Classic build. I compiled the project, installed everything but I can't log in to the server, it won't log me in. I tried a thousand ways without good results. I leave you the error when logging in either with the H5-Salvation Client.
ERROR ---> WARN: IPBANMANAGER ---> IP !!!!
I'm waiting for help! Thank you!
Hello !
I have a problem when connecting to the pack with the Salvation client, it blocks my IP, I see that the account is created in the database but it remains logged in.
Any idea what it could be? ALso with H5 CLient !
Thank you !
Question
Williams
Hello, I would like help because I do not understand very well, I made a restriction so that players of the same team do not kill themselves more players who do not participate can kill the participants.
I define my teams by TeamType, BLUE and RED
I added this check for players without a team it works, unregistered players can't kill registered players and RED and Azul team players can't kill themselves what did I do wrong?
@Override
public boolean canTarget(Player player, Player target)
{
+ if (player.getTeam().getId() > 0 && player.getTeam() == target.getTeam())
+ return false;
+
if (player.getTeam() == TeamType.BLUE && target.getTeam() == TeamType.BLUE)
return false;
if (player.getTeam() == TeamType.RED && target.getTeam() == TeamType.RED)
return false;
return true;
}
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.