Jump to content

All Players In Team


Zalmon

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...