momar5600 Posted September 24, 2016 Share Posted September 24, 2016 (edited) سلام عليكم ورحمة الله وبركاتة انا عملت مكان للبحث بلوحة الانتقال الي لاعب بس مانجح ماهو سبب addEventHandler("onClientResourceStart",resourceRoot, function() guiGridListSetSelectionMode( getControl( wndWarp, 'playerlist' ),2) local column = guiGridListAddColumn( getControl( wndWarp, 'playerlist' ), "Player Name", 0.89 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( getControl( wndWarp, 'playerlist' ) ) guiGridListSetItemText ( getControl( wndWarp, 'playerlist' ), row, column, getPlayerName(player), false, false ) guiGridListSetItemColor ( getControl( wndWarp, 'playerlist' ), row, column, 0, 250, 154, 255 ) end addEventHandler ( "onClientGUIClick", playerlist, click ) end end) function click () local playerName = guiGridListGetItemText ( getControl( wndWarp, 'playerlist' ), guiGridListGetSelectedItem ( playerlist ), 1 ) guiSetText ( getControl( wndWarp, '~|بحث عن لاعب|~' ), playerName ) end function list() guiGridListClear( getControl( wndWarp, 'playerlist' ) ) for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow( getControl( wndWarp, 'playerlist' ) ) guiGridListSetItemText( getControl( wndWarp, 'playerlist' ), row, 1, getPlayerName(players), false, false) guiGridListSetItemColor ( getControl( wndWarp, 'playerlist' ), row, 1, 0, 250, 154, 255 ) end end addEventHandler("onClientPlayerJoin", getRootElement(), list) addEventHandler("onClientPlayerQuit", getRootElement(), list) addEventHandler("onClientPlayerChangeNick", getRootElement(), list) wndWarp = { 'wnd', text = 'الانتقال الى الاعبين', width = 246, controls = { { 'lst', id='playerlist', width=231, x = 5, y= 62, height=343, columns={ {id='sharplayercol', text='الاعب', attr='name'} }, onitemdoubleclick=warpTo }, {'br'}, {'txt', id='sharplayer', text='~|بحث عن لاعب|~', onclick=click , x = 16, y= 23 ,width = 222}, {'br'}, {'btn', id='انتقال', onclick=warpTo}, {'btn', id='اغلاق', closeswindow=true} }, oncreate = warpInit } Edited September 24, 2016 by momar5600 Link to comment
' A F . Posted September 24, 2016 Share Posted September 24, 2016 خليك بموضوع واحد لاتسوي اكثر من موضوع .. !! Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 طيب ممكن تقو لي وش الخطا الي يجي يرد يرد علي بالقوانين ياخي واين مساعده هنا ليه مسوين المنتدي علشان بس قوانين Link to comment
#Plair07 Posted September 24, 2016 Share Posted September 24, 2016 5 minutes ago, momar5600 said: طيب ممكن تقو لي وش الخطا الي يجي يرد يرد علي بالقوانين ياخي واين مساعده هنا ليه مسوين المنتدي علشان بس قوانين اللي عنده حل بيعطيك إن شاء الله محد بيقصر معك + ترا خطأ انك تسوي موضوعين ورا بعض . Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 طيب كلامك حلو بس صار لي 3 ساعات مافي حد بيرد Link to comment
iMr ~ MnHmAr Posted September 24, 2016 Share Posted September 24, 2016 addEventHandler("onClientResourceStart",resourceRoot, function() guiGridListSetSelectionMode( getControl( wndWarp, 'playerlist' ),2) local column = guiGridListAddColumn( getControl( wndWarp, 'playerlist' ), "Player Name", 0.89 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( getControl( wndWarp, 'playerlist' ) ) guiGridListSetItemText ( getControl( wndWarp, 'playerlist' ), row, column, getPlayerName(player), false, false ) guiGridListSetItemColor ( getControl( wndWarp, 'playerlist' ), row, column, 0, 250, 154, 255 ) end addEventHandler ( "onClientGUIClick", playerlist, click ) end end) function click () local playerName = guiGridListGetItemText ( getControl( wndWarp, 'playerlist' ), guiGridListGetSelectedItem ( playerlist ), 1 ) guiSetText ( getControl( wndWarp, 'sharplayer' ), playerName ) end function list() guiGridListClear( getControl( wndWarp, 'playerlist' ) ) for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow( getControl( wndWarp, 'playerlist' ) ) guiGridListSetItemText( getControl( wndWarp, 'playerlist' ), row, 1, getPlayerName(players), false, false) guiGridListSetItemColor ( getControl( wndWarp, 'playerlist' ), row, 1, 0, 250, 154, 255 ) end end addEventHandler("onClientPlayerJoin", getRootElement(), list) addEventHandler("onClientPlayerQuit", getRootElement(), list) addEventHandler("onClientPlayerChangeNick", getRootElement(), list) wndWarp = { 'wnd', text = 'الانتقال الى الاعبين', width = 246, controls = { { 'lst', id='playerlist', width=231, x = 5, y= 62, height=343, columns={ {id='sharplayercol', text='الاعب', attr='name'} }, onitemdoubleclick=warpTo }, {'br'}, {'txt', id='sharplayer', text='~|بحث عن لاعب|~', onclick=click , x = 16, y= 23 ,width = 222}, {'br'}, {'btn', id='انتقال', onclick=warpTo}, {'btn', id='اغلاق', closeswindow=true} }, oncreate = warpInit } جرب + انتظر حتى لو يوم لان الان دراسه ومحد فاضي للمنتدى ^^^ جرب و رد Link to comment
a7zan Posted September 24, 2016 Share Posted September 24, 2016 -__-" ترا الي هنا مو 24 ساعة موجودين عالعموم اكواد البحث مو موجودة Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 اوك شكرا لك بس مازبط Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 (edited) اتمنا الحل الووو اكواد البحث مش رادي تتعمل ده كود الاصلي اتمنا مساعدة ممنكم فيه function warpInit() local players = table.map(getElementsByType('player'), function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end Edited September 24, 2016 by momar5600 Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 (edited) سلام عليكم ورحمة الله وبركاتة الحين كود ده function warpInit() local players = table.map(getElementsByType('player'), function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end يحختلف كثير عن كود بحث عن لاعبي يلي هو ده function putPlayers() guiGridListClear(Online_grid) for i,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(Online_grid) guiGridListSetItemText(Online_grid,row,1,getPlayerName(player),false,false) end end انا حاولت اسوي اشياء كثير مانجحت طيب يشباب وش اسوي اتمنا مساعدتكم في اقرب وقت وشكرا Edited September 24, 2016 by momar5600 Link to comment
</Mr.Tn6eL> Posted September 24, 2016 Share Posted September 24, 2016 addEventHandler("onClientPlayerJoin", getRootElement(), warpInit) addEventHandler("onClientPlayerQuit", getRootElement(), warpInit) addEventHandler("onClientPlayerChangeNick", getRootElement(), warpInit) addEventHandler("onClientGUIChanged", resourceRoot, function() local edit = getControl( wndWarp, 'sharplayer' ) if source == edit then if guiGetText(edit) == "" then warpInit() else local t = { } local text = guiGetText(edit) for k, v in pairs(getElementsByType("player")) do if text:find(getPlayerName(v), 1, true) then table.insert(t, v) end end -- From warpInit local players = table.map(t, function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end end end) wndWarp = { 'wnd', text = 'الانتقال الى الاعبين', width = 246, controls = { { 'lst', id='playerlist', width=231, x = 5, y= 62, height=343, columns={ {id='sharplayercol', text='الاعب', attr='name'} }, onitemdoubleclick=warpTo }, {'br'}, {'txt', id='sharplayer', text='~|بحث عن لاعب|~' , x = 16, y= 23 ,width = 222}, {'br'}, {'btn', id='انتقال', onclick=warpTo}, {'btn', id='اغلاق', closeswindow=true} }, oncreate = warpInit } Link to comment
Abdul KariM Posted September 24, 2016 Share Posted September 24, 2016 ي معلم لاتحسب برمجة الفري روم سهلة رح تعلم وطور من مستواك بالبرمجة لاتنقز بسرعه على الصعب Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 اخويا انا معك في هات كلام بس باقي لي اخر شي اتمنا تساعدني ارجوك واخلص من تعديلي كامل علي فري روم Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 36 minutes ago, </Mr.Tn6eL> said: addEventHandler("onClientPlayerJoin", getRootElement(), warpInit) addEventHandler("onClientPlayerQuit", getRootElement(), warpInit) addEventHandler("onClientPlayerChangeNick", getRootElement(), warpInit) addEventHandler("onClientGUIChanged", resourceRoot, function() local edit = getControl( wndWarp, 'sharplayer' ) if source == edit then if guiGetText(edit) == "" then warpInit() else local t = { } local text = guiGetText(edit) for k, v in pairs(getElementsByType("player")) do if text:find(getPlayerName(v), 1, true) then table.insert(t, v) end end -- From warpInit local players = table.map(t, function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end end end) wndWarp = { 'wnd', text = 'الانتقال الى الاعبين', width = 246, controls = { { 'lst', id='playerlist', width=231, x = 5, y= 62, height=343, columns={ {id='sharplayercol', text='الاعب', attr='name'} }, onitemdoubleclick=warpTo }, {'br'}, {'txt', id='sharplayer', text='~|بحث عن لاعب|~' , x = 16, y= 23 ,width = 222}, {'br'}, {'btn', id='انتقال', onclick=warpTo}, {'btn', id='اغلاق', closeswindow=true} }, oncreate = warpInit } اخويا شكرا لتعبك معي بس في مشكلة كل ماجي اكتب اسمي يختفي كل لاعبين وماظهر اي لاعب Link to comment
</Mr.Tn6eL> Posted September 24, 2016 Share Posted September 24, 2016 هل الديبق يظهر شي؟ Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 (edited) دي بق مافي شي يجي بلون الاصفر وبس سطر يلي بالجدول هنا }, onitemdoubleclick=warpTo }, {'br'}, في قوس يلي بعد warpTo رجا الرد في اقرب وقت وجزاك الله الف خير Edited September 24, 2016 by momar5600 Link to comment
momar5600 Posted September 24, 2016 Author Share Posted September 24, 2016 بيقول دي بق احمر هنا warpInit() ولما اضيف كود ده function warpInit() local players = table.map(getElementsByType('player'), function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end اجي اكتب لاعبين يختفو مفروض اسمي يظهر ليش Link to comment
momar5600 Posted September 25, 2016 Author Share Posted September 25, 2016 ممكن رد ابي حل Link to comment
iMr ~ MnHmAr Posted September 25, 2016 Share Posted September 25, 2016 وش يقول الدي بوق ؟ هات المكتوب في الدي بوق + آطراح الاكواد الي انت حاطه addEventHandler("onClientResourceStart",resourceRoot, function() guiGridListSetSelectionMode( getControl( wndWarp, 'playerlist' ),2) local column = guiGridListAddColumn( getControl( wndWarp, 'playerlist' ), "Player Name", 0.89 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( getControl( wndWarp, 'playerlist' ) ) guiGridListSetItemText ( getControl( wndWarp, 'playerlist' ), row, column, getPlayerName(player), false, false ) guiGridListSetItemColor ( getControl( wndWarp, 'playerlist' ), row, column, 0, 250, 154, 255 ) end addEventHandler ( "onClientGUIClick", playerlist, click ) end end) function click () local playerName = guiGridListGetItemText ( getControl( wndWarp, 'playerlist' ), guiGridListGetSelectedItem ( playerlist ), 1 ) guiSetText ( getControl( wndWarp, 'sharplayer' ), playerName ) end function list() guiGridListClear( getControl( wndWarp, 'playerlist' ) ) for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow( getControl( wndWarp, 'playerlist' ) ) guiGridListSetItemText( getControl( wndWarp, 'playerlist' ), row, 1, getPlayerName(players), false, false) guiGridListSetItemColor ( getControl( wndWarp, 'playerlist' ), row, 1, 0, 250, 154, 255 ) end end addEventHandler("onClientPlayerJoin", getRootElement(), list) addEventHandler("onClientPlayerQuit", getRootElement(), list) addEventHandler("onClientPlayerChangeNick", getRootElement(), list) wndWarp = { 'wnd', text = 'الانتقال الى الاعبين', width = 246, controls = { { 'lst', id='playerlist', width=231, x = 5, y= 62, height=343, columns={ {id='sharplayercol', text='الاعب', attr='name'} }, onitemdoubleclick=warpTo }, {'br'}, {'txt', id='sharplayer', text='~|بحث عن لاعب|~', onclick=click , x = 16, y= 23 ,width = 222}, {'br'}, {'btn', id='انتقال', onclick=warpTo}, {'btn', id='اغلاق', closeswindow=true} }, oncreate = warpInit } جرب + انتظر حتى لو يوم لان الان دراسه ومحد فاضي للمنتدى ^^^ جرب و رد Link to comment
momar5600 Posted September 28, 2016 Author Share Posted September 28, 2016 سلام عليكم ورحمة الله وبركاتة function warpInit() local players = table.map(getElementsByType('player'), function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end addEventHandler("onClientPlayerJoin", getRootElement(), warpInit) addEventHandler("onClientPlayerQuit", getRootElement(), warpInit) addEventHandler("onClientPlayerChangeNick", getRootElement(), warpInit) addEventHandler("onClientGUIChanged", resourceRoot, function() local edit = getControl( wndWarp, 'sharplayer' ) if source == edit then if guiGetText(edit) == "" then warpInit() else local t = { } local text = guiGetText(edit) for k, v in pairs(getElementsByType("player")) do if text:find(getPlayerName(v), 1, true) then table.insert(t, v) end end -- From warpInit local players = table.map(t, function(p) return { player = p, name = getPlayerName(p) } end) table.sort(players, function(a, b) return a.name < b.name end) bindGridListToTable(wndWarp, 'playerlist', players, true) end end end) wndWarp = { 'wnd', text = 'الانتقال الى الاعبين', width = 246, controls = { { 'lst', id='playerlist', width=231, x = 5, y= 62, height=343, columns={ {id='sharplayercol', text='الاعب', attr='name'} }, onitemdoubleclick=warpTo }, {'br'}, {'txt', id='sharplayer', text='~|بحث عن لاعب|~' , x = 16, y= 23 ,width = 222}, {'br'}, {'btn', id='انتقال', onclick=warpTo}, {'btn', id='اغلاق', closeswindow=true} }, oncreate = warpInit } اشكر يلي سوي الكود ده اشكرك جدا بس في مشكلة صغير وهي انه لما تجي مثلا تكتب اسم لاعب يلي تبحث عنه لازم تكتبه كامل يعني مثلا اسمي momar لازم اكتب momar علشان يظهر لو كتبت حرف m مايظهر اتمنا بس تسوي بالكود حفك انه لما تتب الحرف m يجيب لك كل اسماء يلي بدايتها m وشكرا Link to comment
</Mr.Tn6eL> Posted September 28, 2016 Share Posted September 28, 2016 استبدل السطر 19 بالتالي if getPlayerName(v):find(text, 1, true) then Link to comment
momar5600 Posted September 29, 2016 Author Share Posted September 29, 2016 في اخر مشكلة وشكرا لك جدا جدا لو كتبت اسمي كابتل مش بيظهر لازم اكتبه سمول او لو كان اسمي كابتل لازم اكتبة سمول بدي حل لها Link to comment
iMr ~ MnHmAr Posted September 29, 2016 Share Posted September 29, 2016 string.lower راح تحتاجها واذا تبي مثال لها هذا مثال test1 = string.lower("MOMER") momer -- راح يطلع Link to comment
momar5600 Posted September 30, 2016 Author Share Posted September 30, 2016 19 hours ago, iMr ~ MnHmAr said: string.lower راح تحتاجها واذا تبي مثال لها هذا مثال test1 = string.lower("MOMER") momer -- راح يطلع شكرا لك نجحت if string.find ( string.upper ( getPlayerName ( v ):gsub ( '#%x%x%x%x%x%x', '' ) ),string.upper (text, 1, true) ) then Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now