Jump to content

getPlayerFromNamePart


Recommended Posts

belehi, 7abit nasna3 gridList ba7thaha editbox, ki nekteb part men esm el player fel editbox mayab9ach felista ken el asemi eli techbah lel text eli mawjoud fel editbox w thanks ahawa el code eli jarebtou.ama el be9i ma3raftouch xD, Chokran mousba9an

  
addEventHandler("onClientGUIClick",root, 
function () 
if (source == lol) then 
playersList = guiCreateGridList(14, 44, 485, 360, false, test) 
searchedit = guiCreateEdit(511, 49, 131, 28, "Search for player", false, test) 
column = guiGridListAddColumn(playersList,"Players",1) 
end 
end 
) 
function ple() 
for id, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow ( playersList ) 
        guiGridListSetItemText ( playersList, row, 1, getPlayerName ( player ), false, false ) 
        end 
end 
setTimer(ple,50,0) 
  

Link to comment

-- N'a pas été testé, mais devrait fonctionner! . 
function Search() 
    guiGridListClear ( playersList ) 
    local text = guiGetText ( source ) 
    if ( text ~= "" ) then 
    for index, player in ipairs (getElementsByType("player")) do 
        if ( string.find ( string.upper ( getPlayerName ( player) ), string.upper ( text ), 1, true ) ) then 
                local row = guiGridListAddRow ( playersList ) 
                guiGridListSetItemText( playersList, row, 1, getPlayerName ( player), false, false ) 
            end 
        end 
    else 
        for index, player in ipairs (getElementsByType("player")) do 
            local row = guiGridListAddRow ( playersList ) 
            guiGridListSetItemText( playersList, row, 1, getPlayerName ( player), false, false ) 
        end  
    end 
end 
addEventHandler ( "onClientGUIChanged", Search, searchedit, false ) 
  
  
Link to comment
  • 1 month later...

@برستيج

شكلهه يقصصد string.find

مآ إدري الزبدةة , بعطيهه كود بلآوي !!

asma3 a sa7bi chouf hedha jarbou !

PlayerListSearch = edit---اسم المكان الي يكتب في الاسم_VERSION 
  
PlayerList = list ---اسم اللسته 
  
  
function aClientGUIChanged () 
    if ( source == PlayerListSearch ) then 
        guiGridListClear ( PlayerList ) 
        local text = guiGetText ( source ) 
        if ( text == "" ) then 
            for id, player in ipairs ( getElementsByType ( "player" ) ) do 
                guiGridListSetItemPlayerName ( PlayerList, guiGridListAddRow ( PlayerList ), 1, getPlayerName ( player ), false, false ) 
            end 
        else 
            for id, player in ipairs ( getElementsByType ( "player" ) ) do 
                if ( string.find ( string.upper ( getPlayerName ( player ) ), string.upper ( text ), 1, true ) ) then 
                    guiGridListSetItemPlayerName ( PlayerList, guiGridListAddRow ( PlayerList ), 1, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
addEventHandler ( "onClientGUIChanged", root, aClientGUIChanged ) 

Link to comment
  • 2 weeks later...

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