Jump to content

mute player (global chat)


Recommended Posts

Hey, i have this script that mutes all players in main chat (T) but not in (Y)

Does anyone know how i can make it so i can mute only one player? instead of all.

Like /chatoff instead of muting all players in server.

local chat = true 
  
function chatDis(thePlayer) 
   local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
    outputChatBox("#ff0000Main chat has been disabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true) 
    chat = false 
   end     
end 
addCommandHandler("chatoff", chatDis) 
  
function chatEn(thePlayer) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        outputChatBox("#ff0000Main chat has been enabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true) 
        chat = true 
    end 
end 
addCommandHandler("chaton", chatEn) 
  
function onChat ( _, messageType ) 
    if ( messageType == 0 and not chat ) then 
        cancelEvent ( ) 
    end 
end 
addEventHandler ( "onPlayerChat", root, onChat ) 
  

Link to comment

Try this

local chat = true 
  
function chatDis(thePlayer) 
   local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
    outputChatBox("#ff0000Main chat has been disabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true) 
    chat = false 
   end     
end 
addCommandHandler("chatoff", chatDis) 
  
function chatEn(thePlayer) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        outputChatBox("#ff0000Main chat has been enabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true) 
        chat = true 
    end 
end 
addCommandHandler("chaton", chatEn) 
  
function onChat ( _, messageType ) 
    if ( messageType == 0 and not chat ) then 
        cancelEvent ( ) 
    end 
end 
addEventHandler ( "onPlayerChat", root, onChat ) 
  

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