PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: TTB on 26 March, 2005, 19:45:17

Title: BanME Lua5
Post by: TTB on 26 March, 2005, 19:45:17
Hi,

v. 3.1 converted into LUA5 >> that will make it v. 4.1 (why, don't know)  :]


Here again the script for users who like to ban themselves...

-- -----------------------------------------------------------------------
-- BANME script by TTB
-- -----------------------------------------------------------------------
-- OPs get also notification by PM (if enabled)
-- v4.1  26-03-05
-- Also thanx to Piderman & Tejo
-- -----------------------------------------------------------------------
-- Converted into LUA 5
-- ------------------------------------------------------------------------
-- NOTE: If opNote = "2" your BOT (regmybot setting) won't be registered!!
-- ------------------------------------------------------------------------

-- ## Change this to what you like ## --

-->> Bot & Hubname
Bot = "[BOT]PLAY" -- NAME of your BANME bot  >:)
hubname = "Dutch DVD hub" -- NAME of your wonderful hub

-->> Your commands
Baninfocmd = "#banhelp" -- info "how do I get banned?!"
Bancmd = "#banme" -- your BANME command
Disconnectcmd = "#disconnect" -- your disconnect command
Killcmd = "#killme" -- your KILL command

-->> OP Notification
opNote = "2" -- "0" no notification to OP's
-- "1" notification to your defined Bot (1st setting)
-- "2" notification to OP-Chat

-->> Time of your Timebans
minBan = 1 -- Default = 1 min. minimum Timeban. No quotes needed here
maxBan = 1440 -- 1440 min = 24 hours. No quotes needed here

-->> BE CAREFUL WITH THIS SETTING!
kill = "2" -- "0" = disabled (default)
-- "1" = enabled (user will be KILLED!!)
-- "2" = disconnect the user (user will be shocked..)

-->> REG your bot if you don't use the name of a BOT that already exists!
regmybot = "0" -- REG your BANME bot? -> "1" (default) else "0"
-- Please read the NOTE above!!!

-->> Now you are finished with the configuration :)


-- ## Don't change below ## --

--> REGBOT <--
function Main()
 if (opNote ~= "2") then
  if (regmybot == "1") then
frmHub:RegBot(Bot)
  end
 end
end

--> DATA <--
function ChatArrival(curUser, data)
   if (string.sub(data, 1, 1) == "<" ) then
    data=string.sub(data,1,string.len(data)-1)
    s,e,cmd = string.find(data,"%b<>%s+(%S+)")
    if (cmd == Baninfocmd) then
     if curUser.bOperator then
      curUser:SendData(Bot, Header..MainInfo..OPInfo)
     else
      curUser:SendData(Bot, Header..MainInfo)
     end
     return 1
    elseif (cmd == Disconnectcmd) then
     local s,e,reason= string.find(data,"%b<>%s+%S+%s+(.*)")
     DiscMe(curUser,reason,data)
     return 1
    elseif (cmd == Killcmd) then
     KillMe(curUser)
     return 1
    elseif (cmd == Bancmd) then
     local s,e,time= string.find(data,"%b<>%s+%S+%s+(%A+)")
      if time == nil then
       curUser:SendData(Bot, "Syntax error! Please use: "..Bancmd.."