Nicolas ECM Posted January 15, 2015 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.
Castillo Posted January 15, 2015 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Anubhav Posted January 16, 2015 Posted January 16, 2015 Also use a tostring at blood in function Cambia. ANd you forgot to put .. dots See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
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