TorNix~|nR Posted March 21, 2019 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 ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Moderators IIYAMA Posted March 21, 2019 Moderators 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 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
TorNix~|nR Posted March 21, 2019 Author Posted March 21, 2019 Thank you! 1 ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Hugos Posted June 27, 2019 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)? Говорю на русском. Sorry for bad english.
SycroX Posted June 27, 2019 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 Chillin' with some demons, satans and vamps
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