Jump to content

DXScoreboard Admin and Players


Admigo

Recommended Posts

Thanks guys,Now i have 2 colums with players and admins. But if i login or join the game i am not in both of them.

Code:

function createTeamsOnStart () 
    teamAdmin = createTeam ( "Admins", 0, 255, 0 ) --change the 3 numbers(0,255,0), the first number is ColourR, the second is ColourG, and the last one is ColourB 
    teamPlayers = createTeam ( "Players", 200, 0, 100 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) --we attach the function to this resource's root element 
addEventHandler("onPlayerLogin", root, 
  function() 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then 
             
            setPlayerTeam ( theplayer, Admins ) 
    end 
end 
) 

Pls help.

Link to comment

try this

local teamAdmin 
local teamPlayers   
function createTeamsOnStart () 
    teamAdmin = createTeam ( "Admins", 0, 255, 0 ) --change the 3 numbers(0,255,0), the first number is ColourR, the second is ColourG, and the last one is ColourB 
    teamPlayers = createTeam ( "Players", 200, 0, 100 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) --we attach the function to this resource's root element 
  
  function setteam(player) 
     local account = getPlayerAccount(player) 
      if not account or isGuestAccount(account) then 
      setPlayerTeam ( player,  teamPlayers   )    
       return end 
    local accName = getAccountName ( account) 
    if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then 
            
            setPlayerTeam ( player, teamAdmin) 
         else        
             setPlayerTeam ( player,  teamPlayers   )    
    end 
end 
  
function timer() 
setTimer(setteam,3000,1,source) 
end 
addEventHandler("onPlayerLogin",getRootElement(),timer) 
addEventHandler("onPlayerJoin",getRootElement(),timer) 
  

Edited by Guest
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...