Jump to content

[help] PrivateChat Admin


Recommended Posts

Works as an administrator to enter / chatadmin one mensgem appears that only admins can see

function adminchat(thePlayer, ...) 
  
    local word = {...} 
    local message = table.concat(word, " ") 
    
    local account = getPlayerAccount ( thePlayer ) 
    for _, group in ipairs ( { "Admin", "Moderator", "SuperModerator" } ) do   
    if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup (group) )   then 
        outputChatBox (  "#FF0000[Admin Chat]" .. getPlayerName ( thePlayer ) .. ": " .. message, getRootElement(), 255, 255, 255, true ) 
    else 
exports["Evo-notificaciones"]:showBox ( thePlayer, "error", " "..getPlayerName(thePlayer).."Acceso Denegado.") 
    end 
end 
end 
 addCommandHandler("adminchat", adminchat) 

But all the server are seeing this message What do wrong? What do I see across to admins only?

sorry my bad english I'm Brazilian

Link to comment

Try this:

function adminchat(thePlayer, command, ...) 
    local account = getPlayerAccount ( thePlayer ) 
    local access = false 
    for _, group in ipairs ( { "Admin", "Moderator", "SuperModerator" } ) do   
        if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup (group) )   then 
            access = true 
        end 
    end 
    if not access then  
        exports["Evo-notificaciones"]:showBox ( thePlayer, "error", " "..getPlayerName(thePlayer).."Acceso Denegado.") 
        return 
    end  
     
    local word = {...} 
    local message = table.concat(word, " ") 
    for i, v in ipairs ( getElementsByType ( "player" ) ) do 
        account = getPlayerAccount ( v ) 
        access = false 
        for _, group in ipairs ( { "Admin", "Moderator", "SuperModerator" } ) do   
            if isObjectInACLGroup ( "user." .. getAccountName(account), aclGetGroup (group) )   then 
                access = true 
            end 
        end 
        if access then 
            outputChatBox (  "#FF0000[Admin Chat]" .. getPlayerName ( thePlayer ) .. ": " .. message, v, 255, 255, 255, true ) 
        end 
    end 
end 
addCommandHandler("adminchat", adminchat) 
  

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