freudo Posted October 4, 2014 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
Castillo Posted October 4, 2014 Posted October 4, 2014 You mean that it adds a single player multiple times?
freudo Posted October 4, 2014 Author 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
darhal Posted October 4, 2014 Posted October 4, 2014 First loop the table second make sure that the player is not the table using if !
darhal Posted October 4, 2014 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
freudo Posted October 4, 2014 Author 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
darhal Posted October 4, 2014 Posted October 4, 2014 No added the part of the code after getPlayerName in the first code after line 9
freudo Posted October 4, 2014 Author 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
darhal Posted October 4, 2014 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
freudo Posted October 4, 2014 Author 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
darhal Posted October 4, 2014 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
King12 Posted October 4, 2014 Posted October 4, 2014 May I know where did you get that dxGUI library from?
Anubhav Posted October 4, 2014 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!
freudo Posted October 5, 2014 Author 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
lcd1232 Posted October 5, 2014 Posted October 5, 2014 we can't solve your problem because u gave us code where button isn't created.
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