Wysłany: 2015-02-28, 10:41
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Witam, mam tutaj sw?j skrawek kodu kt?ry mi nie dzia?a, wpisuj? go na razie w freeroama i nic, gdy bindami spami? nic si? nie blokuje, prosi?bym o poprawk? kodu lub o jaki? lepszy kod.
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-02-28, 10:43
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Freeroam posiada w?asny system chatu, wy??cz go.
poza tym :
setTimer (function () setElementData ( player , "blockspam" , nil ) end , 5000 , 1 )
Nie nil a false jak cos.
Polecam lepsz? budow? :
setTimer ( setElementData , 5000 , 1 , player , "blockspam" , false )
Wysłany: 2015-02-28, 10:48
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Rozumiem ?e w freeroamie chodzi o 404 linijk? w fr_server.lua ?
Wysłany: 2015-02-28, 12:27
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
addEventHandler ( 'onPlayerChat' , g_Root ,
function( msg , type )
if type == 0 then
cancelEvent ()
if chatTime [ source ] and chatTime [ source ] + tonumber ( get ( "*chat/mainChatDelay" )) > getTickCount () then
outputChatBox ( "Stop spamming main chat!" , source , 255 , 0 , 0 )
return
else
chatTime [ source ] = getTickCount ()
end
if get ( "*chat/blockRepeatMessages" ) == "true" and lastChatMessage [ source ] and lastChatMessage [ source ] == msg then
outputChatBox ( "Stop repeating yourself!" , source , 255 , 0 , 0 )
return
else
lastChatMessage [ source ] = msg
end
local r , g , b = getPlayerNametagColor ( source )
outputChatBox ( getPlayerName ( source ) .. ': #FFFFFF' .. msg : gsub ( '#%x%x%x%x%x%x' , '' ), g_Root , r , g , b , true )
outputServerLog ( "CHAT: " .. getPlayerName ( source ) .. ": " .. msg )
end
end
)
Wysłany: 2015-02-28, 12:29
Mateusz512
Wiek: 27 Na forum: 4511 dni Posty: 44
Usun??em to, wklei?em zamiast tego ten wcze?niejszy kod i nie dzia?a ;/
Tagi: spam
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: