Jump to content

how to...


Sparrow

Recommended Posts

this is it:

function adminChat(thePlayer,_,...) 
    local text = table.concat({...}, "") 
    local name = getPlayerName(thePlayer) 
    local accName = getAccountName (getPlayerAccount (thePlayer)) 
    if (isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then 
        outputChatBox ("#FF0000(Admin Chat) "..name..": #FFFFFF"..text, getRootElement(), 255, 255, 255, true) 
    end 
end 
addCommandHandler("ac", adminChat) 

Link to comment
function adminChat(thePlayer,_,...) 
    local text = table.concat({...}, " ") 
    local name = getPlayerName(thePlayer) 
    local accName = getAccountName (getPlayerAccount (thePlayer)) 
    if ( isObjectInACLGroup ("user.".. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then 
        for index, player in ipairs(getElementsByType("player")) do 
            local accName = getAccountName (getPlayerAccount (player)) 
            if ( isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then 
                outputChatBox ("#FF0000(Admin Chat) "..tostring(name)..": #FFFFFF"..tostring(text), player, 255, 255, 255, true) 
            end 
        end 
    end 
end 
addCommandHandler("ac", adminChat) 

Link to comment

Try

function adminChat( thePlayer,_,... ) 
    local text = table.concat( {...}, "" ) 
    local name = getPlayerName( thePlayer ) 
    for _,v in pairs( getPlayersInGroup( accName ) ) do 
         outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("ac", adminChat) 
  
function getPlayersInGroup( accName ) 
    local Table = { } 
    for _,v in pairs( getElementsByType( "player" ) ) do 
        local accName =  getAccountName ( getPlayerAccount ( v ) ) 
        if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "SuperModerator" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "Moderator" ) ) then 
                table.insert( Table,v )     
        end 
    end 
    return Table 
end 

Code updated recheck it

Link to comment

True, use this:

function adminChat( thePlayer,_,... ) 
    local text = table.concat( {...}, " " ) 
    local name = getPlayerName( thePlayer ) 
    for _,v in pairs( getPlayersInGroup( accName ) ) do 
         outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("ac", adminChat) 
  
function getPlayersInGroup( accName ) 
    local Table = { } 
    for _,v in pairs( getElementsByType( "player" ) ) do 
        local accName =  getAccountName ( getPlayerAccount ( v ) ) 
        if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "SuperModerator" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "Moderator" ) ) then 
                table.insert( Table,v )     
        end 
    end 
    return Table 
end 

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