Jump to content
  • 0

Check item ids before creating them.


Legato

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  87
  • Reputation:   1
  • Joined:  11/20/11
  • Last Seen:  

Hiya, everyone. Is it possible to check the item ids before creating them via @item, @item2, @produce and @itemmap.

Like you,'d restrict the item that in between the id that you will set.

Example. (btw, this isn't working.)

if (item_id >= 18000 && item_id <= 19000)
{
clif_displaymessage(fd, "These items are restricted.");
return 1;
}

Can someone show me how's it done?

Tia.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Hmm, this actually should work. I added this:

if(item_id >= 2000)
{
clif_displaymessage(fd, "NOT ALLOWED!");
return -1;
}

below this:

item_id = item_data->nameid;

in the @item function and it worked.

You probably added your check at the wrong spot.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  87
  • Reputation:   1
  • Joined:  11/20/11
  • Last Seen:  

Ohh. Right. >_>

Thanks, Kenpachi.

Can I use arrays on source modification? Or should I just use this to check different ids?

if ( item_id >= 2000 && item_id <= 2200 || item_id == 2300 || item_id == 2400 and so on ... )
{
clif_displaymessage(fd, "NOT ALLOWED");
return 1;
}

Edited by Legato
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Can I use arrays on source modification? Or should I just use this to check different ids?
Sure. Arrays are no problem.

But i think in your case checking ID ranges is the more elegant solution.

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