Jump to content
  • 0

Requesting Zeny Counter NPC


Checkmate

Question


  • Group:  Members
  • Topic Count:  96
  • Topics Per Day:  0.02
  • Content Count:  554
  • Reputation:   14
  • Joined:  09/24/12
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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 sec

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

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`
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   344
  • Joined:  02/26/12
  • Last Seen:  

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); 
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  96
  • Topics Per Day:  0.02
  • Content Count:  554
  • Reputation:   14
  • Joined:  09/24/12
  • Last Seen:  

 

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...

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

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.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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 by AnnieRuru
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  96
  • Topics Per Day:  0.02
  • Content Count:  554
  • Reputation:   14
  • Joined:  09/24/12
  • Last Seen:  

 

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... /thx alot...

It works well

 

ebau5jslwg.jpg

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

7ojpkq3af0.jpg

 

then 

 

vehlef1mnm.jpg

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 by CheckMate
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  96
  • Topics Per Day:  0.02
  • Content Count:  554
  • Reputation:   14
  • Joined:  09/24/12
  • Last Seen:  

 

 

by the way ... I forgotten that using IN is a very slow process in mysql -> blame Emistry

/heh

 

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...  ^ ^ /no1

[ 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 by CheckMate
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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 by AnnieRuru
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  96
  • Topics Per Day:  0.02
  • Content Count:  554
  • Reputation:   14
  • Joined:  09/24/12
  • Last Seen:  

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

 

/sry

Im just curious about all these stuff...

Thx again miss cuz setting up rAthena for answering my question.. That was very helpfull..  ^ ^

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...