Laysiks Posted March 3, 2015 Posted March 3, 2015 Hello! Have someone code where chat is blocking for 5 sec when player "spam" ? I'm waiting for some help or code.
Castillo Posted March 3, 2015 Posted March 3, 2015 https://community.multitheftauto.com/in ... ils&id=202
Laysiks Posted March 3, 2015 Author Posted March 3, 2015 Can some one help me ? I have this but this itsnt working.It's shows on chat outputChatBox and my message. addEventHandler("onPlayerChat",root,function () if getElementData(source,"blokadaspam") then cancelEvent() outputChatBox("Poczekaj na następną wiadomość",source,255,255,255,true) else setElementData(source,"blokadaspam",true) setTimer(function () setElementData(source,"blokadaspam", false) end,5000,1) end end)
xXMADEXx Posted March 4, 2015 Posted March 4, 2015 Try using this (Not Tested) local spammers = { } addEventHandler ( "onPlayerChat", root, function ( ) if ( spammers [ source ] and spammers [ source ] > getTickCount ( ) ) then outputChatBox ( "Poczekaj na następną wiadomość", source, 255, 255, 255 ) cancelEvent ( ) return end spammers [ source ] = getTickCount ( ) + 5000 end )
Dimmitry007 Posted March 4, 2015 Posted March 4, 2015 antiSpam = {} function antiChatSpam() if isTimer(antiSpam[source]) then cancelEvent() outputChatBox("DO NOT SPAM", source, 255, 255, 0) else antiSpam[source] = setTimer(function(source) antiSpam[source] = nil end, 1000, 1, source) end end addEventHandler("onPlayerChat", root, antiChatSpam)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now