shaved92bravada Posted November 11, 2008 Posted November 11, 2008 I am working on a mod that requires the user to have certain items in their inventory. How would I select which items and then if the user had them they could do the action and if not it tells them they need to purchase said items?? I thought I had it but it didn't work. I am pretty sure its some type of array just not sure. Quote
Guest Anonymous Posted November 12, 2008 Posted November 12, 2008 Re: How would I ...... SELECT COUNT(inv_id) FROM inventory WHERE inv_itemid IN (1,2,3) AND inv_userid = # IIRC, this should return 3 assuming you have each of the types as listed in braces. So the mod itself could use a CSV (comma separated field) of item ID's that are required and use: $sql = sprintf("SELECT COUNT(inv_id) FROM inventory WHERE ((inv_itemid IN (%s) AND (inv_userid = %u))", $comma_separated_field, $userid); where $comma_separated field is the list. May need some adjustment, but you should get the point... Quote
shaved92bravada Posted November 12, 2008 Author Posted November 12, 2008 Re: How would I ...... ok that helps a ton, I think I can figure out the rest. lol If I need more help atleast I know I can always ask. Thank you very much nyna Quote
shaved92bravada Posted November 12, 2008 Author Posted November 12, 2008 Re: How would I ...... Just wanted to say thank you for your help Nyna. Haven't quite got it figured out just yet but I'm not giving up yet either. I just commented it out for now to take a break and went on to a couple of other functions in the script. Once I get it done I am thinking of posting it as a free mod and would like if you would look it over and tell me what I need to improve on. Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.