Jump to content

How to Restrict Items from Going into Containers?


Ctrl-Alt-Rage

Recommended Posts

  • 1 year later...

I'm not any lua expert as i'm walking my first steps in that matter (i'm C# Unity developer) but i managed to solve the same issue, as i wanted to make a special container for ammunition only.

  1. On your container item script you need to add "AcceptItemFunction = AcceptItemTool" (Custom function called on each item transfer, in this case i've created AcceptItemTool).
  2. Add that function with a code similar to this on your client side, which will return true if the type of the item being transfered is equal to Tool for this case:
function AcceptItemTool(container, item)
    return item:getStringItemType() == "Tool"    
  end
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...