Jump to content

[HELP] Fatal Problem


K4stic

Recommended Posts

Posted

says error: attempt to perform arithmetic on a nil value

setElementData ( source, "cans", tonumber(getElementData(source, "cans") or 0) + cans, false ) 

Posted

thx it's work

i will say you if i find bug because i have fix with help of community and some my self that 5-6 time's and still bugget after 1 day

Posted
says error: attempt to perform arithmetic on a nil value
setElementData ( source, "cans", tonumber(getElementData(source, "cans") or 0) + cans, false ) 

If you still want that in 1 line which I would unless you need to use current cans number more than once, you need to pay close attention to brackets:

setElementData ( source, "cans", ( tonumber( getElementData(source, "cans" ) ) or 0 ) + cans, false ) 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...