Bringer Posted April 15, 2017 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 748 Reputation: 47 Joined: 03/12/14 Last Seen: April 16 Share Posted April 15, 2017 Spoiler - script AutoPickEvent -1,{ OnMinute00: while(1) { query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid; attachrid .@aid; if ( getgmlevel() < 100 && !checkvending() ) { DetachRID(); continue; } announce strcharinfo(0) +" won 1 Hourly Coin in Lucky Pick Event.",0,0x00FF00; getitem 31060,1; break; } end; } Error on my Map Server Quote Link to comment Share on other sites More sharing options...
0 Jey Posted April 15, 2017 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 249 Reputation: 73 Joined: 10/20/12 Last Seen: August 16, 2018 Share Posted April 15, 2017 (edited) Try to avoid using freeloop. The infinity loop is caused by a wrong condition: if ( getgmlevel() < 100 && !checkvending() ) { DetachRID(); continue; } This will detach every non GM (needs at least level 100) and non vending player. Better would be: if ( getgmlevel() > 0 || // ignores GMs checkvending() || // ignores Vender checkweight(32000,1) == 0 || // Checkweight failed checkidle() > 60 ) { // ignores AFK-Player (should also include venders) I just had a look in an own script. It's pretty much the same, but differs from the time (not every hour at minute zero). And it just waits ten seconds, if it fails. OnMinute00: //Damit das ein wenig interessanter wird, wird der Coin nicht genau zur vollen //Stunde ausgeteilt, sondern irgendwann innerhalb dieser Stunde. stopnpctimer; initnpctimer; setnpctimer(rand(0,3540000)); end; OnTimer3545000: stopnpctimer; query_sql "SELECT `account_id` FROM `char` WHERE `online` = '1' ORDER BY RAND() LIMIT 0,1",.@accid; if( getarraysize(.@accid) != 1 ) end; attachrid .@accid[0]; //Player attached if( checkweight(32000,1) == 0 || checkidle() > 60 || getgmlevel() > 0 ) { setnpctimer(3535000); //Evtl. Wird in 10 Sekunden jemand gefunden, der nicht afk ist. startnpctimer; end; } getitem 32000,1; switch(rand(17)) { case 0: announce "["+strcharinfo(0)+"] ist ein richtiger Glückspilz und findet einen Coin hinter "+((Sex)?"seinem":"ihrem")+" Sofa.",b_all; break; // [...] (Sorry in German, but you'll get the point) Edited April 15, 2017 by Jey 2 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted April 15, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Yesterday at 01:17 PM Share Posted April 15, 2017 Try Using Freeloop something like this - script AutoPickEvent -1,{ OnMinute00: freeloop(1); { query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid; attachrid .@aid; if ( getgmlevel() < 100 && !checkvending() ) { DetachRID(); continue; } announce strcharinfo(0) +" won 1 Hourly Coin in Lucky Pick Event.",0,0x00FF00; getitem 31060,1; break; } freeloop(0); end; } 1 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted April 15, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Yesterday at 01:17 PM Share Posted April 15, 2017 23 minutes ago, Jey said: Try to avoid using freeloop. The infinity loop is caused by a wrong condition: if ( getgmlevel() < 100 && !checkvending() ) { DetachRID(); continue; } This will detach every non GM (needs at least level 100) and non vending player. Better would be: if ( getgmlevel() > 0 || // ignores GMs checkvending() || // ignores Vender checkweight(32000,1) == 0 || // Checkweight failed checkidle() > 60 ) { // ignores AFK-Player (should also include venders) I just had a look in an own script. It's pretty much the same, but differs from the time (not every hour at minute zero). And it just waits ten seconds, if it fails. OnMinute00: //Damit das ein wenig interessanter wird, wird der Coin nicht genau zur vollen //Stunde ausgeteilt, sondern irgendwann innerhalb dieser Stunde. stopnpctimer; initnpctimer; setnpctimer(rand(0,3540000)); end; OnTimer3545000: stopnpctimer; query_sql "SELECT `account_id` FROM `char` WHERE `online` = '1' ORDER BY RAND() LIMIT 0,1",.@accid; if( getarraysize(.@accid) != 1 ) end; attachrid .@accid[0]; //Player attached if( checkweight(32000,1) == 0 || checkidle() > 60 || getgmlevel() > 0 ) { setnpctimer(3535000); //Evtl. Wird in 10 Sekunden jemand gefunden, der nicht afk ist. startnpctimer; end; } getitem 32000,1; switch(rand(17)) { case 0: announce "["+strcharinfo(0)+"] ist ein richtiger Glückspilz und findet einen Coin hinter "+((Sex)?"seinem":"ihrem")+" Sofa.",b_all; break; // [...] (Sorry in German, but you'll get the point) i see thanks for the info :)) Quote Link to comment Share on other sites More sharing options...
0 Bringer Posted April 16, 2017 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 748 Reputation: 47 Joined: 03/12/14 Last Seen: April 16 Author Share Posted April 16, 2017 10 hours ago, Jey said: Try to avoid using freeloop. The infinity loop is caused by a wrong condition: if ( getgmlevel() < 100 && !checkvending() ) { DetachRID(); continue; } This will detach every non GM (needs at least level 100) and non vending player. Better would be: if ( getgmlevel() > 0 || // ignores GMs checkvending() || // ignores Vender checkweight(32000,1) == 0 || // Checkweight failed checkidle() > 60 ) { // ignores AFK-Player (should also include venders) I just had a look in an own script. It's pretty much the same, but differs from the time (not every hour at minute zero). And it just waits ten seconds, if it fails. OnMinute00: //Damit das ein wenig interessanter wird, wird der Coin nicht genau zur vollen //Stunde ausgeteilt, sondern irgendwann innerhalb dieser Stunde. stopnpctimer; initnpctimer; setnpctimer(rand(0,3540000)); end; OnTimer3545000: stopnpctimer; query_sql "SELECT `account_id` FROM `char` WHERE `online` = '1' ORDER BY RAND() LIMIT 0,1",.@accid; if( getarraysize(.@accid) != 1 ) end; attachrid .@accid[0]; //Player attached if( checkweight(32000,1) == 0 || checkidle() > 60 || getgmlevel() > 0 ) { setnpctimer(3535000); //Evtl. Wird in 10 Sekunden jemand gefunden, der nicht afk ist. startnpctimer; end; } getitem 32000,1; switch(rand(17)) { case 0: announce "["+strcharinfo(0)+"] ist ein richtiger Glückspilz und findet einen Coin hinter "+((Sex)?"seinem":"ihrem")+" Sofa.",b_all; break; // [...] (Sorry in German, but you'll get the point) Spoiler - script AutoPickEvent -1,{ OnMinute00: while(1) { query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid; attachrid .@aid; if ( getgmlevel() > 0 || // ignores GMs checkvending() ) { || // ignores Vender DetachRID(); continue; } announce strcharinfo(0) +" won 1 Hourly Coin in Lucky Pick Event.",0,0x00FF00; getitem 31060,1; //set #HourlyPoints,#HourlyPoints+100; //dispbottom "You got 100 Hourly Points"; break; } end; } should be like this ? Quote Link to comment Share on other sites More sharing options...
0 Poring King Posted April 16, 2017 Group: Members Topic Count: 63 Topics Per Day: 0.02 Content Count: 1016 Reputation: 191 Joined: 11/27/14 Last Seen: February 15 Share Posted April 16, 2017 (edited) You should add the idle player also in your conditional statement Edited April 16, 2017 by Poring King Quote Link to comment Share on other sites More sharing options...
Question
Bringer
- script AutoPickEvent -1,{ OnMinute00: while(1) { query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid; attachrid .@aid; if ( getgmlevel() < 100 && !checkvending() ) { DetachRID(); continue; } announce strcharinfo(0) +" won 1 Hourly Coin in Lucky Pick Event.",0,0x00FF00; getitem 31060,1; break; } end; }
Error on my Map Server
Link to comment
Share on other sites
5 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.