- Dołączył
- Styczeń 22, 2013
- Posty
- 17
- Liczba reakcji
- 1
Witajcie , mam do Was pro?b? , je?li by?by kto? tak uprzejmy udost?pni? mi skrypt zapobiegaj?cy crashom serwera , pingowaniu i cofkom b?d? bardzo wdzi?czny. Z g?ry dzi?kuj?, pozdrawiam Vernoth ! 

Follow along with the video below to see how to install our site as a web app on your home screen.
Notka: This feature may not be available in some browsers.

---Script by mock the bear
local ping_timeout_ = 2000 -- Equals 2 seconds of non response
local active_anti_ddos = true;
local ping_to_execute_anti_ddos = 0.75 --[[is ping timeout * self.
If helf of this server ping if near this value
the server will auto kick]]
local pingbase = 0;
local pingN = 0;
local block = false;
local player_o = 0;
function onThink(interval, lastExecution) -- MTB
pingbase = 0;
pingN = 0;
block = false;
local pls = getPlayersOnline()
player_o = #pls
for i,cid in pairs(pls) do
ping.getPing(cid,29894,function(cid,_,ping_,i)
if active_anti_ddos then
pingbase = pingbase+ping_
pingN = pingN+1
if (math.floor(player_o/2) > 5) and math.floor(player_o/2) <= pingN then
if pingbase/pingN > ping_timeout_*ping_to_execute_anti_ddos then
broadcastMessage("DDoS attack maby detected! KICKING EVEBODY!", 25)
block = true;
for a,cid in pairs(getPlayersOnline()) do
doRemoveCreature(cid)
end
doSaveServer()
end
end
end
if ping_ > ping_timeout_ and not block then
doRemoveCreature(cid)
end
if i == pls then
print('Ping avarage: '..pingbase/pingN..' ms/player.')
end
end,i)
end
return true
end
<globalevent name="antiddos" interval="900" event="script" value="ddos.lua"/>

