• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Help to DDOS players protection

dawnking

Member
Joined
Jun 23, 2016
Messages
176
Reaction score
22
Hello, i've tried to add this old script to protect server...
How work: When server avarange IP get to high, it kick all players to protect in a DDOS attack

It's just need some sources edits, thats i made in:
look for: // getOtsysTime() + getPlayerPing(cid) + doPlayerSendPing(cid)
- luascript.cpp(3x) e luascript.h

luascript.cpp
http://hastebin.com/umodedehuy.go

luascript.h
http://hastebin.com/xonixeluqe.cpp


Script:
Code:
<globalevent name="ddosprotect" interval="1000" event="script" value="antiddos.lua"/>

Code:
function onThink(interval, lastExecution)
   local averageServerPing = 0
   local playerCount = 0

   for _, cid in ipairs(getPlayersOnline()) do
       averageServerPing = (playerGetLastPing(cid) + averageServerPing)
       print(playerGetLastPing)
       playerCount =_
   end

   averageServerPing = (averageServerPing / playerCount)
   print(averageServerPing)
   if averageServerPing > 2000 then
       doBroadcastMessage("DDos attack! Everyone will be kicked")

       for _, cid in ipairs(getPlayersOnline()) do
         addEvent(function(cid)
               doRemoveCreature(cid)
         end, 1000, cid)

       end
    end
    return TRUE
end


The problem:
I was test in localhost, only me in 1 character login, and thats is what print on console:
Code:
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
[16:57:15.345] Daniel has logged in.

1480964235200
> Broadcasted message: "DDos attack! Everyone will be kicked".
[16:57:17.290] Daniel has logged out.
-nan
-nan
-nan
-nan
-nan
-nan
 
So him script is better (when fix of course)...
If you use your way, the server will got DDOS, every player will die, and after will kick they to protect, no offense, but no sense :S
You can make a method using the attack combat, it will work like TibiaRL (The monsters aren't going to attack the player at all and it will logout), the method isn't for the server itself.
 
You can make a method using the attack combat, it will work like TibiaRL (The monsters aren't going to attack the player at all and it will logout), the method isn't for the server itself.

It could be possible with no use sources?
It should be too better, monsters stop attack players with high ping...
 
Back
Top