Dolinho Posted March 10, 2015 Posted March 10, 2015 if I use that goes for all of the specific team for _,v in ipairs (getPlayersInTeam (getTeamFromName("Novo Jogador do BMV"))) do outputChatBox ( "Ola novo jogador", v ,0,255,0,true) how will I do for getElementData ? for _,v in ipairs (getElementData("Red")) do outputChatBox ( "Ola novo jogador", v ,0,255,0,true) ?????????????? If a player has Element Red so he would receive a msg
Tekken Posted March 10, 2015 Posted March 10, 2015 function theCheck() for _,v in ipairs (getElementsByType("player")) do if getElementData(v,"Red") then outputChatBox ( "Ola novo jogador", v ,0,255,0,true) end end end
-.Paradox.- Posted March 10, 2015 Posted March 10, 2015 ? local players = getElementsByType('player') for index, p in ipairs(players) do if getElementData(p, 'Red') ~= nil then --Your message here end end
Dolinho Posted March 10, 2015 Author Posted March 10, 2015 I tested with a friend, but this msg appearing for everyone and not only for those who mind this in the group
-.Paradox.- Posted March 10, 2015 Posted March 10, 2015 (edited) My bad, I was connected from my mobile, Try this for i, v in ipairs((getElementData(getElementsByType('player'), 'Red')) ~= nil) do --Your message here end Edited April 4, 2015 by Guest
Moderators IIYAMA Posted March 10, 2015 Moderators Posted March 10, 2015 lol, your previously code was better. Yet, mihayy5 his code is still the best solution, since getElementData only returns nil when the code fails, otherwise false. @Dolinho Make sure you only send the message to the correct player. Which you can set up in the outputChatBox function.
-.Paradox.- Posted March 10, 2015 Posted March 10, 2015 function getPlayersByElementData(theData) local tableResult = {} for i, v in ipairs(getElementsByType("player")) do if getElementData(v, theData) then table.insert(tableResult, v) end end return tableResult end Example for i, v in ipairs(getPlayersByElementData("Red")) do outputChatBox("lol msg", v, 0, 255, 0) end
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