Feche1320 Posted May 5, 2011 Share Posted May 5, 2011 I have a Race server, with a client panel that allows you to buy maps. What I want to do is a search button, so they can type the server name and find the map more easy. Thanks Link to comment
Castillo Posted May 5, 2011 Share Posted May 5, 2011 You must store the maps into a table, then use this event: onClientGUIChanged, and loop through table to find the maps with the desired name. Link to comment
Feche1320 Posted May 5, 2011 Author Share Posted May 5, 2011 Okay, I managed to create the table with the maps, and they are storing, but I have a problem related to the grid lists.. addEventHandler("onClientGUIChanged", SearchMaps, function(element) local mapsearch = guiGetText(element) for i = 0, mapCount do if string.find(tostring(Maps[i]), mapsearch, 1, true) then guiGridListClear(Shop) local row = guiGridListAddRow(Shop) guiGridListSetItemText(Shop, row, 1, tostring(Maps[i]), false, false) end end end ) So, this is only showing one map.. I know that guiGridListClear(Shop) is causing it.. but I do not know how to solve it. Thanks Link to comment
Castillo Posted May 5, 2011 Share Posted May 5, 2011 Clear the grid list and then do a timer to add the elements to the gridlist? Link to comment
Feche1320 Posted May 5, 2011 Author Share Posted May 5, 2011 Well, no, after posting that, I realised that is becouse im clearing it when it finds the map, that's why it was showing only 1. addEventHandler("onClientGUIChanged", SearchMaps, function(element) local mapsearch = guiGetText(element) guiGridListClear(Shop) for i = 0, mapCount do if string.find(tostring(Maps[i]), mapsearch, 1, false) then local row = guiGridListAddRow(Shop) guiGridListSetItemText(Shop, row, 1, tostring(Maps[i]), false, false) end end end ) Changing it to the bottom works, but now I have another problem.. How can I do string.find to be uncase sensitive? HeLLo will be the same as hello. I already tryed changing false to true, but it seems like to be the same. Link to comment
Castillo Posted May 5, 2011 Share Posted May 5, 2011 addEventHandler("onClientGUIChanged", SearchMaps, function(element) local mapsearch = guiGetText(element) guiGridListClear(Shop) for i = 0, mapCount do if ( string.find ( string.upper ( tostring(Maps[i]) ) ), string.upper ( mapsearch ), 1, true ) ) then local row = guiGridListAddRow(Shop) guiGridListSetItemText(Shop, row, 1, tostring(Maps[i]), false, false) end end end ) That should work. 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