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.



  • Posts

    • The Time Has Come!    Tomorrow, L2DoubleDamage officially launches! Get ready for epic PvP battles, legendary rewards, and tons of action-packed features!    Opening Date: February 28, 2025  Opening Time by Country:  Greece: 20:00  Brazil: 15:00  Russia (Moscow): 21:00  Argentina: 15:00  Important Note: The donation weapons, armors, and jewelry will be closed for 2 days for the donors.   Key Features:  100% PvP Full Balance – No Pay to Win!  Ultra Stable – No Wipes, Long-Term Project!  Siege Castles: Giran, Aden, Rune  Giran Siege Reward: 100€ Real Money! (Every week after: 50€)  VIP Autofarm: x2 Drop & Name Color Change  6 Grand Bosses & 6 Special Grand Bosses!  Casino – Try Your Luck & Win Big!  Daily PvP Events – Show off your skills!  Enchant Rates: Safe +6, Max +25  JOIN NOW and prepare for the ultimate PvP experience! Check out the official links below:    Website: L2DoubleDamage  Discord: Join Here  Instagram: Follow Us  YouTube: Watch the Trailer  Facebook: Like Our Page  Get ready! The adventure begins tomorrow!    πŸš€ JOIN NOW & Experience the Best PvP Gameplay Ever! πŸš€ 🌐 Website: http://www.l2doubledamage.com/ πŸ’¬ Discord: https://discord.gg/l2doubledamage πŸ“· Instagram: https://www.instagram.com/l2doubledamage/ πŸ“˜ Facebook: https://www.facebook.com/profile.php?id=61573159438765&sk=about_contact_and_basic_info πŸ“Ί YouTube:  
    • πŸ”₯ L2Custom.com - FRESH START/WIPE! πŸ”₯ πŸ—“οΈ Wipe/Open Date: 2025-03-01, 18:00 GMT+2 βš”οΈ Chronicle: Interlude | Rates: High 🌟 Key Features: βœ… Custom Items – Enhanced PvP Experience βœ… Full Buffer – No Hassle, Just Action βœ… Olympiad (A-Grade Only) – Every Week βœ… Castle Sieges – Every Week πŸš€ Fresh Start – Dominate from Day 1! Gather your clan, forge alliances, and prove your strength on the battlefield! 🌐 Join Now: www.l2custom.com πŸ’₯ Don’t miss out on the ultimate PvP experience! πŸ’₯
    • A new template is available: Ancient-World - Responsive HTML Template    
    • We are still taking new orders! Let us talk on Telegram!
    • Hello. Looking for bot for L2 Reborn x1 Origin. Some1? L2adrenaline dont work ;/
  • Topics

Γ—
Γ—
  • Create New...