abu5lf Posted April 6, 2012 Posted April 6, 2012 (edited) function onClientGUIChanged() local name = guiGetText(source) for index, player in pairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), name:lower()) then local column = guiGridListAddColumn ( playerlist, "Player Name", 1.50 ) if ( column ) then for id, playeritem in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerlist ) guiGridListSetItemText ( playerlist, row, column, getPlayerName( playeritem ), false, false ) end end end end end addEventHandler("onClientGUIChanged", bhsh, onClientGUIChanged) This edit does not work correctly, so finds a player Edited December 25, 2012 by Guest ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
X-SHADOW Posted April 6, 2012 Posted April 6, 2012 why you use getElementsByType 2 times ? function onClientGUIChanged() local name = guiGetText(source) if string.find(getPlayerName(player):lower(), name:lower()) then local column = guiGridListAddColumn ( playerlist, "Player Name", 1.50 ) if ( column ) then for id, playeritem in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerlist ) guiGridListSetItemText ( playerlist, row, column, getPlayerName( playeritem ), false, false ) end end end end addEventHandler("onClientGUIChanged", bhsh, onClientGUIChanged) My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
abu5lf Posted April 6, 2012 Author Posted April 6, 2012 why you use getElementsByType 2 times ? function onClientGUIChanged() local name = guiGetText(source) if string.find(getPlayerName(player):lower(), name:lower()) then local column = guiGridListAddColumn ( playerlist, "Player Name", 1.50 ) if ( column ) then for id, playeritem in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerlist ) guiGridListSetItemText ( playerlist, row, column, getPlayerName( playeritem ), false, false ) end end end end addEventHandler("onClientGUIChanged", bhsh, onClientGUIChanged) Code does not work ^ The script works, but only if my right to search for the player repeats in Grid List ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
X-SHADOW Posted April 6, 2012 Posted April 6, 2012 show your full code . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
abu5lf Posted April 6, 2012 Author Posted April 6, 2012 show your full code . Well,There are those who can help without full Code Show ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
drk Posted April 6, 2012 Posted April 6, 2012 local column = guiGridListAddColumn ( playerlist, 'Player Name', 1.50 ) addEventHandler ( 'onClientGUIChanged', root, function ( ) if ( source == bhsh ) then guiGridListClear ( playerlist ); local sName = guiGetText ( source ); if ( sName ~= "" ) then for _, pPlayer in ipairs ( getElementsByType 'player' ) do if ( string.find ( getPlayerName ( pPlayer ):lower ( ), sName:lower ( ), 1, true ) then local row = guiGridListAddRow ( playerlist ); guiGridListSetItemText ( playerlist, row, column, getPlayerName ( pPlayer ), false, false ); end end end end end ) EPT Team Server Development: 0% Learning C++ | C++ is amazing
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