Jump to content

GUI Scoreboard


Fist

Recommended Posts

Hello again! :D

I just recently made GUI Scoreboard but i have problem im using setTimer to refresh row of client info on each row but when im using setTimer it makes infinity rows of each player, Looks like this: http://prntscr.com/8ej7rn

Thanks for your time!

code (CLIENT)

  
function updateGUI() 
        players = getElementsByType( "player" ) 
        for i,p in ipairs(players) do 
            local playerName = getPlayerName(p) 
            local playerPing = getPlayerPing(p) 
            local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, #players, false, false) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 2, playerName, false, false) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 3, "nill", false, false) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 4, "nill", false, false) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 5, "nill", false, false) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 6, "nill", false, false) 
            guiGridListSetItemText(GUIEditor.gridlist[2], row, 7, playerPing, false, false) 
        end 
    end 
    setTimer( updateGUI, 50, 0 ) 
  

Link to comment
You have to use guiGridListClear to clear the grid list before adding the players.

I tried to use it, but still nothing. After i add it its just disappears at all screen: http://prntscr.com/8ejizz

  
 function updateGUI() 
    players = getElementsByType( "player" ) 
    for i,p in ipairs(players) do 
        local playerName = getPlayerName(p) 
        local playerPing = getPlayerPing(p) 
        local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, #players, false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 2, playerName, false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 3, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 4, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 5, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 6, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 7, playerPing, false, false) 
    end 
    end 
    setTimer(guiGridListClear, 50, 0, updateGUI) 
  

Link to comment
That function has to go inside the "updateGUI" function, before getElementsByType.

u mean like this? so if yes still it doesnt show anything.

  
players = getElementsByType( "player" ) 
    function updateGUI() 
    for i,p in ipairs(players) do 
        local playerName = getPlayerName(p) 
        local playerPing = getPlayerPing(p) 
        local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, #players, false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 2, playerName, false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 3, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 4, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 5, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 6, "nill", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[2], row, 7, playerPing, false, false) 
    end 
    end 
    setTimer(guiGridListClear, 50, 0, updateGUI) 
  

Link to comment
I told you that guiGridListClear has to go INSIDE "updateGUI" function BEFORE getElementsByType.

Thanks so much.

Sorry for going off topic but why don't you make a dx scoreboard? It's not harder, it just takes a bit more time but it's worth it...

Cause i like guis scoreboard better. :)

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