Jump to content

[HELP]Team points problem


freudo

Recommended Posts

Hey guys

I have a problem.

Why false?

photo:

mta-screen_2014-06-27_11-45-44.png

code:

function tables() 
    outputChatBox("Top 3 Clans:", getRootElement(), 255,255,255) 
    for index, data in ipairs(sortTeams()) do 
        outputChatBox("#"..tostring(index)..": ".. tostring(data.account) .."#f4a460 - #ffffff".. tostring(data.points), getRootElement(), 255, 255, 255,true) 
        if index == 3 then 
            break 
        end 
    end 
end 
addCommandHandler("top", tables) 
  
function sortTeams() 
    local rowdata = {} 
    for index, v in pairs( getElementsByType("team") ) do 
        rowdata[index] = { 
            account = getTeamName(v), 
            points = getElementData(v,"teampoint"), 
        } 
    end 
    local comparator = function (a, b) 
        return (tonumber(a.points) or 0) > (tonumber(b.points) or 0) 
    end 
    table.sort(rowdata, comparator) 
    return rowdata 
end 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...