cincalok Posted June 5, 2016 Posted June 5, 2016 Hi all, Currently working on Novice vs Zombie script, and I can't get the onPCLogoutEvent to work. Script as below: OnPCLogoutEvent:if ( .@mapnvz$ == "quiz_01" && getmapusers("quiz_01") == 1 ) {killmonsterall "quiz_01";mapannounce "quiz_01","You have won, please approach to Prize NPC.",0;enablenpc "Prize";set $@NvZCounter,0;stopnpctimer;end;} Encountered the same issue when I am working with Devil Square, but i ignored it as it won't cause the event to be stucked. Is there anything wrong with the keyword? Players will be stuck now if someone logs out and number of players left is 1. Thank you in advance. Quote
0 Secrets Posted June 7, 2016 Posted June 7, 2016 but why is it returning 2 players ?! Because the label is being ran before the player is actually removed from the map. Quote
0 Moriarty Posted June 5, 2016 Posted June 5, 2016 I think your .@mapnvz$ isn't being setted, as it is as temporary variable, show the whole code. Quote
0 cincalok Posted June 5, 2016 Author Posted June 5, 2016 Hi Moriarty, I switched the code up a little but it still doesn't work. http://upaste.me/aae2268811d0aac81 This is my whole script. Thanks for your advice. Quote
0 Technoken Posted June 5, 2016 Posted June 5, 2016 (edited) Maybe when the player logged out the script "getmapusers("quiz_01") == 1" is read first before the character is logged out. Maybe try to add sleep? OnPCLogoutEvent: if ( strcharinfo(3) != "quiz_01" )end; sleep2 1000; if( getmapusers("quiz_01") == 1 ) { killmonsterall "quiz_01"; mapannounce "quiz_01","You have won, please approach to Prize NPC.",0; enablenpc "Prize"; set $@NvZCounter,0; stopnpctimer; end; } I didn't test the script. Edited June 5, 2016 by Technoken Quote
0 cincalok Posted June 5, 2016 Author Posted June 5, 2016 Hi Technoken, Unfortunately it is not working after I add sleep in. Thank you. Quote
0 Technoken Posted June 6, 2016 Posted June 6, 2016 Are you sure there's only one player left inside the map? Maybe the gm account is still there. Try to do some checking and see if there's only 1 player left. OnPCLogoutEvent: if ( strcharinfo(3) != "quiz_01" )end; mapannounce "quiz_01",getmapusers("quiz_01")+" player left.",0; end; } Quote
0 cincalok Posted June 6, 2016 Author Posted June 6, 2016 Hi Technoken, Yes I am very sure. I am suspecting there is something wrong with my onPCLogoutEvent function itself. Is there any updates where I can patch to solve this problem? Thank you. Quote
0 Moriarty Posted June 7, 2016 Posted June 7, 2016 Add this: announce "There are "+getmapusers("quiz_01")+" players on the map",8; after the OnPcLogoutEvent ( before the if ). Log double account and see what number appears on the announce after loggin out. If it's 1, then it's weird. As an alternative you can create a timer, that checks every 1 minute if there is only one player in the map, then you don't have to use OnLougoutEvent. ( Event start would initnpctimer, and OnTimer60000: would reset the timer if the event is still going on ). Quote
0 cincalok Posted June 7, 2016 Author Posted June 7, 2016 Hi Moriarty, Thanks for the suggestion. I did as you said, I added it before the if, and also when the event started, using 2 accounts, 1 gm account and 1 normal account. When the event starts, it gives me 2 players. When I logout, it gives me 2 players as well. Well at least now i know it is not function problem, but why is it returning 2 players ?! Quote
0 cincalok Posted June 7, 2016 Author Posted June 7, 2016 Hi Secrets, Thank you for the heads up. Added a sleep before the checking and it works fine now. Thanks for all your assistance. Quote
Question
cincalok
Hi all,
Currently working on Novice vs Zombie script, and I can't get the onPCLogoutEvent to work.
Script as below:
if ( .@mapnvz$ == "quiz_01" && getmapusers("quiz_01") == 1 ) {
killmonsterall "quiz_01";mapannounce "quiz_01","You have won, please approach to Prize NPC.",0;
enablenpc "Prize";set $@NvZCounter,0;
stopnpctimer;end;
}10 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.