Tony Brand Posted October 15, 2018 Share Posted October 15, 2018 (edited) hi this is my code that prints player that have a elementdata for index,player in ipairs(getElementsByType("player") ) do if getElementData(player,"Money") == 10000 then local name = getPlayerName(player) outputChatBox(" "..name.." ",player) end end but as you it will use a single outputChatBox for each one, For Example result can be: Player1 Player2 Player3 ... PlayerN how to show all of them in one or few lines? like this ==> Player1, Player2, Player3, ..., PlayerN Edited October 15, 2018 by Tony Brand Link to comment
SaNoR Posted October 16, 2018 Share Posted October 16, 2018 function func() local text = "" for index, player in ipairs(getElementsByType("player")) do if getElementData(player,"Money") == 10000 then local len = string.len(text) local name = getPlayerName(player) if len == 0 then text = name elseif len > 0 and len <= 256 then if (len + string.len(tostring(", "..name))) > 256 then outputChatBox(text, player) text = name else text = text..", "..name end end end end if string.len(text) > 0 then outputChatBox(text, player) end end 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