Turbe$Z Posted August 12, 2019 Share Posted August 12, 2019 I created a scoreboard script, and the playerlist working fine, but i dont know how to insert teams, and team players after the playerlist, like in the default scoreboard script.. :s Anyone can help me? Link to comment
Scripting Moderators ds1-e Posted August 12, 2019 Scripting Moderators Share Posted August 12, 2019 (edited) 5 hours ago, Turbo777 said: I created a scoreboard script, and the playerlist working fine, but i dont know how to insert teams, and team players after the playerlist, like in the default scoreboard script.. :s Anyone can help me? https://wiki.multitheftauto.com/wiki/GuiGridListSetItemText bool guiGridListSetItemText ( element gridList, int rowIndex, int columnIndex, string text, bool section, bool number ) You're looking for that (if we're talking about GUI) section: Determines if the item is a section Edited August 12, 2019 by majqq Link to comment
Turbe$Z Posted August 12, 2019 Author Share Posted August 12, 2019 4 minutes ago, majqq said: https://wiki.multitheftauto.com/wiki/GuiGridListSetItemText bool guiGridListSetItemText ( element gridList, int rowIndex, int columnIndex, string text, bool section, bool number ) You're looking for that (if we're talking about GUI) section: Determines if the item is a section not gui, dx Link to comment
TRtam Posted August 12, 2019 Share Posted August 12, 2019 I dont know the way that you are inserting the players to the scoreboard, but i will give you an example including teams: scoreboard_rows = {}; for i, player in pairs(getElementsByType("player")) do if not getPlayerTeam(player) then table.insert(scoreboard_rows, player); end end for i, team in pairs(getElementsByType("team")) do local team_players = getPlayersInTeam(team); if #team_players > 0 then table.insert(scoreboard_rows, team); for i, player in pairs(team_players) do table.insert(scoreboard_rows, player); end end end Link to comment
Turbe$Z Posted August 13, 2019 Author Share Posted August 13, 2019 19 hours ago, TRtam said: I dont know the way that you are inserting the players to the scoreboard, but i will give you an example including teams: scoreboard_rows = {}; for i, player in pairs(getElementsByType("player")) do if not getPlayerTeam(player) then table.insert(scoreboard_rows, player); end end for i, team in pairs(getElementsByType("team")) do local team_players = getPlayersInTeam(team); if #team_players > 0 then table.insert(scoreboard_rows, team); for i, player in pairs(team_players) do table.insert(scoreboard_rows, player); end end end how to loop this table in dx? Link to comment
TRtam Posted August 13, 2019 Share Posted August 13, 2019 Like this addEventHandler("onClientRender", root, function() local scoreboard_rows = {}; for i, player in pairs(getElementsByType("player")) do if not getPlayerTeam(player) then table.insert(scoreboard_rows, player); end end for i, team in pairs(getElementsByType("team")) do local team_players = getPlayersInTeam(team); if #team_players > 0 then table.insert(scoreboard_rows, team); for i, player in pairs(team_players) do table.insert(scoreboard_rows, player); end end end for i, row in pairs(scoreboard_rows) do if getElementType(row) == "player" then -- draw your dx stuff here elseif getElementType(row) == "team" then -- draw your dx stuff here end end end ) 1 Link to comment
Turbe$Z Posted August 13, 2019 Author Share Posted August 13, 2019 3 hours ago, TRtam said: Like this addEventHandler("onClientRender", root, function() local scoreboard_rows = {}; for i, player in pairs(getElementsByType("player")) do if not getPlayerTeam(player) then table.insert(scoreboard_rows, player); end end for i, team in pairs(getElementsByType("team")) do local team_players = getPlayersInTeam(team); if #team_players > 0 then table.insert(scoreboard_rows, team); for i, player in pairs(team_players) do table.insert(scoreboard_rows, player); end end end for i, row in pairs(scoreboard_rows) do if getElementType(row) == "player" then -- draw your dx stuff here elseif getElementType(row) == "team" then -- draw your dx stuff here end end end ) thank you Link to comment
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