Random Script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Random Script

Started by Baad-Boi, 05 August, 2005, 23:28:58

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Baad-Boi

hey can any one convert this into lua 5

-----------------------------------------------------
----                                                           -----
--                   By                              --
----                                                           -----
-----------------------------------------------------

Bot="Name"

MessMax = 3
Maxflood = 3
logfile = "flood.log"

-- filter levels. use 1 for everything but OP's, nil for the table with level numbers.
iMode = 1
tMode = { [-1] = 1 }

iKill = nil
iTimeBan = 60

feccia = { ["Ruri_Ruri"]=1, ["R u r i_ R u r i "]=2, ["TEAMELITE"]=3, ["F8X0R"]=4, ["KNUCKLES"]=5, ["OPZONE"]=6,["K-N-U-C-K-L-E-S"]=7, ["Meka_Meka"]=8, ["O-M-E-G-A"]=9, ["OMEGA"]=10 }

opchat = frmHub:GetOpChatName()

AWAY = 1

sec = 1000
min = 60 * sec
hour = 60 * min
day = 24 * hour

time = 10 * sec

msgTable= {}
tShare = {}
tNames = {}
tMyInfo = {}
tGetNick = {}

function Main()
   frmHub:EnableFullData(1)
   frmHub:RegBot(Bot)
   SetTimer(time)
   StartTimer()
   feccia2 = {}
   for i,v in feccia do
      local a = gsub(gsub(gsub(i, "-",""), " ", ""), " ","")
      a = strlower(a)
      feccia2[a]=1
   end
   feccia = nil
end

function OnTimer()
   msgTable= nil
   tShare = nil
   tNames = nil
   tMyInfo = nil
   tGetNick = nil
   msgTable= {}
   tShare = {}
   tNames = {}
   tMyInfo = {}
   tGetNick = {}
end

function ByeBye(user, what)
   if what == nil then
      what = "Stop Flooding !!|"
   end
   user:SendPM(Bot, what)
   if iKill == 1 then
      user:Kick()
   elseif iKill == 2 then
      user:Ban()
   elseif iKill == 3 then
      user:TempBan()
   elseif iKill == 4 then
      user:TimeBan(iTimeBan)
   else
      user:Disconnect()
   end
   return 1
end

function CheckLevel(user)
   if iMode then
      return user.bOperator
   else
      return tMode[user.iProfile]
   end
end

function DataArrival(user, data)
   if( strsub(data, 1, 1) == "<" ) then
      if not CheckLevel(user) then
         data = strsub(data, 1, (strlen(data)-1))
         s,e,nick, data = strfind(data, "^(%b<>)(.+)")
         nick = GetItemByName(strsub(nick, 2, -2))
         if nick == nil then
            msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (nick fake)"
            StoreLog(user.sName, msg)
            return ByeBye(user, what)
           
         elseif ChatCheck(user, data) then
            return 1
         end
      end
     
   elseif( strsub(data, 1, 1) == "*" ) then
      if not CheckLevel(user) then
         data = strsub(data, 1, (strlen(data)-1))
         s,e,data = strfind(data, "^%*%s*(.+)")
         if ChatCheck(user, data) then
            return 1
         end
      end
     
   elseif(strsub(data, 1, 4) == "$To:") then
      if not CheckLevel(user) then
         data = strsub(data, 1, (strlen(data)-1))
         s,e,data = strfind(data, "$%b<>(.+)")
         local t,c = gsub(data, "xXxX", "")
         if c >1 then
            msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a client flooder!!"
            StoreLog(user.sName, msg)
            return ByeBye(user, what)
         elseif ChatCheck(user, data) then
            return 1
         end
      end
     
   elseif strsub(data, 1, 12) == "$GetNickList" then
      if tGetNick[user.sName] == nil then
         tGetNick[user.sName] = 1
      else
         tGetNick[user.sName] = tGetNick[user.sName] +1
         if tGetNick[user.sName] >= 5 then
            tGetNick[user.sName] = nil
            msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (GetNickList)"
            StoreLog(user.sName, msg)
            return ByeBye(user, what)
         end
      end
     
   elseif strsub(data, 1, 12) == "$ConnectToMe" then
      local s,e,ip = strfind(data, "(%S+):%d+|$")
      if ip then
         if ip ~= user.sIP then
            msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (ConnectToMe)"
            StoreLog(user.sName, msg)
            return ByeBye(user, what)
         end
      end
     
   elseif strsub(data, 1, 7) == "$MyINFO" then
      if tMyInfo[user.sName] == nil then
         tMyInfo[user.sName] = 1
      else
         tMyInfo[user.sName] = tMyInfo[user.sName] +1
         local t =(frmHub:GetUsersCount()+10)
         if tMyInfo[user.sName] >= t then
            tMyInfo[user.sName] = nil
            msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (myInfo)"
            StoreLog(user.sName, msg)
            return ByeBye(user, what)
         end
      end
     
      local i,j,temp = strfind(data, "$(%d+)%$")
      if temp then
         if strlen(temp) >= 11 then
            temp = strsub(temp, -11, -1)
            if tonumber(temp) ==  99511627776 then
               msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (versione condivisi)"
               StoreLog(user.sName, msg)
               return ByeBye(user, what)
            end
         end
      end
     
      local _,_,tmp = strfind(data, "%b<>(%d+)%$")
      if tmp then
         msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (tag)"
         StoreLog(user.sName, msg)
         return ByeBye(user, what)
      end
     
      local _,_,nick = strfind(data,"^%$MyINFO %$ALL (%S+)")
      if nick and (nick ~= user.sName) then
         msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (myInfo)"
         StoreLog((nick.." -"..user.sName), msg)
         nick = GetItemByName(nick)
         if nick then
            ByeBye(nick, what)
         end
         return ByeBye(user, what)
      end
     
      local name = gsub(user.sName, "%d", "")
      if strlen(name) == 0 then
         msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (bannato su nick)"
         StoreLog(user.sName, msg)
         return ByeBye(user, what)
      end
     
      s,e,data = strfind(data, "%$ALL%s+%S+(.*)%b<>%$")
      if data then
         data = strlower(data)
         data = gsub(gsub(gsub(data, "-", ""), " ", ""), " ", "")
         for i,v in feccia2 do
            local s,e,no = strfind(data, ".*("..i..").*")
            if no then
               msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!! (ban descrizione)"
               StoreLog(user.sName, msg)
               return ByeBye(user, what)
            end
         end
         
         local s,e,share = strfind(data, "$(%d+)%$")
         if share then
            if tShare[share] == nil then
               tShare[share] = 1
               tNames[user.sName] = 1
            elseif tNames[user.sName] == nil then
               msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding!!! (share)"
               StoreLog(user.sName, msg)
               return ByeBye(user, what)
            end
         end
      end
   end
end

function ChatCheck(user, data)
   local name = user.sName
   data = gsub(data, "%d", "")
   if AWAY then
      s,e,away = strfind(data,"(%b<>)$")
      if away then
         return
      end
   end
   local count = 0
   if msgTable[name] == nil then
      msgTable[name] = {}
      msgTable[name][1]=data
      return
   else
      for i=1,MessMax do
         if msgTable[name] then
            if data == msgTable[name] then
               if msgTable[name]["count"] == nil then
                  user:SendPM(Bot, "Niente Flood Qui :"..data.."|")
                  user:SendPM(Bot, "Primo avviso, al "..Maxflood.."Stop Flooding!!|")
                  msgTable[name]["count"]=1
                  msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding"..data
                  StoreLog(user.sName, msg)
                  count = 1
                  return 1
               else
                  msgTable[name]["count"]=msgTable[name]["count"] +1
                  if msgTable[name]["count"] >= Maxflood then
                     what = "You have been warned!! You are now banned for flooding the hub!!"
                     msg = user.sName.." - "..user.sIP.." - "..date().."Stop Flooding"..data
                     StoreLog(user.sName, msg)
                     msgTable[name] = nil
                     return ByeBye(user, what)
                  else
                     user:SendPM(Bot, "avviso N? "..msgTable[name]["count"].."Stop Flooding!!|")
                     msg = user.sName.." - "..user.sIP.." - "..date().." - flood warning number: "..msgTable[name]["count"]..". msg was: "..data
                     StoreLog(user.sName, msg)
                     return 1
                  end
               end
            end
         end
      end
   end
   if count == 0 then
      local count2 = 0
      for i=1,MessMax do
         if msgTable[name] then
            count2 = count2 +1
         else
            break
         end
      end
      if count2 >= MessMax then
         for i=1,MessMax do
            if msgTable[name] ~= nil then
               local tmp = i+1
               if msgTable[name][tmp] then
                  msgTable[name] = msgTable[name][tmp]
               else
                  msgTable[name]=data
                  break
               end
            end
         end
      else
         count2 = count2 +1
         msgTable[name][count2]=data
      end
   end
end

function StoreLog(nick, msg)
   appendto(logfile)
   if opchat then
      SendPmToOps(opchat, msg.."|")
   else
      SendPmToOps(Bot, msg.."|")
   end
   write(msg.."\n")
   writeto()
   msg = nil
end

   
DONT KNOW WHO MADE IT !!!!!!!

Psycho_Chihuahua

use deflood function of newer PtokaX Version - no need for script
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

SMF spam blocked by CleanTalk