Jump to content

All Players In Team


Zalmon

Recommended Posts

Posted

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.

Posted (edited)
for i,v in pairs(getPlayersInTeam(getTeamFromName("Criminals"))) do 
outputChatBox("Hello pals",v,255,0,0) 
end 

Edited by Guest
Posted

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

Posted
for i,v in pairs(getPlayersInTeam(getTeamFromName("Criminals")) do 
outputChatBox("Hello pals",v,255,0,0) 
end 

Thanks bro :salute:

Posted

for i,v in pairs(getPlayersInTeam(getTeamFromName("Criminals")) do 
outputChatBox("Hello pals",v,255,0,0) 
end 

Valid...

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...