TorNix~|nR Posted March 21, 2019 Share Posted March 21, 2019 (edited) hello guys, please I'm wondering why isn't this working for index,thisPlayer in pairs(getElementsByType("player") or getElementsByType("ped")) do nothing found on debug, but only ped works but player not help please? Edited March 21, 2019 by TorNix~|nR Link to comment
Moderators IIYAMA Posted March 21, 2019 Moderators Share Posted March 21, 2019 @TorNix~|nR That is not how this works. A table is a thing, it is something even if it is empty. if {} then outputChatBox("Always true") end local players = getElementsByType("player") for index,thisPlayer in pairs(#players > 0 and players or getElementsByType("ped")) do Note, this does not merge the tables. Just uses peds when there are no players. 1 Link to comment
Hugos Posted June 27, 2019 Share Posted June 27, 2019 On 22/03/2019 at 01:39, IIYAMA said: @TorNix~|nR That is not how this works. A table is a thing, it is something even if it is empty. if {} then outputChatBox("Always true") end local players = getElementsByType("player") for index,thisPlayer in pairs(#players > 0 and players or getElementsByType("ped")) do Note, this does not merge the tables. Just uses peds when there are no players. I have "edixBox" from which I get the result (variable - result), how to check if there is such a player on the server (with the same name)? Link to comment
SycroX Posted June 27, 2019 Share Posted June 27, 2019 (edited) 37 minutes ago, Hugos said: I have "edixBox" from which I get the result (variable - result), how to check if there is such a player on the server (with the same name)? addEventHandler ( "onClientGUIChanged" , guiRoot , function ( ) if source == yourEditBox then local Name = guiGetText ( source ) if Name and Name ~= "" then for _ , Player in pairs( getElementsByType ( "player" ) ) do if getPlayerName ( Player ):lower ( ):find ( Name:lower ( ) , 1 , true) then outputChatBox ( "Player Exists" , 255 , 255 , 255 , true ) break end end end end end ) Edit : forget ( break ) Edited June 27, 2019 by #x1AhMeD-09 1 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