Sign in to follow this  
Bcload

help

Recommended Posts

i've made script to disable the main chat but i'm tired to fix it i was trying many times to fix it, anyone know where is the problem?

Spoiler
  1. local chat = true
  2.  
  3. function chatDis(thePlayer)
  4.    local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
  5.    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
  6.     outputChatBox("#ff0000Main chat has been disabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true)
  7.     chat = false
  8.    end    
  9. end
  10. addCommandHandler("chatoff", chatDis)
  11.  
  12. function chatEn(thePlayer)
  13.     local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
  14.     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
  15.         outputChatBox("#ff0000Main chat has been enabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true)
  16.         chat = true
  17.     end
  18. end
  19. addCommandHandler("chaton", chatEn)
  20.  
  21. function onChat ( _, messageType )
  22.     if ( messageType == 0 and not chat ) then
  23.         cancelEvent ( )
  24.     end
  25. end
  26. addEventHandler ( "onPlayerChat", root, onChat )
  27.  

 

Share this post


Link to post

function onChat ( _, messageType )

    if ( messageType == 0 and chat == false ) then

        cancelEvent ( )

    end

end

addEventHandler ( "onPlayerChat", root, onChat )

Share this post


Link to post

Capture.png

Share this post


Link to post
5 minutes ago, Bcload said:

Capture.png

This function is for serverside

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.