Page 1 of 1

Checking If a Player is in Olympiad

Posted: Tue Apr 17, 2012 1:31 am
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?

Re: Checking If a Player is in Olympiad

Posted: Tue Apr 17, 2012 10:06 am
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.

Re: Checking If a Player is in Olympiad

Posted: Tue Apr 17, 2012 7:19 pm
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")

Re: Checking If a Player is in Olympiad

Posted: Tue Apr 17, 2012 9:25 pm
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.

Re: Checking If a Player is in Olympiad

Posted: Tue Apr 17, 2012 11:24 pm
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.

Re: Checking If a Player is in Olympiad

Posted: Sat Apr 21, 2012 3:22 pm
by Starter
hehe yes this one can be abused (in the last seconds if I remember right).

Try: OlympiadManager.getInstance().isRegisteredInComp(player)

Re: Checking If a Player is in Olympiad

Posted: Sat May 26, 2012 6:02 pm
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")