Wei Posted August 1, 2013 Posted August 1, 2013 local storWeapon = fromJSON(getElementData(housePickup[houseID], "IGChousing.storedweapons")) if (type(storWeapon) == "table") then local tableWeapon = storWeapon if tableWeapon[getSlotFromWeapon(weapon)] then tableWeapon[getSlotFromWeapon(weapon)] = weapon..","..tableWeapon[getSlotFromWeapon(weapon)]+ammo setElementData(housePickup[houseID], "IGChousing.storedweapons", toJSON(tableWeapon)) outputChatBox("In") else table.insert(tableWeapon, getSlotFromWeapon(weapon), weapon..","..ammo) setElementData(housePickup[houseID], "IGChousing.storedweapons", toJSON(tableWeapon)) outputChatBox("NotIn") end Chatbox allways outputs NotIn. No debug! Diet with russian vodka, lose 3 days in one week !
Castillo Posted August 1, 2013 Posted August 1, 2013 And is the weapon in the table...? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted August 1, 2013 Author Posted August 1, 2013 Yes Diet with russian vodka, lose 3 days in one week !
Castillo Posted August 1, 2013 Posted August 1, 2013 You are checking the slot, do you know that? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted August 1, 2013 Author Posted August 1, 2013 Yes, that I will override it later Diet with russian vodka, lose 3 days in one week !
Castillo Posted August 1, 2013 Posted August 1, 2013 local storWeapon = fromJSON ( getElementData ( housePickup [ houseID ], "IGChousing.storedweapons" ) ) if ( type ( storWeapon ) == "table" ) then local tableWeapon = storWeapon if tableWeapon [ getSlotFromWeapon ( weapon ) ) ] then tableWeapon [ getSlotFromWeapon ( weapon ) ] = weapon ..",".. tableWeapon [ getSlotFromWeapon ( weapon ) ] + ammo setElementData ( housePickup [ houseID ], "IGChousing.storedweapons", toJSON ( tableWeapon ) ) outputChatBox ( "In" ) else tableWeapon [ getSlotFromWeapon ( weapon ) ] = weapon ..",".. ammo setElementData ( housePickup [ houseID ], "IGChousing.storedweapons", toJSON ( tableWeapon ) ) outputChatBox ( "NotIn" ) end This won't work btw: weapon ..",".. tableWeapon [ getSlotFromWeapon ( weapon ) ] + ammo You are trying to increase a string... San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted August 1, 2013 Author Posted August 1, 2013 Still same, yeah I will fix that later... Diet with russian vodka, lose 3 days in one week !
Castillo Posted August 1, 2013 Posted August 1, 2013 Mind posting the "storWeapon" result? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted August 1, 2013 Author Posted August 1, 2013 ([ { "5": "30,1" } ] notIn Diet with russian vodka, lose 3 days in one week !
Castillo Posted August 1, 2013 Posted August 1, 2013 Got it, you must convert your number to a string. local storWeapon = fromJSON ( getElementData ( housePickup [ houseID ], "IGChousing.storedweapons" ) ) if ( type ( storWeapon ) == "table" ) then local tableWeapon = storWeapon local slot = tostring ( getSlotFromWeapon ( weapon ) ) if tableWeapon [ slot ] then tableWeapon [ slot ] = weapon ..",".. tableWeapon [ slot ] + ammo setElementData ( housePickup [ houseID ], "IGChousing.storedweapons", toJSON ( tableWeapon ) ) outputChatBox ( "In" ) else tableWeapon [ slot ] = weapon ..",".. ammo setElementData ( housePickup [ houseID ], "IGChousing.storedweapons", toJSON ( tableWeapon ) ) outputChatBox ( "NotIn" ) end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Wei Posted August 1, 2013 Author Posted August 1, 2013 Working, Thank you ! Diet with russian vodka, lose 3 days in one week !
Castillo Posted August 1, 2013 Posted August 1, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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