Jump to content

Teams


mint3d

Recommended Posts

Posted

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;  
  

Posted

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; 
  

Posted

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 

Posted

What do you mean by tab? do you mean scoreboard?

You want create team??

createTeam 

Or explain yourself in better way, i can't get a shit.

Posted

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

Posted

but what acl group should i add them? Everyone

Basically all i wanted was it so when i start the resource i will look at scoreboard and i can see the teams i want Like Admin Armed Forces Swat Police Criminal stuff like that

Posted

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.

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