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.
I am really glad that i chose stinky's services , this guy is definitely skilled !
I ordered a mod for my server and he delivered and exceeded my expectations .
I am definitely recommend him highly enough !
-He is pretty fast
-Cool and easy to communicate
-skilled
So, make me understand one thing, you consider your previous work a crap? Everyone who has payd for l2jmobius subscription since 2018 untill 2024 had access to a crap version of your server and the best is the latest you release in this very moment to your actual subscribers?
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.