Jump to content

[Help] Use Of getPlayersInTeam


Ranous

Recommended Posts

Hi Guys,

I'm doing the clan panel but i don't know the use of the required functions. I tried to do, i've failed.

İt's debug message of the script:

UPEcm3C.png

Code:

clanGrid = guiCreateGridList (5,8,392,228,false,clanTab) 
  usernamePlayer = guiGridListAddColumn( clanGrid, "Username", 0.2 ) 
  for id,players in ipairs(getPlayersInTeam(getPlayerTeam(getLocalPlayer())))  do 
    local playerTeam = guiGridListAddRow ( clanGrid ) 
    guiGridListSetItemText ( clanGrid, playerTeam, usernamePlayer, getPlayerName ( players ), false, false ) 
  end 

Link to comment
It appears that the localPlayer isn't in a team since getPlayerTeam returns false

throw a

if (getPlayerTeam(getLocalPlayer())) then 

around it

It actually returns nil if I'm right and not false.

  
clanGrid = guiCreateGridList (5,8,392,228,false,clanTab) 
usernamePlayer = guiGridListAddColumn( clanGrid, "Username", 0.2 ) 
  
if getPlayerTeam( localPlayer ) then 
    local team = getPlayerTeam( localPlayer ) 
    for id,players in ipairs(getPlayersInTeam( team )) do 
        local playerTeam = guiGridListAddRow ( clanGrid ) 
        guiGridListSetItemText ( clanGrid, playerTeam, 1, getPlayerName ( players ), false, false ) 
    end 
end 
  

maybe this should work

Link to comment
It appears that the localPlayer isn't in a team since getPlayerTeam returns false

throw a

if (getPlayerTeam(getLocalPlayer())) then 

around it

It actually returns nil if I'm right and not false.

  
clanGrid = guiCreateGridList (5,8,392,228,false,clanTab) 
usernamePlayer = guiGridListAddColumn( clanGrid, "Username", 0.2 ) 
  
if getPlayerTeam( localPlayer ) then 
    local team = getPlayerTeam( localPlayer ) 
    for id,players in ipairs(getPlayersInTeam( team )) do 
        local playerTeam = guiGridListAddRow ( clanGrid ) 
        guiGridListSetItemText ( clanGrid, playerTeam, 1, getPlayerName ( players ), false, false ) 
    end 
end 
  

maybe this should work

Returns

Returns a team element representing the team the player is on, false if the player is not part of a team.

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