Zalmon Posted July 2, 2011 Share Posted July 2, 2011 Would this work? If not, how do I fix it? local players = getElementsByType ( "player" ) for i, player in ipairs( getElementsByType ( players ) ) if (getPlayerTeam(players) == "Criminals") then outputChatBox ( "I wanna say something only to this team", 255, 0, 0,players) I'm trying to get all the players in the team "criminals" and only tell the message to them. Link to comment
Castillo Posted July 2, 2011 Share Posted July 2, 2011 (edited) for i,v in pairs(getPlayersInTeam(getTeamFromName("Criminals"))) do outputChatBox("Hello pals",v,255,0,0) end Edited July 2, 2011 by Guest Link to comment
Jockie Posted July 2, 2011 Share Posted July 2, 2011 You forgot an "end" and you use tables instead of player elements. local players = getElementsByType ( "player" ) for i, player in ipairs( getElementsByType ( players ) ) if (getPlayerTeam(player) == "Criminals") then outputChatBox ( "I wanna say something only to this team", 255, 0, 0,player) end end EDIT: pairs(getPlayersInTeam(getTeamFromName("Criminals")) works as well, like SolidSnake just posted before me. Grtz. Jockie Link to comment
Zalmon Posted July 2, 2011 Author Share Posted July 2, 2011 Solidsnake14 said: for i,v in pairs(getPlayersInTeam(getTeamFromName("Criminals")) do outputChatBox("Hello pals",v,255,0,0) end Thanks bro Link to comment
Zalmon Posted July 2, 2011 Author Share Posted July 2, 2011 got error while loading says ) expected near do Link to comment
Zalmon Posted July 2, 2011 Author Share Posted July 2, 2011 nvm lol I feel dumb, thats the easiest error to fix ever. Link to comment
Castillo Posted July 2, 2011 Share Posted July 2, 2011 Oh, my bad, I corrected my mistake, sorry for the inconvenience. Link to comment
Zalmon Posted July 2, 2011 Author Share Posted July 2, 2011 It's okay, it was a very easy mistake to fix, I didn't realize the error until I posted it. Link to comment
r57` Posted July 6, 2011 Share Posted July 6, 2011 for i,v in pairs(getPlayersInTeam(getTeamFromName("Criminals")) do outputChatBox("Hello pals",v,255,0,0) end Valid... Link to comment
JR10 Posted July 6, 2011 Share Posted July 6, 2011 The problem is already solved, and that's the same code that castillo posted. Link to comment
Castillo Posted July 6, 2011 Share Posted July 6, 2011 JR10, even wrong, because I had a missing ')' and I fixed it, but seems like he copied a old code. 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