Jump to content
  • 0

NPC Delete Inventroy


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

Requesting for an NPC that will allow a player to delete all items specifically with id #10013 on players inventory

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1678
  • Reputation:   704
  • Joined:  12/21/14
  • Last Seen:  

prontera,0,0,0	script	yes i am npc	444,{
	mes"player name?";
	input .@name$;
	attachrid(getcharid(3,.@name$))
	delitem 10013,countitem(10013);
	detachrid;
	close;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

41 minutes ago, sader1992 said:

prontera,0,0,0	script	yes i am npc	444,{
	mes"player name?";
	input .@name$;
	attachrid(getcharid(3,.@name$))
	delitem 10013,countitem(10013);
	detachrid;
	close;
}

 

Can i yess there a menu yes or not and need to input name

Link to comment
Share on other sites

  • 0

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

try this.


prontera,155,181,5	script	Sample	4_F_KAFRA1,{
	if (getgmlevel() >= 99) {
		mes "Do you want to remove an item from a player's inventory?";
		if (select("Yes", "No") == 1) {
			mes "Player name?";
			input .@player_name$;
			.@aid = getcharid(3, .@player_name$);
			if (!.@aid) {
				mes "Player isn't online.";
				.@aid = 0;
			}
			else {
				mes "Item ID?";
				input .@item_id;
				if (getitemname(.@item_id) == "null" || getitemname(.@item_id) == "") {
					mes "Invalid items";
					.@item_id = 0;
				}
			}
		}
		close2;
		if (.@aid > 0 && .@item_id > 0) {
			if (attachrid(.@aid)) {
				.@count = countitem(.@item_id);
				if (.@count > 0) {
					delitem .@item_id, .@count;
					mes "A GM removed "+.@count+"x "+getitemname(.@item_id)+" from your inventory.";
					close2;
				}
			}
		}
	}
	else {
		npctalk "Only GM can use this npc.";
	}
	end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

@sader1992 @Emistry thanks for the reply

i use code 

 

	getinventorylist;
	for (set .@a, 0; .@a < @inventorylist_count; set .@a, .@a + 1) 
		if (@inventorylist_id[.@a] == 10013) 
			delitem @inventorylist_id[.@a], 1;

 

Edited by Bringer
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1678
  • Reputation:   704
  • Joined:  12/21/14
  • Last Seen:  

56 minutes ago, Bringer said:

@sader1992 @Emistry thanks for the reply

i use code 

 


	getinventorylist;
	for (set .@a, 0; .@a < @inventorylist_count; set .@a, .@a + 1) 
		if (@inventorylist_id[.@a] == 10013) 
			delitem @inventorylist_id[.@a], 1;

 

^

=

if(countitem(10013)) delitem 10013,1;

 

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