Jump to content

Bindkey


luck.

Recommended Posts

hello

I have an admin that works with chat / ac text, what I want to do is open the chatbox with bindkey, any idea? code:

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( #ffffffAdmin Chat #ff0000)#FFFFFF " .. getPlayerName ( thePlayer ) .. "#ffffff: " .. message, v, 255, 255, 255, true ) 
                    end 
    end 
end 
addCommandHandler ( "ac", adminchat ) 

Link to comment
Server side bindKey requires a player element, bind it when you join, and when resource starts for all players.

There fore, you can make the bind on the Client side, and trigger a server event, or you can make a loop to bind the key when the resource starts (If you use this method, make sure to bind the key onPlayerJoin also.)

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