Jump to content

مساعده بي كود البحث


Recommended Posts

شباب الحين في مود الفري روم ابي اسوي كود بحث عند الانتقال

سويت هيك وما اشتغل

function warpInit() 
    local players = table.map(getElementsByType('player'), function(p) return { name = getPlayerName(p) } end) 
    table.sort(players, function(a, b) return a.name < b.name end) 
    bindGridListToTable(wndWarp, 'playerlist', players, true) 
end 
  
  
 local player_list = getControl(wndWarp, "playerlist") 
local search_edit = getControl(wndWarp, "search") 
function addPlayers(Find, edit) 
 guiGridListClear(player_list) 
 for k,v in ipairs(getElementsByType("player")) do 
  local name = getPlayerName(v) 
  if Find then 
   if name:find(guiGetText(edit)) then 
    guiGridListSetItemText(player_list, guiGridListAddRow(player_list), 1, name, false, false) 
   end 
  else 
   guiGridListSetItemText(player_list, guiGridListAddRow(player_list), 1, name, false, false) 
  end 
 end 
end 
addEventHandler("onClientGUIChanged", resourceRoot, function( ) 
 if source == search_edit then 
  if guiGetText(source) == "" then 
   addPlayers( ) 
  else 
   addPlayers(true, source) 
  end 
 end 
end) 
  
function warpTo(leaf) 
    if not leaf then 
        leaf = getSelectedGridListLeaf(wndWarp, 'playerlist') 
        if not leaf then 
            return 
        end 
    end 
    local player = getPlayerFromNick(leaf.name) 
    if player then 
        server.warpMe(player) 
    end 
    closeWindow(wndWarp) 
end 
  
wndWarp = { 
 'wnd', 
 text = 'الانتقال الي اللاعبين', 
 width = 300, 
 controls = { 
  { 
   'lst', 
   id='playerlist', 
   width=280, 
   height=330, 
   columns={ 
    {text='Player', attr='name'} 
   }, 
   onitemdoubleclick=warpTo 
  }, 
  {'btn', id='انتقال', onclick=warpTo}, 
  {'btn', id='اغلاق', closeswindow=true} 
 }, 
 oncreate = warpInit 
} 
  
function warpToCommand(cmd, player) 
    if player then 
        player = getPlayerFromNick(player) 
        if player then 
            server.warpMe(player) 
        end 
    else 
        createWindow(wndWarp) 
        showCursor(true) 
    end 
end 
  
addCommandHandler('warpto', warpToCommand) 
addCommandHandler('wt', warpToCommand) 
  

هاي اكواد الفري روم الخاصة بالانتقال كلها اتمني المساعده وشكرا

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