freudo Posted October 4, 2014 Share Posted October 4, 2014 ı want list playerlist okey but list bug .D if playerlist then for id, player in ipairs(getElementsByType("player")) do local playerName = getPlayerName(player) local playerName = playerName:gsub("#%x%x%x%x%x%x", "") table.insert(players, playerName) end end Link to comment
Castillo Posted October 4, 2014 Share Posted October 4, 2014 You mean that it adds a single player multiple times? Link to comment
freudo Posted October 4, 2014 Author Share Posted October 4, 2014 no, one player local players = {} dxDrawGridList( (screenW - 251) / 2, (screenH - 254) / 2, 251, 254, 8, 70, core.language.dxGui.gridlist, players, true, false) local playerlist = getElementData(core.language.dxGui.gridlist, "selected")[1] if playerlist then for id, player in ipairs(getElementsByType("player")) do local playerName = getPlayerName(player) local playerName = playerName:gsub("#%x%x%x%x%x%x", "") table.insert(players, playerName) end end Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 First loop the table second make sure that the player is not the table using if ! Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 Sure if i dont help you so what i do ? for i, val in ipairs(players) do if val ~= playerName then table.insert(players, playerName) end end Link to comment
freudo Posted October 4, 2014 Author Share Posted October 4, 2014 local players = getElementsByType("player") local playerName = getPlayerName(source) for i, val in ipairs(players) do if val ~= playerName then table.insert(players, playerName) end end nothing Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 No added the part of the code after getPlayerName in the first code after line 9 Link to comment
freudo Posted October 4, 2014 Author Share Posted October 4, 2014 please give me code for id, player in ipairs(getElementsByType("player")) do if player ~= playerName then table.insert(players, playerName) end local playerName = getPlayerName(player) local playerName = playerName:gsub("#%x%x%x%x%x%x", "") end Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 Cant i use phone ! Listen first take the first code that you give it to us second copy my code third past it after line 9 just before table.insert in you first code Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 Also dont forget to delete line 9 after all Link to comment
freudo Posted October 4, 2014 Author Share Posted October 4, 2014 yes work but have a problem lost button Link to comment
freudo Posted October 4, 2014 Author Share Posted October 4, 2014 for id, player in ipairs(getElementsByType("player")) do local playerName = getPlayerName(player) local playerName = playerName:gsub("#%x%x%x%x%x%x", "") table.insert(players, playerName) end for i, val in ipairs(getElementsByType("player")) do if val ~= playerName then table.insert(players, playerName) end end Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 Delete line 4 and modify line 6 to for i, val in ipairs(players) do past the code that draw the grid Link to comment
King12 Posted October 4, 2014 Share Posted October 4, 2014 May I know where did you get that dxGUI library from? Link to comment
Anubhav Posted October 4, 2014 Share Posted October 4, 2014 Delete line 4 and modify line 6 to for i, val in ipairs(players) dopast the code that draw the grid Its obvious, it will draw the last player only! Link to comment
freudo Posted October 5, 2014 Author Share Posted October 5, 2014 nothing for id, player in ipairs(getElementsByType("player")) do local playerName = getPlayerName(player) local playerName = playerName:gsub("#%x%x%x%x%x%x", "") end for i, val in ipairs(players) do if val ~= playerName then table.insert(players, playerName) end end Link to comment
lcd1232 Posted October 5, 2014 Share Posted October 5, 2014 we can't solve your problem because u gave us code where button isn't created. 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