Snakeman Posted August 28, 2016 Share Posted August 28, 2016 (edited) I need help to make a code like this... if (instanceof(Item, "HandWeapon") and Item:getCondition() > 0) and (item:contains bullets inside) then.... ForumMember: say("i need help with the red line. lol") end Edited September 8, 2016 by Snakeman Link to comment Share on other sites More sharing options...
tommysticks Posted September 6, 2016 Share Posted September 6, 2016 On 8/28/2016 at 5:03 PM, Snakeman said: I need help to make a code like this... if (instanceof(Item, "HandWeapon") and Item:getCondition() > 0) and (item:contains bullets inside) then.... ForumMember: say("i need help with the red line. lol") end I knew I remembered something that I saw that had to do with this, this is what I found: local player = getPlayer(); local primary = player:getPrimaryHandItem(); if primary:getModData().currentCapacity >= 1 or primary:getModData().roundChambered >= 1 then --do the stuff forum member wants end I didn't actually run a test on the roundChambered portion, but I believe it works the same. If not, you can remove that part and the function will work without taking accountability of whether or not there's a bullet in the chamber. Also, you'll probably get an error if this function is ran on an item that isn't a gun, but there are work arounds for that. Snakeman 1 Link to comment Share on other sites More sharing options...
Snakeman Posted September 6, 2016 Author Share Posted September 6, 2016 9 hours ago, tommysticks said: I knew I remembered something that I saw that had to do with this, this is what I found: local player = getPlayer(); local primary = player:getPrimaryHandItem(); if primary:getModData().currentCapacity >= 1 or primary:getModData().roundChambered >= 1 then --do the stuff forum member wants end I didn't actually run a test on the roundChambered portion, but I believe it works the same. If not, you can remove that part and the function will work without taking accountability of whether or not there's a bullet in the chamber. Also, you'll probably get an error if this function is ran on an item that isn't a gun, but there are work arounds for that. Thanks for your help!!! I solved that in another way Link to comment Share on other sites More sharing options...
nolanri Posted October 6, 2016 Share Posted October 6, 2016 On 2016-09-06 at 9:12 AM, Snakeman said: Thanks for your help!!! I solved that in another way next time please POST how you solved the problem Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now