Jump to content

help staffchat


Recommended Posts

 

How can I make this resource like the globalchat? I mean that by touching a key I can open the chat and send the text, so I do not have to type a command / u [text]

function ADMINCHAT ( thePlayer, cmd, ... )
local accountname = getAccountName(getPlayerAccount(thePlayer))
 if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ))  then
message = table.concat({...}," ")
outputChatBox ("#5594FF[CHAT]-#FE5757"..getPlayerName(thePlayer)..":  #FFFFFF"..message.."",getRootElement(thePlayer),255,255,255, true)
end
end
addCommandHandler ( "u", ADMINCHAT )

 

Link to comment
addEventHandler("onResourceStart", resourceRoot, function() 
    for _, v in ipairs(getElementsByType("player")) do
      bindKey(v, "down" , ADMINCHAT) 
      end
end) 

addEventHandler("onPlayerJoin", root, function () 
    bindKey(source, "down", ADMINCHAT) 
end) 

 

Edited by Dimos7
Link to comment
5 hours ago, Dimos7 said:

addEventHandler("onResourceStart", resourceRoot, function() 
    for _, v in ipairs(getElementsByType("player")) do
      bindKey(v, "down" , ADMINCHAT) 
      end
end) 

addEventHandler("onPlayerJoin", root, function () 
    bindKey(source, "down", ADMINCHAT) 
end) 

 

And the key ? o.Oo.O

bindKey ( player thePlayer, string key, string keyState, function handlerFunction,  [ var arguments, ... ] )
Link to comment
addEventHandler("onResourceStart", resourceRoot, function() 
    for _, v in ipairs(getElementsByType("player")) do
      bindKey(v, "j" , "down" , ADMINCHAT) -- change j with key you want
      end
end) 

addEventHandler("onPlayerJoin", root, function () 
    bindKey(source,"j" , "down", ADMINCHAT) -- change j with key you want 
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...