Jump to content

SearchBar Problem


isa_Khamdan

Recommended Posts

Hello ,

I made a search bar for my gridlist and I used this code from the forums to make it work but it doesn't and there is no errors at all so can anyone tell me how can I fix it?

clientsideResourceStart = function() 
  if column then 
    for id,playeritem in ipairs(getElementsByType("player")) do 
      local row = guiGridListAddRow(GUIEditor_Grid[1]) 
      guiGridListSetItemText(GUIEditor_Grid[1], row, column, getPlayerName(playeritem), false, false) 
    end 
  end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart ) 
  
  
function search() 
  
    guiGridListClear(GUIEditor_Grid[1]) 
  
    local text = guiGetText(SearchBar) 
  
    if (text == "") then 
  
        for index, player in ipairs(getElementsByType("player")) do 
  
            if (player ~= localPlayer) then 
  
                local row = guiGridListAddRow(GUIEditor_Grid[1]) 
  
                guiGridListSetItemText(GUIEditor_Grid[1], row, 1, getPlayerName(player), false, false) 
  
            end 
  
        end 
  
    else 
  
        for index, player in ipairs(getElementsByType("player")) do 
  
            if (player ~= localPlayer) then 
  
                if string.find (string.upper(getPlayerName(player)), string.upper(text), 1, true) then 
  
                    local row = guiGridListAddRow(GUIEditor_Grid[1]) 
  
                    guiGridListSetItemText(GUIEditor_Grid[1], row, 1, getPlayerName(player), false, false) 
  
                end 
  
            end 
  
        end 
  
    end 
  
end 
  
addEventHandler("onClientGUIChanged", SearchBar, search) 

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