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.
bro you need other tools for do that working... and other files...
listen to me... you need UTPT to open the class or take the textures like this...
https://prnt.sc/cHneGXEgxlwJ
from here you can take what ever you want and after go make in Notepad ++ paste -> save as .uc
latter on you must have source for interface to compile your new interface.u with new .uc
you put inside this .uc what you made and thats create all the script lets say about the fuctionality of buttons...
NEXT...
Go download Xdat Editior
go open file -> interface.xdat
and copy one by one handmade all the Wnd and childrens...
after you get in l2.exe and you can use ///reloadui or ///show windowname to help you fix your windows without close and open the l2.exe all the time...
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.