PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: nEgativE on 17 April, 2004, 07:50:25

Title: [Help] Anti Flood Script
Post by: nEgativE on 17 April, 2004, 07:50:25
Hi there, is this script reseting ok ?!
I had TempBan for 20, and when the user get in after that, the script is still banning the user.


--quick anti hammer v1 by Phatty
--will reset on scripts restart
-- reset every 10 mins without timer by plop

function Main()
Bot = "GoD"
lucifer = {}
hammeramount = 5
end

function NewUserConnected(user)
if lucifer[user.sName]==nil then
lucifer[user.sName]=1
elseif lucifer[user.sName]==hammeramount then
user:Ban()
SendPmToOps(Bot,user.sName.." has been lucified for hammering the server")
else
lucifer[user.sName]=lucifer[user.sName]+1
end
end

function DataArrival(user, data)
   if HomeMadeTimer ~= strfind(date("%M"), "^%d") then
      HomeMadeTimer = strfind(date("%M"), "^%d")
      lucifer = nil
      lucifer = {}
   end
end

Title:
Post by: [NL]trucker on 17 April, 2004, 12:43:59
luso

if i,m right this script is only banning folks who hammer or connect to much to the server.

when he comes back after the tempban and the script is banning again it mostly means he is still hammering .
Title:
Post by: nEgativE on 17 April, 2004, 13:00:09
Hum.. my idea of this script was kind of.. if the user join and part for a long time the script will ban him for x time.. with a reason, then after x time he could get in.. and if he still flood connecting for some reason, then he get banned again (tempban). so that reset i think it's needed to, becouse the script is banning as soon as the user get in. sorry the english !! :)
Title:
Post by: plop on 17 April, 2004, 13:04:31
user:Ban()
thats no tempban, it's a permanent ban.
what gets reset is the login counter.

plop
Title:
Post by: nEgativE on 17 April, 2004, 13:13:30
QuoteOriginally posted by plop
user:Ban()
thats no tempban, it's a permanent ban.
what gets reset is the login counter.

plop

Yep, i know plop, i have changed to user:TempBan()
but the login counter is not reseting i think, when the tempban expires and the user get in, he will be banned at first login.
Title:
Post by: plop on 17 April, 2004, 13:53:31
the timer isn't very precise, it's about 10 mins +.
the smaller the hub the less precise it is.
but this version should do a lot better on those small hub's.
added a reset on userconnected.
--quick anti hammer v1 by Phatty
--will reset on scripts restart
-- reset every 10 mins without timer by plop

function Main()
   Bot = "GoD"
   lucifer = {}
   hammeramount = 5
end

function NewUserConnected(user)
   if HomeMadeTimer ~= strfind(date("%M"), "^%d") then
      HomeMadeTimer = strfind(date("%M"), "^%d")
      lucifer = nil
      lucifer = {}
   end
if lucifer[user.sName]==nil then
lucifer[user.sName]=1
elseif lucifer[user.sName]==hammeramount then
user:Ban()
SendPmToOps(Bot,user.sName.." has been lucified for hammering the server")
else
lucifer[user.sName]=lucifer[user.sName]+1
end
end

function DataArrival(user, data)
   if HomeMadeTimer ~= strfind(date("%M"), "^%d") then
      HomeMadeTimer = strfind(date("%M"), "^%d")
      lucifer = nil
      lucifer = {}
   end
end
plop