Jump to content

Admin Chat


Sasu

Recommended Posts

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("ga", adminchat)  

Hola. Bueno el error con mi script es que el admin chat se los muestra a los players y yo quiero que solo lo vean los admins. El color hex se muestra como esta y el else no funciona porque tambien se los manda a los admins. Me pueden ayudar?

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

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

Despues lo pruebo porque ahora no puedo. Muchas gracias igual Solid.

OFF-Topic: Muy buen feliz cumpleaños Solid. Espero que la hayas pasado bien este dia :D

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...