TorNix~|nR Posted February 14, 2021 Share Posted February 14, 2021 Hello guys, I have a problem, I'm trying to hide hex colors from a grid list and it didn't work for id,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(gridlist) setTimer ( guiGridListSetItemText , 100 , 1 , gridlist, row, column, getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), false, false ) end any help please? Link to comment
SpecT Posted February 14, 2021 Share Posted February 14, 2021 (edited) Hey, You can use guiGridListAddRow to add a row and row data instead using the guiGridListSetItemText. This should work: for _, player in ipairs(getElementsByType("player")) do setTimer(guiGridListAddRow, 100, 1, playerList, getPlayerName(player):gsub("#%x%x%x%x%x%x", "")) end BTW if there are many players it's not really good (in performance aspect) to create timers when adding them in the gridlist like this. Edited February 14, 2021 by SpecT Link to comment
TorNix~|nR Posted February 14, 2021 Author Share Posted February 14, 2021 I still can click only to players with no hex, I think this is the problem getPlayerFromName(guiGridListGetItemText(gridOpenSenior, guiGridListGetSelectedItem(gridOpenSenior), 1)) can gsub be added to this? Link to comment
SpecT Posted February 14, 2021 Share Posted February 14, 2021 (edited) I prefer this useful function for such stuff: function getPlayerFromNamePart(name) if (name) then for _, player in ipairs (getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(tostring(name):lower(), 1, true) then return player end end end end Then it will be like this: getPlayerFromNamePart(guiGridListGetItemText(gridOpenSenior, guiGridListGetSelectedItem(gridOpenSenior), 1)) PS: This function is used when you need to find a player by a part of his nick (i.e. in a command for something). Edited February 14, 2021 by SpecT 1 Link to comment
TorNix~|nR Posted February 14, 2021 Author Share Posted February 14, 2021 It's working, thank you so much 1 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