Fist Posted September 9, 2015 Posted September 9, 2015 Hello again! 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 )
Castillo Posted September 9, 2015 Posted September 9, 2015 You have to use guiGridListClear to clear the grid list before adding the players.
Fist Posted September 9, 2015 Author Posted September 9, 2015 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)
Castillo Posted September 9, 2015 Posted September 9, 2015 That function has to go inside the "updateGUI" function, before getElementsByType.
Fist Posted September 10, 2015 Author Posted September 10, 2015 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)
Castillo Posted September 10, 2015 Posted September 10, 2015 I told you that guiGridListClear has to go INSIDE "updateGUI" function BEFORE getElementsByType.
LabiVila Posted September 10, 2015 Posted September 10, 2015 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...
Fist Posted September 10, 2015 Author Posted September 10, 2015 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.
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