Jump to content

Search on panel..


Recommended Posts

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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...