-- // Lokalne ustawienia systemu anty spamowego \ --
local systemAntySpam = { }
local czasAntySpam = { }
local ustawieniaAntySpam = get( "kick" )
-- // System od anty spamu \ --
function antySpam ( message, messageType )
systemAntySpam[ source ] = tonumber( systemAntySpam[ source ] or 0 ) + 1
if systemAntySpam[ source ] == 3 then
outputChatBox( "Przesta? spami?!",source,255,0,0 )
elseif systemAntySpam[ source ] > 3 then
if ustawieniaAntySpam == "true" then
outputChatBox( "Gracz " .. getPlayerName( source ) .. " zosta? wyrzucony za spam, pow?d: 3/3 ostrze?e?",root,255,0,0 )
kickPlayer( source,"Zosta?e? wyrzucony, pow?d 3/3 ostrze?e?" )
systemAntySpam[ source ] = 0
elseif ustawieniaAntySpam == "false" then
setPlayerMuted( source, true )
systemAntySpam[ source ] = 0
outputChatBox( getPlayerName( source ) .. " zosta? wyciszony przez Anty-Spam (20-sekund)",root,255,0,0 )
if isTimer( czasAntySpam[ source ] ) then
killTimer( czasAntySpam[ source ] )
end
czasAntySpam[ source ] = setTimer(
function( player )
setPlayerMuted( player,false )
outputChatBox( "Zosta?e? odciszony przez Anty-Spam, kolejnym razem nie spamuj!",player,255,255,0 )
end,
20000,
1, source )
end
end
end
addEventHandler ( "onPlayerChat", root, antySpam )
-- // Sprawdzanie czasu oraz ustawie? anty-spamowych po wyj?ciu gracza \ --
function antySpamWyjscie( )
systemAntySpam[ source ] = nil
czasAntySpam[ source ] = nil
end
addEventHandler ( "onPlayerQuit", root, antySpamWyjscie )