Jump to content

[Help]Anti-Spam[Solved]


Ridwan RF

Recommended Posts

Hello guys,

It's me your pupil,

Im here to ask some help on my script that I made for auto-muting players when they are flooding chat,

the problem is when I flood the chat, yes I did get "You're now muted for 2 mins reason (Flooding)" on the outputchatbox, but I didnt get muted :( here's pic,

yb5fW4TZrv_mta-screen_2014-03-19_21-29-36.png

and here's script

antiSpam = {}  
function antiChatSpam()  
    if isTimer(antiSpam[source]) then 
        cancelEvent()   
        outputChatBox("#ffffff"..getPlayerName(source).." #ff0000has been muted 2 mins Reason:[Flooding/Spamming] !", getRootElement(), 255, 255, 0,true)  
        setPlayerMuted(source, true) 
        setTimer ( autoUnmute, 120000, 1, source) 
    else 
        antiSpam[source] = setTimer(function(source) antiSpam[source] = nil end, 1000, 1, source)  
    end 
end 
addEventHandler("onPlayerChat", root, antiChatSpam) 
  
  
function autoUnmute ( player ) 
    if ( isElement ( player ) and isPlayerMuted ( player ) ) then 
        setPlayerMuted ( player, false ) 
        outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #bbfa00has been unmute by Console! Dont Try It #f5f5f5[Again]",getRootElement(), 255, 255, 0,true ) 
    end 
end 

Thanks for reading, I hope it can be solved.

Edited by Guest
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...