Checking If a Player is in Olympiad

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
s1Lykos
Posts: 17
Joined: Thu Sep 30, 2010 7:02 pm

Checking If a Player is in Olympiad

Post by s1Lykos »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:Custom Server Revision (High Five Part 1)
L2JDP Revision Number:Custom Server Revision (High Five Part 1)
Hi, I tried search, I know this belongs in the custom server requests but I don't have enough posts there. I want to make it so my python buffer won't buff if a character is registered in Olympiad. I've never been good with python, but haven't ever gotten my hands or time to make a java scheme buffer. I tried adding this as a condition; however, it doesn't work (people can still buff when registered in olympiad) resulting in an exploit. (Getting full buffs in olympiad if lucky, by buffing right when they're ported)
This is the condition I tried:

Code: Select all

def onFirstTalk (self,npc,player):        st = player.getQuestState(QUEST_LOADING_INFO)        if OlympiadManager.getInstance().isRegistered(player):            return showText("Info","You can't buff when your registered in olympiad!","False","Return","main")        if not st :            st = self.newQuestState(player)        if player.isGM() :            return rebuildMainHtml(st)        else :            if player.getLevel() < int(getVar("minlevel")) :                
OlympiadManager.getInstance().isRegistered(player) I thought would be the method to check this; however, it's not working. Perhaps player in this case (since Python doesn't define what type of object "player" is), it may not be a L2PcInstance or am I using the wrong method to check for registration?
JMD
Advanced User
Advanced User
Posts: 1440
Joined: Wed Apr 15, 2009 10:07 am

Re: Checking If a Player is in Olympiad

Post by JMD »

Try this:

Code: Select all

                else if(OlympiadManager.getInstance().isRegistered(player))                {                    return showText(st, "Info", "You can not buff while you are in <font color=FF0000>Olympiad!</font><br>Come back,<br>when you are out of the Olympiad.", false, "Return", "main");                           }
Also dont forget to import the classes of Olympiad.
s1Lykos
Posts: 17
Joined: Thu Sep 30, 2010 7:02 pm

Re: Checking If a Player is in Olympiad

Post by s1Lykos »

Code: Select all

from com.l2jserver.gameserver.model.olympiad import OlympiadManager
It has it, I don't want to post the whole script though for private reasons(even though that probably is needed), there's 0 errors it just doesn't do what its supposed to. So does that mean that the "player" in my script is probably not an L2PCInstance?

What you posted is java version of it which I thought, I used something like that changed it to python, i think?

Code: Select all

if OlympiadManager.getInstance().isRegistered(player):            return showText("Info","You can't buff when your registered in olympiad!","False","Return","main")
JMD
Advanced User
Advanced User
Posts: 1440
Joined: Wed Apr 15, 2009 10:07 am

Re: Checking If a Player is in Olympiad

Post by JMD »

Download the init i share here viewtopic.php?f=74&t=24486 and look for the olympiad restriction at the bottom. Its what i used when i had this buffer on python and it worked.
s1Lykos
Posts: 17
Joined: Thu Sep 30, 2010 7:02 pm

Re: Checking If a Player is in Olympiad

Post by s1Lykos »

Okay thanks, it seems you used the same condition as me, and looks like if yours worked mine must be some external problem.
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: Checking If a Player is in Olympiad

Post by Starter »

hehe yes this one can be abused (in the last seconds if I remember right).

Try: OlympiadManager.getInstance().isRegisteredInComp(player)
I have promises to keep and miles to go before I sleep.
Phear
Posts: 111
Joined: Wed Jun 25, 2008 6:36 pm
Location: USA

Re: Checking If a Player is in Olympiad

Post by Phear »

I use 3 condition checks and the exploit is not possible.

Code: Select all

                elif OlympiadManager.getInstance().isRegistered(st.player) :                    return showText(st,"Info","You can't buff while participating in the Olympiad!","False","Return","main")                                    elif st.player.isInOlympiadMode() :                    return showText(st,"Info","You can't buff while participating in the Olympiad!","False","Return","main")                                    elif OlympiadManager.getInstance().isRegisteredInComp(st.player) :                    return showText(st,"Info","You can't buff while participating in the Olympiad!","False","Return","main")                
Q-Basic, VB, C# , Java Engineer
Post Reply