Jump to content

2 Problems with my playerlist


FSXTim

Recommended Posts

Hello,

I have a small problem with my script, it's a playerlist.

'name', 'playingtime' and 'ping' are list in the playerlist.

1. At 'rang', there is 'false', and not the 'status' (state).

2. At 'nr', there is nothing. Error: Bad argument @ 'guiSetText' [Expected string at argument 2, got nil] at this line:

guiSetText ( playerListLabels[k][4], nr ) 

function reFillPlayerList () 
    for key, index in pairs ( playerListLabels ) do 
        for i = 1, 5 do 
            guiSetText ( playerListLabels[key][i], "" ) 
        end 
    end 
    local i = 0 
    local k = 0 
    local name, rang, playingtime, ping 
    for key, index in pairs ( playersOnline ) do 
        i = i + 1 
        if k > maxPlayersInCurList then 
            break 
        end 
        if i >= curPlayerListPosition then 
            k = k + 1 
            name = getPlayerName(index) 
            rang = tostring(getElementData(index,"Status")) 
            ping = tonumber(getPlayerPing(index)) 
            nr = tonumber(getElementData(index, "Wins")) 
            playingtime = getElementData ( index, "PlayedH" ) 
            playingtime = math.floor ( playingtime / 60 )..":"..( playingtime - math.floor ( playingtime / 60 ) * 60 ) 
             
            guiSetText ( playerListLabels[k][1], name ) 
            guiSetText ( playerListLabels[k][2], rang ) 
            guiSetText ( playerListLabels[k][3], playingtime ) 
            guiSetText ( playerListLabels[k][4], nr ) 
            guiSetText ( playerListLabels[k][5], ping ) 
             
            pr, pg, pb = getPingColor ( ping ) 
            guiLabelSetColor ( playerListLabels[k][5], pr, pg, pb ) 
        end 
    end 
end 

Greets

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...