Jump to content
  • 0

How many itens in the server


Question

Posted

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!

2 answers to this question

Recommended Posts

  • 1
Posted
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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...