Jump to content

x[ مشكلة ]x في صنع مربع بحث


Ahmed_Negm

Recommended Posts

البحث مش شغال

فين المشكلة

الجريد ليست

function buildPlayerList()
    grdPlayers = guiCreateGridList(0.0991,0.3417,0.8108,0.6, true, wndPlayers)
    search = guiCreateEdit(22, 84, 180, 32, "", false, wndPlayers)
    colPlayers = guiGridListAddColumn(grdPlayers, "Player list", 0.85)

    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end 
end

addEventHandler("onClientResourceStart", root, buildPlayerList)

فنكشن البحث

addEventHandler("onClientGUIChanged", root,  
    function () 
    if ( source == Search ) then 
        if ( guiGetText ( source ) == "" ) then 
            guiGridListClear(grdPlayers) 
            putPlayers (1) 
        else 
            guiGridListClear(grdPlayers) 
            for i,v in ipairs(getElementsByType("player")) do 
                if string.find(getPlayerName(v),guiGetText(Search)) then 
                    local row = guiGridListAddRow(grdPlayers) 
                    guiGridListSetItemText(grdPlayers,row,1,getPlayerName(v):gsub("#%x%x%x%x%x%x", ""),false,false) 
                end 
            end 
        end 
    end 
end 
)

ياريت تردو

Link to comment
addEventHandler ( 'onClientGUIChanged',Search,  
    function ( ) 
        guiGridListClear ( grdPlayers ) 
            for i,v in ipairs ( getElementsByType ( 'player' ) ) do 
                if string.find ( string.upper ( getPlayerName ( v ):gsub ( '#%x%x%x%x%x%x', '' ) ),string.upper ( Search ) ) then 
                    guiGridListSetItemText ( grdPlayers,guiGridListAddRow ( grdPlayers ) ,1,getPlayerName ( v ):gsub('#%x%x%x%x%x%x', ''),false,false ) 
        end 
    end 
end,false
)

 

لم يتم التجربة ورجاءاً استخدم الايديتور للاكواد اذا طرحتها .

  • Like 2
Link to comment
1 hour ago, Mr.Pres[T]ege said:

addEventHandler ( 'onClientGUIChanged',Search,  
    function ( ) 
        guiGridListClear ( grdPlayers ) 
            for i,v in ipairs ( getElementsByType ( 'player' ) ) do 
                if string.find ( string.upper ( getPlayerName ( v ):gsub ( '#%x%x%x%x%x%x', '' ) ),string.upper ( Search ) ) then 
                    guiGridListSetItemText ( grdPlayers,guiGridListAddRow ( grdPlayers ) ,1,getPlayerName ( v ):gsub('#%x%x%x%x%x%x', ''),false,false ) 
        end 
    end 
end,false
)

 

لم يتم التجربة ورجاءاً استخدم الايديتور للاكواد اذا طرحتها .

لا مش شغال برضوا

Link to comment

اخوي عندك خطا بي كلمة 

Search

 

شوف

 search = guiCreateEdit(22, 84, 180, 32, "", false, wndPlayers)

هنا حاطها سمول

و هنا كبتل

  if ( source == Search ) then

جرب ذا



function buildPlayerList()
    grdPlayers = guiCreateGridList(0.0991,0.3417,0.8108,0.6, true, wndPlayers)
    search = guiCreateEdit(22, 84, 180, 32, "", false, wndPlayers)
    colPlayers = guiGridListAddColumn(grdPlayers, "Player list", 0.85)

    local players = getElementsByType("player")
    for k,v in ipairs(players) do
        addPlayerToList(v)
    end 
end

addEventHandler("onClientResourceStart", root, buildPlayerList)



addEventHandler ( 'onClientGUIChanged',search,  
    function ( ) 
        guiGridListClear ( grdPlayers ) 
            for i,v in ipairs ( getElementsByType ( 'player' ) ) do 
                if string.find ( string.upper ( getPlayerName ( v ):gsub ( '#%x%x%x%x%x%x', '' ) ),string.upper ( search ) ) then 
                    guiGridListSetItemText ( grdPlayers,guiGridListAddRow ( grdPlayers ) ,1,getPlayerName ( v ):gsub('#%x%x%x%x%x%x', ''),false,false ) 
        end 
    end 
end,false
)

 

Link to comment
  • TAPL locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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