PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: D-J Valhala on 14 January, 2004, 11:33:51

Title: +gagfun
Post by: D-J Valhala on 14 January, 2004, 11:33:51
can someone please please please add to this script +gagfun commend coz sometimes users are flooding the MAIN with this BoT
------------------------------------------------------------
code
-- zFuNBoTz by JenZen?.
-- Everything in this script file is ? Copyrightet by JenZen? 2003

-- This release was meant for [DK]Burger-Banden - burger-banden.kyed.com


-- Defines the name of the bot
Bot = "-= FuN_-_BoT =-"

-- The timezone for your country (How many hours is the dirrerence from GMT)
gmt = "(+2 GMT)"

 textArray = {}
 QWarray = {}
 antall = 0


function Main()

  frmHub:RegBot(Bot)
loadText()
getLine()
SetTimer(1*60000)
StartTimer()

end

function OnTimer()
     getLine()
end


-- Triggers that will be send in the mainchat. This is triggers that are loaded from textfiles.
triggertext = {
      ["+saf"]="zFuNBoTz/shootafaker.txt",
      ["+gon"]="zFuNBoTz/gun.txt",
      ["+ass"]="zFuNBoTz/hey.txt",
      ["+swed"]="zFuNBoTz/kaffe.txt",
      ["+weed"]="zFuNBoTz/weed.txt",
      ["+lsd"]="zFuNBoTz/love.txt",
      ["+smile"]="zFuNBoTz/morgen.txt",
      ["+rose"]="zFuNBoTz/sleep.txt",
      ["+smoke"]="zFuNBoTz/smoke.txt",
      ["+stb"]="zFuNBoTz/vel.txt",
      ["+rosh"]="zFuNBoTz/rosh.txt",
      ["+pig"]="zFuNBoTz/warning.txt",
      ["+lol"]="zFuNBoTz/lol.txt",
      ["+jot"]="zFuNBoTz/delfin.txt",
   }

-- Triggers that will be send in main chat. This is the triggers which have the reason text here.
Trigger = {
      ["+mg"]=date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?"),
      ["+nat"]="[USER] siger godnat og sov godt! Vi ses i morgen her p?",
      ["+bed"]="[USER] Go ToO BeD NoW",
      ["+sleep"]="[USER] says good night and sleep well! See you all tomorrow",
      ["+hey"]="Well hello hello [USER]!",
      brb="Hurry up [USER] we miss you allready!",
      ["+bye"]="See you later [USER] ( I hope )",
      lol="Loooool!",
      wb="Welcome back!"
      
   }

-- These triggers will be sent in pm to the user. Loaded from text files
TriggerPrivate =    {
         ["+thc"]="zFuNBoTz/newbie.txt",
         ["+ps"]="zFuNBoTz/nybe.txt",
         ["+fu"]="zFuNBoTz/divx.txt",
         ["+mesh"]="zFuNBoTz/adr.txt",
         ["+country"]="zFuNBoTz/country.txt",
         ["+ja"]="zFuNBoTz/gamekey.txt",
         ["+om"]="zFuNBoTz/forkortsmiley.txt",
         ["+alien"]="zFuNBoTz/moresmiley.txt",
         ["+wow"]="zFuNBoTz/routerhelp.txt",
         ["+kopiregler"]="zFuNBoTz/reglerkopiering.txt",

      }

function DataArrival(curUser, sData)

   if( strsub(sData, 1, 1) == "<" ) then
      -- get the msg only using regular expression
      s,e,msg = strfind(sData, "%b<> ([ -z]*)")
      if (msg == "+bed") then
            local text1 = ""
            readfrom("zFuNBoTz/bed1.txt")
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text1 = text1..line.."\r\n"
               end
            end
            readfrom()
            local text2 = ""
            readfrom("zFuNBoTz/bed2.txt")
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text2 = text2..line.."\r\n"
               end
            end
            readfrom()

            hey = random(1,2)
            if hey == 1 then
            SendToAll("-= FuN_-_BoT =- - from "..curUser.sName,text1)
            elseif hey == 2 then
            SendToAll("-= FuN_-_BoT =- - from "..curUser.sName,text2)
            end
         end



      -- look in the table
      for key, value in triggertext do
         if( strfind( strlower(msg), key) ) then
      answer, x = gsub(value, "%b[]", curUser.sName)
            local text = ""
            readfrom(answer)
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text = text..line.."\r\n"
               end
            end
            SendToAll("-= FuN_-_BoT =- - from "..curUser.sName, text)
         end   
         readfrom()   
      end
      

      for key, value in Trigger do
         if( strfind( strlower(msg), key) ) then
            answer, x = gsub(value, "%b[]", curUser.sName)
            SendToAll( Bot, answer ) -- send bot's answer

         end
         
      end
   end
   if( strsub(sData, 1, 1) == "<" ) or ( strsub(sData, 1, 4) == "$To:") then
      s,e,msg = strfind(sData, "%b<> ([ -z]*)")
      for key, value in TriggerPrivate do
         if( strfind( strlower(msg), key) ) then
      answer, x = gsub(value, "%b[]", curUser.sName)
            local text = ""
            readfrom(answer)
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text = text..line.."\r\n"
               end
            end
            SendToAll("-= FuN_-_BoT =- - from "..curUser.sName, text)
            
         end   
         readfrom()   
      end

end

data = strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )

      if (cmd=="+joke" or cmd=="!joke" or cmd=="+joke" or cmd=="-joke") then
         curUser:SendPM("[zFuNBoTz] - Joke from "..curUser.sName, txt2)
      return 1;
      end
      


      if (cmd=="" or cmd=="" or cmd=="" or cmd=="" or cmd=="" or cmd=="" or cmd=="") then
         SendPmToNick(curUser.sName, Bot, "\r\n\r\n       Current Fun commands on this hub:".."\r\n      +divx      -   Shows the DivX faq".."\r\n      +shootafaker   -    '44 Magnum Meets A Faker".."\r\n      +gun      -   BLAOW! Another Faker Bites The Dust!".."\r\n      +hey      -   Say Hello In Main Chat".."\r\n      +kaffe      -   Kaffetid!".."\r\n      +weed      -   Cheech & Chong Party Time!".."\r\n      +love      -   Groovy Kind Of Love".."\r\n      +morgen      -   Godmorgen I Hubben".."\r\n      +newbie      -   Direct Connect FAQ In English".."\r\n      +nybe      -   Direct Connect FAQ P? Dansk".."\r\n      +bed      -   Goin' To Bed".."\r\n      +smoke      -   Smokin'".."\r\n      +vel      -   Velkommen".."\r\n      +warning      -   Official Warning".."\r\n      +lol      -   Laugh Out Loud".."\r\n      +adr      -   Show Network Info".."\r\n      +away      -   Away Besked".."\r\n      -away      -   Tilbage p? hubben".."\r\n      +bye      -   Ses Senere".."\r\n      +tillykke      -   Tillykke Med Dagen".."\r\n      +nat      -   God Nat p? hubben".."\r\n      +country      -   Shows a list of all countrycodes".."\r\n      +gamekey   -   Shows keys and serials for the most popular games".."\r\n      +smiley      -   Shows some smileys and shortenings".."\r\n      +moresmiley   -   More smileys".."\r\n      +kopiregler   -   Viser de g?ldende regler for kopiering af digitale medier i DK".."\r\n      +routerhelp   -   Shows how u use active mode when you have a router or firewall".."\r\n")
               return 1;
      end


end

function tokenize (inString,token)
   _WORDS = {}
   local matcher = "([^"..token.."]+)"
   gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
   return _WORDS
end

function loadText()
handle = openfile("zFuNBoTz/joke.txt", "r")
if (handle) then
local line = read(handle)
   while line do
      if ((line ~= "") and (strfind(line, "*", 1, plain))) then
      tinsert(textArray, line)
      antall = antall + 1
   end
   line = read(handle)
   end
closefile(handle)
end
end

function getLine()
 lngWord = random(1, antall)
 QWarray = tokenize(textArray[lngWord], "*")
 txt1 = QWarray[1]
 txt2 = QWarray[2]
end


CyA all
Title:
Post by: D-J Valhala on 16 January, 2004, 23:53:45
no body?
:(
Title:
Post by: plop on 17 January, 2004, 00:16:29
i don't fully understand what you mean by +gagfun.
a on and off switch or something else ???

plop
Title:
Post by: D-J Valhala on 17 January, 2004, 10:14:41
+gagfun = gag users feom this BoT commends there are a lot of user commend in this BoT i need to add +gagfun