AJXB Posted February 2, 2013 Share Posted February 2, 2013 Hey i got this script, it give a console error: Exp.lua:7: attempt to perform arithmetic on local 'lvls' local pAccount = getPlayerAccount( pPlayer ) local exp = getAccountData(pAccount, "exp") local exps = tonumber(getAccountData(pAccount, "exp")) local lvls = tonumber(getAccountData(pAccount, "lvl")) local needexp = lvls * 4 ----------- this is line 7 if not exp then setAccountData(pAccount, "exp", 1) setAccountData(pAccount, "allexp", 1) setAccountData(pAccount, "lvl", 1) outputChatBox("Your experience: " .. exps .. "/" .. needexp, getRootElement(), 0, 255, 0) else Someone help This is the part that it have the error Link to comment
Castillo Posted February 2, 2013 Share Posted February 2, 2013 "lvls" is returning something else than a number. Link to comment
Castillo Posted February 2, 2013 Share Posted February 2, 2013 Replace: local lvls = tonumber(getAccountData(pAccount, "lvl")) With: local lvls = tonumber ( getAccountData ( pAccount, "lvl" ) ) or 1 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