Checkmate Posted August 25, 2014 Group: Members Topic Count: 96 Topics Per Day: 0.02 Content Count: 554 Reputation: 14 Joined: 09/24/12 Last Seen: November 20, 2024 Share Posted August 25, 2014 I wonder if there any npc that can make a list or check of top 7 or maybe 5 richest player with zeny and cash. Only player not Staff or GMAre those npc can be created..??..?? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted August 26, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted August 26, 2014 the reason that I say didn't test was because I was using hercules emulator and hercules doesn't have `global_reg_value` anymore, we have broken them up into 4 different tables by the way ... I forgotten that using IN is a very slow process in mysql -> blame Emistry 1. select zeny, name from `char` where account_id in ( select account_id from login where group_id < 10 ) order by zeny desc limit 7;0.0010 ~ 0.0019 sec select name, zeny from `char` left join login on `char`.account_id = login.account_id where group_id < 10 order by zeny desc limit 7;0.0009 ~ 0.0014 sec2. select name, value from `char` left join acc_reg_num_db on `char`.account_id = acc_reg_num_db.account_id left join login on `char`.account_id = login.account_id where `key` = '#CASHPOINTS' group by `char`.account_id order by value desc;0.0010 ~ 0.0014 sec select `char`.account_id as aaa, ( select name from `char` where account_id = aaa order by char_num limit 1 ), value from `char` left join acc_reg_num_db on `char`.account_id = acc_reg_num_db.account_id where `key` = '#CASHPOINTS' group by `char`.account_id order by value desc;0.0011 ~ 0.0019 secso just have to add 'login.group_id < 10' clause 3. select name, amount from inventory left join `char` on inventory.char_id = `char`.char_id left join login on `char`.account_id = login.account_id where nameid = 671 and group_id < 10 order by amount desc limit 10; tested on hercules prontera,156,185,6 script kdsjfhsdkfs 100,{ mes "blah"; next; if ( select( "Show me Top 7 highest Zeny", "Show me Top 5 highest Cash Points", "Show me Top 10 Gold Coin holder" ) == 1 ) { .@nb = query_sql( "select name, zeny from `char` left join login on `char`.account_id = login.account_id where group_id < 10 order by zeny desc limit 7", .@name$, .@zeny ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@zeny[.@i] +"Z"; } else if ( @menu == 2 ) { .@nb = query_sql( "select name, value from `char` left join acc_reg_num_db on `char`.account_id = acc_reg_num_db.account_id left join login on `char`.account_id = login.account_id where `key` = '#CASHPOINTS' and group_id < 10 group by `char`.account_id order by value desc limit 5", .@name$, .@cash ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@cash[.@i] +" points."; } else { .@nb = query_sql( "select name, amount from inventory left join `char` on inventory.char_id = `char`.char_id left join login on `char`.account_id = login.account_id where nameid = 671 and group_id < 10 order by amount desc limit 10", .@name$, .@amount ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@amount[.@i] +" gold coins."; } close; }have fun convert `acc_reg_num_db` into `global_reg_value` Quote Link to comment Share on other sites More sharing options...
anacondaq Posted August 25, 2014 Group: Members Topic Count: 42 Topics Per Day: 0.01 Content Count: 1096 Reputation: 348 Joined: 02/26/12 Last Seen: May 30, 2023 Share Posted August 25, 2014 I wonder if there any npc that can make a list or check of top 7 or maybe 5 richest player with zeny and cash. Only player not Staff or GM Are those npc can be created..??..?? Sure, you can: query_sql() in /doc/scripts_commands.txt SELECT, LIMIT, ORDER, from mysql docs Command in NPC to select total zeny from all characters on the server to .@total_zeny array. query_sql(" SELECT SUM(`zeny`) FROM `char`", .@total_zeny); It will select from `char` table 10 richest players to the two arrays: .@player$[], and .@zeny[] query_sql("SELECT name, zeny FROM `char` ORDER BY DESC LIMIT 10", .@player$, .@zeny); 1 Quote Link to comment Share on other sites More sharing options...
Checkmate Posted August 25, 2014 Group: Members Topic Count: 96 Topics Per Day: 0.02 Content Count: 554 Reputation: 14 Joined: 09/24/12 Last Seen: November 20, 2024 Author Share Posted August 25, 2014 I wonder if there any npc that can make a list or check of top 7 or maybe 5 richest player with zeny and cash. Only player not Staff or GM Are those npc can be created..??..?? Sure, you can: query_sql() in /doc/scripts_commands.txt SELECT, LIMIT, ORDER, from mysql docs Command in NPC to select total zeny from all characters on the server to .@total_zeny array. query_sql(" SELECT SUM(`zeny`) FROM `char`", .@total_zeny); It will select from `char` table 10 richest players to the two arrays: .@player$[], and .@zeny[] query_sql("SELECT name, zeny FROM `char` ORDER BY DESC LIMIT 10", .@player$, .@zeny); Errrr.... If you dont mind can show me how to do it... I mean an live example.. Cuz to create a new script... I still dont get it much... Quote Link to comment Share on other sites More sharing options...
Emistry Posted August 25, 2014 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted August 25, 2014 query_sql( "SELECT `name`,`zeny` FROM `char` WHERE `account_id` NOT IN ( SELECT `account_id` FROM `login` WHERE `group_id` > 0 ) ORDER BY `zeny` DESC LIMIT 5",.@char$,.@zeny ); .@size = getarraysize( .@char$ ); for( .@i = 0; .@i < .@size; .@i++ ) mes .@char$[.@i]+" - "+.@zeny[.@i]; close; something like this... didnt test. 1 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted August 25, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted August 25, 2014 (edited) 1. select zeny, name from `char` where account_id in ( select account_id from login where group_id < 10 ) order by zeny desc limit 7;2. select name, value from `char` inner join global_reg_value on `char`.char_id = global_reg_value.char_id where global_reg_value.str = '#CASHPOINTS' and `char`.account_id in ( select account_id from login where group_id < 10 ) order by cast( value as signed ) desc limit 7;this is a request so ... prontera,156,185,6 script kdsjfhsdkfs 100,{ mes "blah"; next; if ( select( "Show me Top 7 highest Zeny", "Show me Top 5 highest Cash Points" ) == 1 ) { .@nb = query_sql( "select zeny, name from `char` where account_id in ( select account_id from login where group_id < 10 ) order by zeny desc limit 7", .@zeny, .@name$ ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@zeny[.@i] +"Z"; } else { .@nb = query_sql( "select name, value from `char` inner join global_reg_value on `char`.char_id = global_reg_value.char_id where global_reg_value.str = '#CASHPOINTS' and `char`.account_id in ( select account_id from login where group_id < 10 ) order by cast( value as signed ) desc limit 5", .@name$, .@cash ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@cash[.@i] +" points."; } close; }I also didn't test Edited August 25, 2014 by AnnieRuru 1 Quote Link to comment Share on other sites More sharing options...
Checkmate Posted August 26, 2014 Group: Members Topic Count: 96 Topics Per Day: 0.02 Content Count: 554 Reputation: 14 Joined: 09/24/12 Last Seen: November 20, 2024 Author Share Posted August 26, 2014 (edited) I wonder if there any npc that can make a list or check of top 7 or maybe 5 richest player with zeny and cash. Only player not Staff or GM Are those npc can be created..??..?? Sure, you can: query_sql() in /doc/scripts_commands.txt SELECT, LIMIT, ORDER, from mysql docs Command in NPC to select total zeny from all characters on the server to .@total_zeny array. query_sql(" SELECT SUM(`zeny`) FROM `char`", .@total_zeny); It will select from `char` table 10 richest players to the two arrays: .@player$[], and .@zeny[] query_sql("SELECT name, zeny FROM `char` ORDER BY DESC LIMIT 10", .@player$, .@zeny); Thx sir for this knowledge ^ ^ query_sql( "SELECT `name`,`zeny` FROM `char` WHERE `account_id` NOT IN ( SELECT `account_id` FROM `login` WHERE `group_id` > 0 ) ORDER BY `zeny` DESC LIMIT 5",.@char$,.@zeny ); .@size = getarraysize( .@char$ ); for( .@i = 0; .@i < .@size; .@i++ ) mes .@char$[.@i]+" - "+.@zeny[.@i]; close; something like this... didnt test. Thx also sir about this.. ^ ^ Sql query... @.@ 1. select zeny, name from `char` where account_id in ( select account_id from login where group_id < 10 ) order by zeny desc limit 7;2. select name, value from `char` inner join global_reg_value on `char`.char_id = global_reg_value.char_id where global_reg_value.str = '#CASHPOINTS' and `char`.account_id in ( select account_id from login where group_id < 10 ) order by cast( value as signed ) desc limit 7;this is a request so ... prontera,156,185,6 script kdsjfhsdkfs 100,{ mes "blah"; next; if ( select( "Show me Top 7 highest Zeny", "Show me Top 5 highest Cash Points" ) == 1 ) { .@nb = query_sql( "select zeny, name from `char` where account_id in ( select account_id from login where group_id < 10 ) order by zeny desc limit 7", .@zeny, .@name$ ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@zeny[.@i] +"Z"; } else { .@nb = query_sql( "select name, value from `char` inner join global_reg_value on `char`.char_id = global_reg_value.char_id where global_reg_value.str = '#CASHPOINTS' and `char`.account_id in ( select account_id from login where group_id < 10 ) order by cast( value as signed ) desc limit 5", .@name$, .@cash ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@cash[.@i] +" points."; } close; }I also didn't test And about this Miss Annieruru... alot... It works well but i encounter some error when trying to check the@cashpoints or @kafrapoints. That npc did not showing it unlike the zeny. It just sow the close button then Errmmmm... How to make this fixed?..? And the other thing,just incase how can we add a command which can make NPC read how much item example gold_coin of the player in whole server?..? Cuz above topic was refer to zeny and cash point which is can be log into server and how about if the item?..? Wodering about that??..?? Edited August 26, 2014 by CheckMate Quote Link to comment Share on other sites More sharing options...
Checkmate Posted August 26, 2014 Group: Members Topic Count: 96 Topics Per Day: 0.02 Content Count: 554 Reputation: 14 Joined: 09/24/12 Last Seen: November 20, 2024 Author Share Posted August 26, 2014 (edited) by the way ... I forgotten that using IN is a very slow process in mysql -> blame Emistry Owh.. In hercules was more complicated... but if got some error can fix easily without need to edit whole error or database or script. That was a long and ermm liltle easy to understand for newbie like me. And all i need to do know is change all the word from 'acc_reg_num_db` into `global_reg_value` right... And add the last query to make NPC read how many gold_coin from player... I try it first.. Very helped.. Thx alot guys... ^ ^ [ Edited ] 1 # 2.select name, value from `char` left join acc_reg_num_db on `char`.account_id = acc_reg_num_db.account_id left join login on `char`.account_id = login.account_id where `key` = '#CASHPOINTS' group by `char`.account_id order by value desc;0.0010 ~ 0.0014 sec select `char`.account_id as aaa, ( select name from `char` where account_id = aaa order by char_num limit 1 ), value from `char` left join acc_reg_num_db on `char`.account_id = acc_reg_num_db.account_id where `key` = '#CASHPOINTS' group by `char`.account_id order by value desc;0.0011 ~ 0.0019 sec so just have to add 'login.group_id < 10' clause Im stuck in here... Im confused where to add the clause, put in 'key' or where?..? 1 : acc_reg_num_db.account_id where `key` 2 # The queries was to detect gold coin only from iventory right?..? How to add more.. I mean to check into storage,gstorage,cart,iventory? Edited August 26, 2014 by CheckMate Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted August 26, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted August 26, 2014 (edited) be grateful, I just setup rathena test server just to answer your question 1. prontera,156,185,6 script kdsjfhsdkfs 100,{ mes "blah"; next; if ( select( "Show me Top 7 highest Zeny", "Show me Top 5 highest Cash Points", "Show me Top 10 Gold Coin holder" ) == 1 ) { .@nb = query_sql( "select name, zeny from `char` left join login on `char`.account_id = login.account_id where group_id < 10 order by zeny desc limit 7", .@name$, .@zeny ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@zeny[.@i] +"Z"; } else if ( @menu == 2 ) { .@nb = query_sql( "select name, value from `char` left join global_reg_value on `char`.account_id = global_reg_value.account_id left join login on `char`.account_id = login.account_id where global_reg_value.str = '#CASHPOINTS' and group_id < 10 group by `char`.account_id order by cast( value as signed ) desc limit 5;", .@name$, .@cash ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@cash[.@i] +" points."; } else { .@nb = query_sql( "select name, amount from inventory left join `char` on inventory.char_id = `char`.char_id left join login on `char`.account_id = login.account_id where nameid = 671 and group_id < 10 order by amount desc limit 10", .@name$, .@amount ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@amount[.@i] +" gold coins."; } close; }2.besides inventory, there also can be storage, carts, guild_storage, mail and auction also, inventory is bound to character storage is bound by account guild storage is bound to a guild auction .... I don't want to think about it it will be just insane to list them all Edited August 26, 2014 by AnnieRuru 1 Quote Link to comment Share on other sites More sharing options...
Checkmate Posted August 26, 2014 Group: Members Topic Count: 96 Topics Per Day: 0.02 Content Count: 554 Reputation: 14 Joined: 09/24/12 Last Seen: November 20, 2024 Author Share Posted August 26, 2014 be grateful, I just setup rathena test server just to answer your question 1. prontera,156,185,6 script kdsjfhsdkfs 100,{ mes "blah"; next; if ( select( "Show me Top 7 highest Zeny", "Show me Top 5 highest Cash Points", "Show me Top 10 Gold Coin holder" ) == 1 ) { .@nb = query_sql( "select name, zeny from `char` left join login on `char`.account_id = login.account_id where group_id < 10 order by zeny desc limit 7", .@name$, .@zeny ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@zeny[.@i] +"Z"; } else if ( @menu == 2 ) { .@nb = query_sql( "select name, value from `char` left join global_reg_value on `char`.account_id = global_reg_value.account_id left join login on `char`.account_id = login.account_id where global_reg_value.str = '#CASHPOINTS' and group_id < 10 group by `char`.account_id order by cast( value as signed ) desc limit 5;", .@name$, .@cash ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@cash[.@i] +" points."; } else { .@nb = query_sql( "select name, amount from inventory left join `char` on inventory.char_id = `char`.char_id left join login on `char`.account_id = login.account_id where nameid = 671 and group_id < 10 order by amount desc limit 10", .@name$, .@amount ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes .@name$[.@i] +" - "+ .@amount[.@i] +" gold coins."; } close; }2.besides inventory, there also can be storage, carts, guild_storage, mail and auction also, inventory is bound to character storage is bound by account guild storage is bound to a guild auction .... I don't want to think about it it will be just insane to list them all Im just curious about all these stuff... Thx again miss cuz setting up rAthena for answering my question.. That was very helpfull.. ^ ^ Quote Link to comment Share on other sites More sharing options...
Question
Checkmate
I wonder if there any npc that can make a list or check of top 7 or maybe 5 richest player with zeny and cash. Only player not Staff or GM
Are those npc can be created..??..??
Link to comment
Share on other sites
9 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.