Wysłany: 2015-01-26, 18:27
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Witam, od d?u?szego czasu poszukuj? a nawet pr?bowa?em stworzy? skrypt na zakaz spamu na chacie. Chodzi o to ?e gdy gracz np. napisze co? i za 1 sec zn?w to wy?wietli mu si? komunikat "Musisz odczeka? 3 sekundy by co? napisa?" - lub co? podobnego, lecz nie znalaz?em i nie uda?o mi si? stworzy? dlatego prosz? o pomoc gdy? jest to nie wielki skrypt a ja dopiero zaczynam przygody z LUA.
Wysłany: 2015-01-26, 18:34
Gerano
Mleko,Kakao,LUA
Wiek: 38 Na forum: 4266 dni Posty: 187
Nick w MP: Gerano
Piwa : 1460
Podpis
BUDOWA SERWERA: XXX
Prace: XXX%
Wysłany: 2015-01-27, 19:56
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Nie chodzi?o mi o mute, tylko wy?wietla si? napis ?e musi odczeka? ile? tam sekund ?eby co? napisa?.
Wysłany: 2015-01-27, 21:33
Terr9909
Skrypter LUA
Wiek: 26 Na forum: 4234 dni Posty: 346
Nick w MP: Split
Piwa : 1043
Wedle ?yczenia, pozmieniaj sobie wiadomo?ci
antiSpam = {}
function antiChatSpam ()
if isTimer ( antiSpam [ source ]) then
cancelEvent ()
outputChatBox ( "#ffffff" .. getPlayerName ( source ).. " #ff6600have been muted! ( 60 seconds )" , getRootElement (), 255 , 255 , 0 , true )
setTimer ( autoUnmute , 60000 , 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
outputChatBox ( "#FFFFFF" .. getPlayerName ( player ).. " #ff6600has been unmuted !" , getRootElement (), 255 , 255 , 0 , true )
end
end
Wysłany: 2015-01-27, 21:48
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Mam tutaj ju? gotowy skrypt, lecz gdy spamie na chacie wy?wietla si? Musisz odczeka? 5 min itd. tyle ?e nie blokuje.
addEventHandler ( "onPlayerChat" , root ,function ()
if getElementData ( source , "blockspam" ) then
local sekundy = getElementData ( source , "blockspam" )
cancelEvent ()
outputChatBox ( "Odczekaj " .. sekundy .. " zanim co? napiszesz." , source , 255 , 255 , 255 , true )
else
local player = source
setElementData ( source , "blockspam" , 5 )
setTimer (function () setElementData ( player , "blockspam" , 4 ) end , 1000 , 1 )
setTimer (function () setElementData ( player , "blockspam" , 3 ) end , 2000 , 1 )
setTimer (function () setElementData ( player , "blockspam" , 2 ) end , 3000 , 1 )
setTimer (function () setElementData ( player , "blockspam" , 1 ) end , 4000 , 1 )
setTimer (function () setElementData ( player , "blockspam" , nil ) end , 5000 , 1 )
end
end )
Wysłany: 2015-01-27, 22:04
Terr9909
Skrypter LUA
Wiek: 26 Na forum: 4234 dni Posty: 346
Nick w MP: Split
Piwa : 1043
1. Po co 5 i wi?cej timer?w a potem b?d? b??dy...
?ap:
addEventHandler ( "onPlayerChat" , root ,function ()
if getElementData ( source , "blokada" ) then
local sekundy = getElementData ( source , "blockspam" )
cancelEvent ()
outputChatBox ( "Poczekaj na nast?pn? wiadomo??" , source , 255 , 255 , 255 , true )
else
setElementData ( source , "blokada" , true )
setTimer (function () setElementData ( source , "blokada" , false ) end , 5000 , 1 )
end
end )
Wysłany: 2015-01-28, 13:09
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Dziwne, podstawi?em to pod server i nie blokuje tylko wy?wietla si? napis wpisany w skrypt.
Tagi: antispam.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: