Nicolas ECM Posted January 15, 2015 Share Posted January 15, 2015 Hi all I have a problem with this code I get an error but do not quite understand how to fix it function Cambia(sourcePlayer) local blood = getElementData(sourcePlayer,"Misionto") setElementData(sourcePlayer,"Misionto", blood + 1) end addCommandHandler("sumar",Cambia ) function SD(sourcePlayer) blood = getElementData(sourcePlayer,"Misionto") outputChatBox("".. blood"",sourcePlayer,151,97,2,false) end addCommandHandler("total",Cambia ) I get an error at line 3 which says Local Attempt to perform arithmetic on "blood" a boolean value and me another error on line 2 that says bad argument [Expected element at one argument, got nil] please help, thanks. Link to comment
Castillo Posted January 15, 2015 Share Posted January 15, 2015 It's because the player doesn't have the element data you are trying to increase the value of. To fix it, you can do this: local blood = tonumber ( getElementData ( sourcePlayer, "Misionto" ) ) or 0 Link to comment
Anubhav Posted January 16, 2015 Share Posted January 16, 2015 Also use a tostring at blood in function Cambia. ANd you forgot to put .. dots Link to comment
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