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

1 answer 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(.@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; }



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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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