Jump to content

Teams


mint3d

Recommended Posts

You can use this function to get all the teams created.

getElementsByType ("team", getRootElement ());  

Then, iterate over the table and do whatever.

You can also use the next function to get the team name.

getTeamName(theTeam) 

for example,

  
local teams = getElementsByType ("team", getRootElement ());  
for _, theTeam in ipairs (teams) do  
      local teamName = getTeamName (theTeam); 
     -- do whatever, for example, create a new tab in a tabpanel. 
      guiCreateTab (teamName, theTabPanel);  
end;  
  

Link to comment

I tired this and it didn't work

  
local teams = getElementsByType ("Admins", getRootElement ()); 
for _, theTeam in ipairs (teams) do 
      local teamName = getTeamName (theTeam); 
     -- do whatever, for example, create a new tab in a tabpanel. 
      guiCreateTab (teamName, theTabPanel); 
end; 
  

Link to comment

you can´t do

local teams = getElementsByType ("Admins", getRootElement ());  

that will return an empty list.

you need to do this....

local teams = getElementsByType ("team", getRootElement ()); 

with this you will get a list of teams.

please, read the information about the function getElementsByType to know what parameters need.

getElementsByType 

Link to comment

Serverside:

function TEAM () 
    theTeam2 = createTeam ( "HERE PUT YOUR TEAM NAME", 0, 0, 0 ) 
end 
addEventHandler("onResourceStart", resourceRoot, TEAM) 
  
function SETACL() 
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("ANY ACL GROUP")) then 
outputChatBox ( " You are in ACL " ) 
end 
end 
addEventHandler("onPlayerLogin",getRootElement(),SETACL) 
addEventHandler("onPlayerSpawn",getRootElement(),SETACL) 
  

Don't forget to edit aclGetGroup

Link to comment

ACL for what? teams has nothing to do with ACL.

-- Name, Color ( R, G, B ) 
local teams = 
    { 
        { "Admin", 255, 0, 0 }, 
        { "Armed Forces", 0, 200, 0 } 
    } 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, team in ipairs ( teams ) do 
            createTeam ( unpack ( team ) ) 
        end 
    end 
) 

With this simple script, you can add as much teams as you want.

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