Jump to content

Problems with binding Adminchat


PrivateKiller

Recommended Posts

Hey guys! I'm trying to bind adminchat, which is included in admin panel(default one). So, i can't find where is that script saved, because I want to add:

addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"m","down","chatbox","ADMINCHAT") --I don't know the right name of Admin chatbox 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"m","down","chatbox","ADMINCHAT") --I don't know the right name of Admin chatbox 
  end 
end) 
  

But that will bind for all players in my server... How can I set that, will bind only players who is in acl group "Admin"?

I just want to bind existing AdminChat, because currently, we can only talk through Admin panel... HELP. I need to know where is the script (adminchat) and how to bind only for specified acl group. Thanks

Link to comment

Not working :(. Bind still won't work. I also tryed to recconect, i restarted the resource,.. everything! Can some1 look at the code and tell me what's wrong? Mabye I should add addCommandHandler("aAdminChat",nofunction)?

addEvent ( "aAdminChat", true ) 
addEventHandler ( "aAdminChat", _root, function ( chat ) 
    if checkClient( true, source, 'aAdminChat' ) then return end 
    for id, player in ipairs(getElementsByType("player")) do 
        if ( aPlayers[player]["chat"] ) then 
            triggerClientEvent ( player, "aClientAdminChat", source, chat ) 
        end 
    end 
end ) 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"m","down","chatbox","aAdminChat")  
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"m","down","chatbox","aAdminChat") 
  end 
end) 

Link to comment

try this

function adminchat(thePlayer, theCMD, ...) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 
            local allArgs = {...} 
            local mesajul = table.concat(allArgs, " ") 
    for i,v in ipairs(getElementsByType("player")) do 
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then 
        outputChatBox("#E6FF00 "..getPlayerName(thePlayer)..": #FFFFFF"..tostring(mesajul), v, 255, 255, 255,  true) 
        end 
    end 
    end 
end 
addCommandHandler("a", adminchat, false) 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
        for index,player in pairs(getElementsByType("player")) do 
            bindKey(player,"h", "down", "chatbox", "a"); 
        end 
    end) 
    addEventHandler("onPlayerJoin", getRootElement(), 
   function() 
     bindKey(source, "m", "down", "chatbox", "a"); -- bind key  
   end 
   ) 

Link to comment
try this
function adminchat(thePlayer, theCMD, ...) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 
            local allArgs = {...} 
            local mesajul = table.concat(allArgs, " ") 
    for i,v in ipairs(getElementsByType("player")) do 
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then 
        outputChatBox("#E6FF00 "..getPlayerName(thePlayer)..": #FFFFFF"..tostring(mesajul), v, 255, 255, 255,  true) 
        end 
    end 
    end 
end 
addCommandHandler("a", adminchat, false) 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
        for index,player in pairs(getElementsByType("player")) do 
            bindKey(player,"h", "down", "chatbox", "a"); 
        end 
    end) 
    addEventHandler("onPlayerJoin", getRootElement(), 
   function() 
     bindKey(source, "m", "down", "chatbox", "a"); -- bind key  
   end 
   ) 

Ye, CommandHandler and Evend Handler... That's what I forgot. I already writed some scripts but, where did you find function "h"? You didn't created it...? (15. line):

bindKey(player,"h", "down", "chatbox", "a"); 

Link to comment

soryy..., forgot to delete my bind :D

function adminchat(thePlayer, theCMD, ...) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 
            local allArgs = {...} 
            local mesajul = table.concat(allArgs, " ") 
    for i,v in ipairs(getElementsByType("player")) do 
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then 
        outputChatBox("#E6FF00 "..getPlayerName(thePlayer)..": #FFFFFF"..tostring(mesajul), v, 255, 255, 255,  true) 
        end 
    end 
    end 
end 
addCommandHandler("a", adminchat, false) 
addEventHandler("onPlayerJoin", getRootElement(), 
function() 
  bindKey(source, "m", "down", "chatbox", "a"); -- bind key 
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...