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!

nJgL8wr.png

I DON'T HAVE HATERS, I JUST HAVE FANS IN DENIAL

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) 

Sometimes I dream about cheese

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 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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