Jump to content
  • 0

How many itens in the server


Profile

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   1
  • Joined:  04/15/17
  • Last Seen:  

Hi all, I would like to request a script which any player can input an item ID and it will tell him how many of that item exists in the entire server. (sum of inventory, cart, storage, gstorage and equipped itens).

For example, user inputs id 607 (Yggdrasil Berry).

NPC will show the player how many Yggdrasil Berry exists in the entire server from all players.

Thank you!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

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

function	script	F_MesItemInfo	{
	.@item = getarg(0);
	.@itemname$ = getitemname(.@item);
	if (.@itemname$ != "null") {
		.@itemslot = getitemslots(.@item);
		if (.@itemslot)
			.@itemname$ = sprintf("%s [%d]", .@itemname$, .@itemslot);
	}
	else
		.@itemname$ = "Unknown Item";
	return sprintf("<ITEM>%s<INFO>%d</INFO></ITEM>", .@itemname$, .@item);
}

prontera,155,185,5	script	kjdhfkshfj	1_F_MARIA,{
	input .@itemid;
	if ( getitemname(.@itemid) == "null" ) {
		mes "invalid item";
		close;
	}
	query_sql "select "+
		        "ifnull((select sum(amount) from inventory where nameid = "+ .@itemid +"), 0) + "+
		        "ifnull((select sum(amount) from cart_inventory where nameid = "+ .@itemid +"), 0) + "+
		        "ifnull((select sum(amount) from storage where nameid = "+ .@itemid +"), 0) + "+
		        "ifnull((select sum(amount) from guild_storage where nameid = "+ .@itemid +"), 0) + "+
		        "ifnull((select sum(amount) from mail_attachments where nameid = "+ .@itemid +"), 0)"
			  , .@sum;
	mes F_MesItemInfo(.@itemid) +" has total amount of "+ .@sum +" in the entire server";
	close;
}

 

  • Upvote 1
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   1
  • Joined:  04/15/17
  • Last Seen:  

Thank you Annie! You rock!

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