Leo Messi Posted October 29, 2016 Share Posted October 29, 2016 How I can know grid list count with a specified color? I mean, How much items in the grid list with red color Link to comment
iPrestege Posted October 29, 2016 Share Posted October 29, 2016 In english please? i can't get what you are asking for. Link to comment
Leo Messi Posted October 29, 2016 Author Share Posted October 29, 2016 I wanna know grid-list count, example, Players count with red color. Link to comment
ميدوح Posted October 29, 2016 Share Posted October 29, 2016 https://community.multitheftauto.com/index.php?p=resources&s=details&id=7436 Link to comment
Leo Messi Posted October 29, 2016 Author Share Posted October 29, 2016 So how this will help me.................... Link to comment
ميدوح Posted October 29, 2016 Share Posted October 29, 2016 10 minutes ago, majdxd said: So how this will help me.................... Ask code Full Link to comment
Gravestone Posted October 29, 2016 Share Posted October 29, 2016 You can do it like this: function getGridListItemsWithColor(gridlist, r, g, b) if isElement(gridlist) then local items = {} -- create a table if tonumber(r) and tonumber(g) and tonumber(b) then -- RGB values are numbers for i=0, guiGridListGetRowCount(gridlist)-1 do -- get gridlist count local r, g, b = guiGridListGetItemColor(gridlist, i, 1) -- loop through all item colors if tr == r and tg == g and tb == b then -- if the color matches the specified RGB table.insert(items, i) -- insert the item number to the table end end end end return #items end If you're trying to get items with pure red color, use getGridListItemsWithColor(gridlist, 255, 0, 0). It will return the item number btw. Link to comment
Leo Messi Posted October 29, 2016 Author Share Posted October 29, 2016 Didn't work,+ No function with this name: getGridListItemsWithColor Link to comment
iPrestege Posted October 29, 2016 Share Posted October 29, 2016 He made tgis function so you have yo add this to your script @Gravestone tr - tg and tb not defined? Link to comment
Gravestone Posted October 30, 2016 Share Posted October 30, 2016 15 hours ago, FaHaD said: He made tgis function so you have yo add this to your script @Gravestone tr - tg and tb not defined? Oh yeah, my bad. Replace local r, g, b = guiGridListGetItemColor(gridlist, i, 1) with this local tr, tg, tb = guiGridListGetItemColor(gridlist, i, 1) 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