Jump to content

ACL in scoreboard


Toffbrown

Recommended Posts

Posted

is it possible to show a players acl group in the scoreboard say like if the player was in Army it would say army in the tab scoreboard? if so what functions to use?

cheers!

Posted

Yes, here it is:

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","ACL") 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, function() 
setElementData(source,"ACL","None") 
end) 
  
addEventHandler ( "onPlayerLogin", root, function( _, acc) 
if isObjectInACLGroup ( "user." ..acc, aclGetGroup ( "Army" ) ) then 
setElementData(source,"ACL","Army") 
elseif isObjectInACLGroup ( "user." ..acc, aclGetGroup ( "Admin" ) ) then 
setElementData(source,"ACL","Admin") 
end 
end) 

Posted
Yes, here it is:
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","ACL") 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, function() 
setElementData(source,"ACL","None") 
end) 
  
addEventHandler ( "onPlayerLogin", root, function( _, acc) 
if isObjectInACLGroup ( "user." ..acc, aclGetGroup ( "Army" ) ) then 
setElementData(source,"ACL","Army") 
elseif isObjectInACLGroup ( "user." ..acc, aclGetGroup ( "Admin" ) ) then 
setElementData(source,"ACL","Admin") 
end 
end) 

"acc" is an account element there, so it'll always return false.

This should work:

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        call ( getResourceFromName ( "scoreboard" ), "addScoreboardColumn", "ACL" ) 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        setElementData ( source, "ACL", "None" ) 
    end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
    function ( _, acc ) 
        local accountName = getAccountName ( acc ) 
        if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Army" ) ) then 
            setElementData ( source, "ACL", "Army" ) 
        elseif isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) then 
            setElementData ( source, "ACL", "Admin" ) 
        end 
    end 
) 

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