AsuraBro Posted December 26, 2015 Posted December 26, 2015 (edited) Hello, can someone please show me what is wrong with this script, i have modified this script, https://rathena.org/board/topic/83371-send-to-all-online-players/?p=202884 do { set .@size, query_sql( "SELECT `account_id`, `name` from `char` where `online` = '1' and `char_id` != "+ getcharid(0) +" order by `account_id` desc limit "+ ( .@loop *128 ) +", 128", .@account_id, .@name$ ); for( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) { if ( checkvending( .@name$[.@i] ) || checkchatting( .@name$[.@i] ) ) continue; set .@randomplayer, .@account_id[.@i[rand(getarraysize(.@account_id))]]; } explain for this, it will give an item from my input to a random player that isn't shopping / chatting. but the problem is it will always give the same player, i tried a lot of methods to fix it but none worked. what is wrong with it. thank you! Edited December 27, 2015 by AsuraBro Quote
0 Emistry Posted December 27, 2015 Posted December 27, 2015 .@result = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 AND `account_id` NOT IN ( SELECT `account_id` FROM `login` WHERE `group_id` > 0 ) ORDER BY RAND() LIMIT 1",.@aid,.@name$ ); 1 Quote
0 Stolao Posted December 27, 2015 Posted December 27, 2015 order by `account_id` desc limit Change the order 1 Quote
0 AsuraBro Posted December 27, 2015 Author Posted December 27, 2015 (edited) order by `account_id` desc limit Change the order and how should it be i really don't have that much of idea on it. should it look like this? set .@size, query_sql( "SELECT `account_id`, `name` from `char` where `online` = '1' and `char_id` != "+ getcharid(0) +" order by RAND(`account_id`) desc limit "+ ( .@loop *128 ) +", 128", .@account_id, .@name$ ); Edited December 27, 2015 by AsuraBro Quote
0 Emistry Posted December 27, 2015 Posted December 27, 2015 do{ .@result = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ ); } while( .@result && ( checkvending( .@name$ ) || checkchatting( .@name$ ) ) ); if ( .@result ) { getitem 512,1,.@aid; getitem 512,2,.@aid; getitem 512,3,.@aid; } 1 Quote
0 Stolao Posted December 27, 2015 Posted December 27, 2015 do{ .@result = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ ); } while( .@result && ( checkvending( .@name$ ) || checkchatting( .@name$ ) ) ); if ( .@result ) { getitem 512,1,.@aid; getitem 512,2,.@aid; getitem 512,3,.@aid; } Ty emistry 1 Quote
0 AsuraBro Posted December 27, 2015 Author Posted December 27, 2015 do{ .@result = query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 1",.@aid,.@name$ ); } while( .@result && ( checkvending( .@name$ ) || checkchatting( .@name$ ) ) ); if ( .@result ) { getitem 512,1,.@aid; getitem 512,2,.@aid; getitem 512,3,.@aid; } ty, emistry. but what if i wanted to exclude player with gm level ? Quote
Question
AsuraBro
Hello,
can someone please show me what is wrong with this script, i have modified this script, https://rathena.org/board/topic/83371-send-to-all-online-players/?p=202884
explain for this, it will give an item from my input to a random player that isn't shopping / chatting.
but the problem is it will always give the same player, i tried a lot of methods to fix it but none worked.
what is wrong with it.
thank you!
Edited by AsuraBro6 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.