GTX Posted January 12, 2012 Share Posted January 12, 2012 Hello, I got confused so I post this here, thanks in advance: addCommandHandler('stats', function(source, command, name) if not name then local acc = getPlayerAccount(source) if isGuestAccount(acc) then outputChatBox("#FFFFFF>> #ff0000You must be logged in to view someones stats.", source, 0, 0, 255, true) else outputChatBox("#FFFFFF>> "..getPlayerName(source).." #0fc0fcstats:", source, 0, 0, 255, true) outputChatBox("#0fc0fcVisits: #FFFFFF" ..tostring(getAccountData(acc,"visits")).. " #0fc0fcWins: #FFFFFF" .. tonumber(getAccountData(acc, "played") or 0 - getAccountData(acc, "deaths") or 0) .. " #0fc0fcDeaths: #FFFFFF" ..tostring(getAccountData(acc, "deaths")).. " #0fc0fcMaps played: #FFFFFF" ..tostring(getAccountData(acc, "played")), source, 0, 0, 255, true) outputChatBox("#0fc0fcCash: #ffffff$"..getPlayerMoney(source) .. " #0fc0fcPoints: #ffffff" .. tostring(getAccountData(acc,"points")), source, 0, 0, 255, true) end else local player, playerName = findPlayer(name) local accn = getPlayerAccount(player) if player then outputChatBox("#FFFFFF>> "..playerName.." #0fc0fcstats:", source, 0, 0, 255, true) outputChatBox("#0fc0fcVisits: #FFFFFF" ..tostring(getAccountData(accn,"visits")).. " #0fc0fcWins: #FFFFFF" ..tonumber(p_MPlayed[player] - p_Deaths[player]).. " #0fc0fcDeaths: #FFFFFF" ..tostring(p_Deaths[player]).. " #0fc0fcMaps played: #FFFFFF" ..tostring(p_MPlayed[player]), source, 0, 0, 255, true) outputChatBox("#0fc0fcCash: #ffffff$"..getPlayerMoney(player).."#0fc0fc Points: #ffffff" .. tostring(getAccountData(accn, "points")), source, 0, 0, 255, true) else outputChatBox("#FFFFFF>> #ff0000Invalid player.", source, 0, 0, 255, true) end end end ) Check out line 10! Error: Attempt to perform arithmetic on a boolean value. Link to comment
Thelastride Posted January 12, 2012 Share Posted January 12, 2012 It means there is some variable without any value set.Make sure all account data values are set. Link to comment
GTX Posted January 12, 2012 Author Share Posted January 12, 2012 Ah yes, got it, thanks! Link to comment
Thelastride Posted January 12, 2012 Share Posted January 12, 2012 Ah yes, got it, thanks! You are welcome 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