Jump to content
  • 0
rans

Restriction to @item

Question

Can i request for @item restriction for example you cannot @item certain items.

I have written a script that will return true/false but it doesnt work if the user input item Constant.
https://pastebin.com/bvYqDXhB

function    script  NoItemProduce   {

    .input = atoi(getarg(0));

    setarray(.disabledItems,501,512,503);

 

    if(array_exists(.disabledItems,.input) ){

            dispbottom("This item is not available for item producing",C_RED);

            return true;

    }

    

    return false;

}

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I made some changes in your script, it's working now.

You can use item id, name or constants.

Spoiler
function	script	NoItemProduce	{
	setarray(.disabledItems,501,512,503);

	for(.@i = 0; .@i < getarraysize(.disabledItems); .@i++)
	{
		if (getitemname(.disabledItems[.@i]) == getitemname(getarg(0)) || .disabledItems[.@i] == atoi(getarg(0)))
		{
			dispbottom("This item is not available for item producing",C_RED);
			return true;
		}
	}

	return false;
}

 

 

Share this post


Link to post
Share on other sites
  • 0
On 12/22/2019 at 1:01 AM, Cretino said:

I made some changes in your script, it's working now.

You can use item id, name or constants.

  Hide contents

function script NoItemProduce { setarray(.disabledItems,501,512,503); for([email protected] = 0; [email protected] < getarraysize(.disabledItems); [email protected]++) { if (getitemname(.disabledItems[[email protected]]) == getitemname(getarg(0)) || .disabledItems[[email protected]] == atoi(getarg(0))) { dispbottom("This item is not available for item producing",C_RED); return true; } } return false; }


function	script	NoItemProduce	{
	setarray(.disabledItems,501,512,503);

	for(.@i = 0; .@i < getarraysize(.disabledItems); .@i++)
	{
		if (getitemname(.disabledItems[.@i]) == getitemname(getarg(0)) || .disabledItems[.@i] == atoi(getarg(0)))
		{
			dispbottom("This item is not available for item producing",C_RED);
			return true;
		}
	}

	return false;
}

 

 

Thanks!, i'll try this later

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.