Jump to content
  • 0
meruem

Is this can be done?

Question

A new @item command for players but they cant @item a certain item that i will not allowed. 

 

For example: Player have @item command but they cant @item 5377 (gpipe). But me as an admin can get it via @item. Hope you understand my explanation. Lol. 

 

Do I need to create new command or disable something or any trick you will advice. Thank you in advance. 

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0
Spoiler

//Created by Racaae (https://herc.ws/board/topic/20119-is-this-can-be-done/)
-	script	restricted_item_command	HIDDEN_WARP_NPC,{
OnInit:

//== CONF ===========
	.command$ = "item3";
	.max_qty = 10;

	//0 = Whitelist (can only create items in the list below) or
	//1 = Blacklist (cannot create items in the list below)
	.mode = 1;

	//Item list
	.items$ = "607,608,1530,2020,2021,2181,2182,2383,2410," +
	          "2541,2629,2630,5377,";

//===================

	bindatcmd .command$,strnpcinfo(3)+"::OnAtcommand";
	end;

OnAtcommand:
	if (atoi(.@atcmd_parameters$[0]) < 501) {
		dispbottom "Please enter an item ID (usage: @" + .command$ + " <item ID> <quantity>).";
		end;
	}
	.@id = atoi(.@atcmd_parameters$[0]);
	.@qty = atoi(.@atcmd_parameters$[1]);
	if (.@qty < 1)
		.@qty = 1;
	if (getitemname(.@id) == "null") {
		dispbottom "Invalid item ID.";
		end;
	}
	if (.@qty > .max_qty) {
		dispbottom "You can create only " + .max_qty + " at a time.";
		end;
	}
	if (compare(","+.items$+"," , ","+.@id+","))
		.@listed = 1;
	if ((.mode == 1 && .@listed) || (!.mode && !.@listed)) {
		dispbottom "You cannot create " + getitemname(.@id) + ".";
		end;
	}
	getitem .@id, .@qty;
	dispbottom "Item created.";
	end;
}

 

Edited by Racaae

Share this post


Link to post
Share on other sites
  • 0
On 10/31/2021 at 2:27 PM, Racaae said:
  Hide contents

//Created by Racaae (https://herc.ws/board/topic/20119-is-this-can-be-done/) - script restricted_item_command HIDDEN_WARP_NPC,{ OnInit: //== CONF =========== .command$ = "item3"; .max_qty = 10; //0 = Whitelist (can only create items in the list below) or //1 = Blacklist (cannot create items in the list below) .mode = 1; //Item list .items$ = "607,608,1530,2020,2021,2181,2182,2383,2410," + "2541,2629,2630,5377,"; //=================== bindatcmd .command$,strnpcinfo(3)+"::OnAtcommand"; end; OnAtcommand: if (atoi(.@atcmd_parameters$[0]) < 501) { dispbottom "Please enter an item ID (usage: @" + .command$ + " <item ID> <quantity>)."; end; } .@id = atoi(.@atcmd_parameters$[0]); .@qty = atoi(.@atcmd_parameters$[1]); if (.@qty < 1) .@qty = 1; if (getitemname(.@id) == "null") { dispbottom "Invalid item ID."; end; } if (.@qty > .max_qty) { dispbottom "You can create only " + .max_qty + " at a time."; end; } if (compare(","+.items$+"," , ","+.@id+",")) .@listed = 1; if ((.mode == 1 && .@listed) || (!.mode && !.@listed)) { dispbottom "You cannot create " + getitemname(.@id) + "."; end; } getitem .@id, .@qty; dispbottom "Item created."; end; }



//Created by Racaae (https://herc.ws/board/topic/20119-is-this-can-be-done/)
-	script	restricted_item_command	HIDDEN_WARP_NPC,{
OnInit:

//== CONF ===========
	.command$ = "item3";
	.max_qty = 10;

	//0 = Whitelist (can only create items in the list below) or
	//1 = Blacklist (cannot create items in the list below)
	.mode = 1;

	//Item list
	.items$ = "607,608,1530,2020,2021,2181,2182,2383,2410," +
	          "2541,2629,2630,5377,";

//===================

	bindatcmd .command$,strnpcinfo(3)+"::OnAtcommand";
	end;

OnAtcommand:
	if (atoi(.@atcmd_parameters$[0]) < 501) {
		dispbottom "Please enter an item ID (usage: @" + .command$ + " <item ID> <quantity>).";
		end;
	}
	.@id = atoi(.@atcmd_parameters$[0]);
	.@qty = atoi(.@atcmd_parameters$[1]);
	if (.@qty < 1)
		.@qty = 1;
	if (getitemname(.@id) == "null") {
		dispbottom "Invalid item ID.";
		end;
	}
	if (.@qty > .max_qty) {
		dispbottom "You can create only " + .max_qty + " at a time.";
		end;
	}
	if (compare(","+.items$+"," , ","+.@id+","))
		.@listed = 1;
	if ((.mode == 1 && .@listed) || (!.mode && !.@listed)) {
		dispbottom "You cannot create " + getitemname(.@id) + ".";
		end;
	}
	getitem .@id, .@qty;
	dispbottom "Item created.";
	end;
}

 

Thank you so much for this script sir. 

Can you further explain how can I makr this work? 

 

Example i want to give every player "@item3" meaning i need to input all item id from the item_db?

Share this post


Link to post
Share on other sites
  • 0
14 minutes ago, meruem said:

Example i want to give every player "@item3" meaning i need to input all item id from the item_db?

No, insert only the ID of the items you don't want them to create.

 

 

//Item list
.items$ = "607,608,1530,2020,2021,2181,2182,2383,2410," +
	      "2541,2629,2630,5377,";

Using the example above: player can't create Yggdrasil Berry (ID 607), nor Yggdrasil Seed (ID 608), nor Brynhild (ID 2383), nor Gentleman's Pipe (ID 5377).

They will be able to create, let's say... Combat Knife (ID 1228), and any other items, since it's not in the list.

Share this post


Link to post
Share on other sites
  • 0
On 11/1/2021 at 5:00 PM, Racaae said:

No, insert only the ID of the items you don't want them to create.

 

 

//Item list .items$ = "607,608,1530,2020,2021,2181,2182,2383,2410," + "2541,2629,2630,5377,";


//Item list
.items$ = "607,608,1530,2020,2021,2181,2182,2383,2410," +
	      "2541,2629,2630,5377,";

Using the example above: player can't create Yggdrasil Berry (ID 607), nor Yggdrasil Seed (ID 608), nor Brynhild (ID 2383), nor Gentleman's Pipe (ID 5377).

They will be able to create, let's say... Combat Knife (ID 1228), and any other items, since it's not in the list.


Do I add this as an npc? 
Or add this like adding a new command? 
Im quite confuse. 

Share this post


Link to post
Share on other sites
  • 0
On 11/28/2021 at 3:52 PM, meruem said:


Do I add this as an npc? 
Or add this like adding a new command? 
Im quite confuse. 

Help on this anyone?

Share this post


Link to post
Share on other sites
  • 0
On 12/16/2021 at 5:28 AM, Judas said:

It would be a npc script. Once it's enabled you can use the atcommand. Looks like it's bound for @item3

 

So I will put it sir on npc customs? Where will i add the npc sprite? 

Share this post


Link to post
Share on other sites
  • 0
On 1/6/2022 at 8:25 AM, meruem said:

 

So I will put it sir on npc customs? Where will i add the npc sprite? 

just make new file on npc/custom/bindcommand.txt

register the new file on npc/script_custom.conf

 

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.