Jump to content

Question

Posted

hello im using l2j i added this code is for when player participate in olympiad can also observe match while is registered i added this code i can see match while im register all good but when match is going to start and u are in observe mode match wont start and you are losing points please help

 

### Eclipse Workspace Patch 1.0
#P L2J_Server_BETA
Index: java/com/l2jserver/gameserver/model/olympiad/OlympiadGameTask.java
===================================================================
--- java/com/l2jserver/gameserver/model/olympiad/OlympiadGameTask.java  (revision 5214)
+++ java/com/l2jserver/gameserver/model/olympiad/OlympiadGameTask.java  (working copy)
@@ -19,6 +19,8 @@


 import com.l2jserver.Config;
 import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -305,7 +307,19 @@
            // Checking for opponents and teleporting to arena
            if (_game.checkDefaulted())
                return false;
-
+          
+           String[] _task = _game.getPlayerNames();
+          
+           L2PcInstance Player1 = L2World.getInstance().getPlayer(_task[0]);
+          
+           L2PcInstance Player2 = L2World.getInstance().getPlayer(_task[1]);
+          
+           if(Player1.inObserverMode())
+               Player1.leaveOlympiadObserverMode();
+          
+           if(Player2.inObserverMode())
+               Player2.leaveOlympiadObserverMode();
+          
            _zone.closeDoors();
            if (_game.needBuffers())
                _zone.spawnBuffers();
### Eclipse Workspace Patch 1.0
#P L2J_DataPack_BETA
Index: dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java
===================================================================
--- dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java (revision 8719)
+++ dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java (working copy)
@@ -24,8 +24,6 @@
 import com.l2jserver.gameserver.model.olympiad.Olympiad;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameManager;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameTask;
-import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
-import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.util.StringUtil;


@@ -206,11 +204,11 @@
           
            if (isManager)
            {
-               if (OlympiadManager.getInstance().isRegisteredInComp(activeChar))
+               /*if (OlympiadManager.getInstance().isRegisteredInComp(activeChar))
                {
                    activeChar.sendPacket(SystemMessageId.WHILE_YOU_ARE_ON_THE_WAITING_LIST_YOU_ARE_NOT_ALLOWED_TO_WATCH_THE_GAME);
                    return false;
-               }
+               }*/
                if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(activeChar.getObjectId()))
                {
                    activeChar.sendMessage("You can not observe games while registered for TvT");

 

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

You setted leaveOlympiadObserverMode() AFTER checkDefaulted(), which checks numerous things, notably observer mode. It has to be setted BEFORE, and the observer mode check must be deleted from checkDefaulted() too.

 

Secondly, you can use 

_playerOne.player
_playerTwo.player

(or maybe getPlayer() depending what L2J rev you use) to retrieve L2PcInstance, avoiding your L2World stuff.

Edited by Tryskell
  • 0
Posted (edited)

need a small rework to use players out of abstractions

 

p.s. the patch can possible cause client errors and u can end just like him

doom-3.jpg

Edited by BruT

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...