Jump to content

Search box


xyz

Recommended Posts

function IM.onSearchForPlayer() 
    phone.im.gridlist["players"]:clear() 
    local text = phone.im.edit["search_players"].text 
    for _, plr in ipairs(Element.getAllByType("player")) do 
        if (plr ~= localPlayer and plr.name:lower():find(text:lower())) then 
            local row = guiGridListAddRow(phone.im.gridlist["players"]) 
            guiGridListSetItemText(phone.im.gridlist["players"], row, 1, plr.name, false, false) 
        end 
    end 
end 
addEventHandler("onClientGUIChanged", phone.im.edit["search_players"], IM.onSearchForPlayer, false) 

Here's some code I used to filter players in a gridlist based on name. You can do the same and change the player to a table. Some other edits here and there as well.

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