exports [ 'scoreboard' ]:addScoreboardColumn ( "Points" )
function refreshData()
for k, v in ipairs (getElementsByType("player")) do
local account = getPlayerAccount( v )
if isGuestAccount(account) then
setElementData( v, "Points", "Guest" )
outputChatBox("Please, log in or register for save points" , v, 255, 0, 0, true)
else
local data = getAccountData(getPlayerAccount( v ), "Points" )
if data then
setElementData( v, "Points", data.." pts" )
end
end
end
end
setTimer( refreshData, 1000, 0 )
You were using source instead of v in your outputChatBox
Edit: there was also a missing end, try my code
Edit2: try to make your code organized taking care of if, else, functions, ends... as easier you make it to read, better for you and for people who will try to help you:
exports [ 'scoreboard' ]:addScoreboardColumn ( "Points" )
setTimer (
function ()
for k, v in ipairs (getElementsByType("player")) do
local account = getPlayerAccount( v )
if isGuestAccount(account) then
setElementData( v, "Points", "Guest" )
outputChatBox("Please, log in or register for save points" , v, 255, 0, 0, true)
else
local data = getAccountData(getPlayerAccount( v ), "Points" )
if data then
setElementData( v, "Points", data.." pts" )
end
end
end
end, 1000, 0)