PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Spykez on 06 January, 2005, 08:45:52

Title: nforce.nl script??
Post by: Spykez on 06 January, 2005, 08:45:52
ok i was told there was changes to this script but i cant find ne one who knwos nething about it...

the site is www.nforce.nl and theres a DC script for it that u can check releases from the client softwhare..heres trhe code for it or if ne one knows where i can get the update of it or somethign that would be even better.

-- NforceBOT By [NL]Pur
-- 27-5 - Dumps from the mixedlist the app name and url of the site nforce.nl to pm with the command ?nforce
--      - already a small bugfix changed http://nforce.nl  2   http://www.nforce.nl
-- 30-5 - Added the commands ?games ?addons ?rippatch ?dox ?appiso ?dreamcast ?ps ?ps2 ?gbadv ?xbox ?divx ?xvid
--      -                    ?vcd ?svcd ?anime ?xxx ?dvdr ?tvrips
-- 31-5 - Added +help command
-- 2-6  - Added !search  
--      - Modified the getnews1 function alot, search funtion doesn't give all the results :( seems strfind  
--        doen't find everthing.
-- 8-6  - Bugfix Cmd2 was as mixedlist but had too be games
--      - Added Timer every min it refreshes on list can be disabled by setting timer too 0
-- 15-6 - Change onTimer into OnTimer, changed function refreshlist uses now a global num


MainBotName = "[bot]Security" -- Rename to match your Main hub bot
BotName = "[bot]nFORCE"

cmd1 = "!search"    --

cmd101 = "?mixed"    -- no arguments
cmd2 = "?games"    
cmd3 = "?addons"  
cmd4 = "?rippatch"
cmd5 = "?dox"
cmd6 = "?appiso"
cmd7 = "?dreamcast"
cmd8 = "?ps"
cmd9 = "?ps2"
cmd10 = "?gbadv"
cmd11 = "?xbox"
cmd12 = "?divx"
cmd13 = "?xvid"
cmd14 = "?vcd"
cmd15 = "?svcd"
cmd16 = "?anime"
cmd17 = "?XXX"
cmd18 = "?dvdr"
cmd19 = "?tvrips"

cmdH = "+help"

function Main()
    num = 0
    frmHub:RegBot(BotName)
    TimeSpanInMinutes = 1
    if (TimeSpanInMinutes ~= 0) then
      SetTimer(TimeSpanInMinutes*60000)
      StartTimer()
      SendPmToOps(MainBotName,"Timer started ")  
    end
    SendPmToOps(MainBotName,date("nForce Activated [%d %B %Y  l %X]"))
end

function Get1Arg(data)
s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
return arg
end

function OnTimer()
 num = num + 1
 if (num > 19) then num = 0 end
 refreshlist()
end

function refreshlist()
if (num == 1) then
 getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=101',"mixedlist.txt")
elseif (num == 2) then
 getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=3',"addons.txt")
elseif (num == 3) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=4',"rippatch.txt")
elseif (num == 4) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=5',"dox.txt")
elseif (num == 5) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=6',"appiso.txt")
elseif (num == 6) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=7',"dreamcast.txt")
elseif (num == 7) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=8',"playstation.txt")
elseif (num == 8) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=9',"playstation2.txt")
elseif (num == 9) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=10',"gamebadv.txt")
elseif (num == 10) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=11',"xbox.txt")
elseif (num == 11) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=12',"divx.txt")
elseif (num == 12) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=13',"xvid.txt")
elseif (num == 13) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=14',"vcd.txt")
elseif (num == 14) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=15',"svcd.txt")
elseif (num == 15) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=16',"anime.txt")
elseif (num == 16) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=17',"xxx.txt")
elseif (num == 17) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=18',"dvdr.txt")
elseif (num == 18) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=19',"tvrips.txt")
elseif (num == 19) then
getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=2',"games.txt")
end
end


function DataArrival(curUser,data)


 
if (strsub(data, 1, 1) == "<") then

    data = strsub(data,1,strlen(data)-1)
    if (strfind(strlower(data), strlower(cmd1))) then
      arg = Get1Arg(data)
      if (arg==nil) then      
      else
        sp = strchar(32)
        arg = gsub(arg, sp, '+')
        getNews1('http://www.nforce.nl/nfos/index.php?do=1&f=find&name='..arg..'&search=1',"search.txt")
        readfile(curUser,"search.txt")
      end
    end


    --data = strsub(data,1,strlen(data)-1)
    if (strfind(strlower(data), strlower(cmd101))) then
         if (TimeSpanInMinutes == 0) then  getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=101',"mixedlist.txt") end  
         readfile(curUser,"mixedlist.txt")
    end  

    if (strfind(strlower(data), strlower(cmd2))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=2',"games.txt") end
         readfile(curUser,"gameslist.txt")
    end
    if (strfind(strlower(data), strlower(cmd3))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=3',"addons.txt") end
         readfile(curUser,"addons.txt")
    end
    if (strfind(strlower(data), strlower(cmd4))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=4',"rippatch.txt") end
         readfile(curUser,"rippatch.txt")
    end

    if (strfind(strlower(data), strlower(cmd5))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=5',"dox.txt") end
         readfile(curUser,"dox.txt")
    end
 if (strfind(strlower(data), strlower(cmd6))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=6',"appiso.txt") end
         readfile(curUser,"appiso.txt")
    end
 if (strfind(strlower(data), strlower(cmd7))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=7',"dreamcast.txt") end
         readfile(curUser,"dreamcast.txt")
    end
 if (strfind(strlower(data), strlower(cmd8))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=8',"playstation.txt") end
         readfile(curUser,"playstation.txt")
    end
 if (strfind(strlower(data), strlower(cmd9))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=9',"playstation2.txt") end
         readfile(curUser,"playstation2.txt")
    end
 if (strfind(strlower(data), strlower(cmd10))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=10',"gamebadv.txt") end
         readfile(curUser,"gamebadv.txt")
    end
 if (strfind(strlower(data), strlower(cmd11))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=11',"xbox.txt") end
         readfile(curUser,"xbox.txt")
    end
 if (strfind(strlower(data), strlower(cmd12))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=12',"divx.txt") end
         readfile(curUser,"divx.txt")
    end
 if (strfind(strlower(data), strlower(cmd13))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=13',"xvid.txt") end
         readfile(curUser,"xvid.txt")
    end
 if (strfind(strlower(data), strlower(cmd14))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=14',"vcd.txt") end
         readfile(curUser,"vcd.txt")
    end
 if (strfind(strlower(data), strlower(cmd15))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=15',"svcd.txt") end
         readfile(curUser,"svce.txt")
    end
 if (strfind(strlower(data), strlower(cmd16))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=16',"anime.txt") end
         readfile(curUser,"anime.txt")
    end
 if (strfind(strlower(data), strlower(cmd17))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=17',"xxx.txt") end
         readfile(curUser,"xxx.txt")
    end
 if (strfind(strlower(data), strlower(cmd18))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=18',"dvdr.txt") end
         readfile(curUser,"dvdr.txt")
    end
 if (strfind(strlower(data), strlower(cmd19))) then
         if (TimeSpanInMinutes == 0) then getNews1('http://www.nforce.nl/nfos/index.php?do=1&s=19',"tvrips.txt") end
         readfile(curUser,"tvrips.txt")
    end

 if (strfind(strlower(data), strlower(cmdH))) then
       wr(curUser,"__[ Commands Nforce.nl Bot ]__________________________________________")
       wr(curUser,"")
       wr(curUser,"!Search   ")
       wr(curUser,"")
       wr(curUser,"?Mixed - Shows the mixed list")
       wr(curUser,"")
       wr(curUser,"?Games - Shows the games list")
       wr(curUser,"?Addons - Shows the addons list")
       wr(curUser,"?Rippatch - Shows the Rippatch list")
       wr(curUser,"?Dox - Shows the Dox list")      
       wr(curUser,"?Appiso - Shows the Application Iso list")
       wr(curUser,"?Dreamcast - Shows the Dreamcast list")
       wr(curUser,"?ps - Shows the Playstation list")
       wr(curUser,"?ps2 - Shows the Playstation 2 list")
       wr(curUser,"?gbadv - Shows the Gameboy advanced list")
       wr(curUser,"?xbox - Shows the Xbox list")
       wr(curUser,"?divx - Shows the Divx list")
       wr(curUser,"?xvid - Shows the xvid list")
       wr(curUser,"?vcd - Shows the vcd list")
       wr(curUser,"?svcd - Shows the svcd list")
       wr(curUser,"?anime - Shows the anime list")
       wr(curUser,"?xxx - Shows the XXX list")
       wr(curUser,"?TVrips - Shows the TVrips list")
       wr(curUser,"?DVDR - Shows the DVD-r list")
       wr(curUser,"")
       wr(curUser,"_________________________________________________________________")
 end

end
end

function getcmd(data,md)
  getmd=0
  if (strfind(strlower(data), strlower(md))) then
      arg = Get1Arg(data)
      if (arg==nil) then      
      else    
        getmd=1
        return getmd
      end
    end
end

send = " HTTP/1.1"..strchar(13, 10).."Host: nforce.nl"..strchar(13, 10).."Connection: Close"..strchar(13, 10)..
       "User-Agent: Mozilla/4.0 (blah blah blah whatever blah)"..strchar(13, 10)..strchar(13, 10)

function getNews1(gourl,filen)
local line
local socket, err = connect("www.nforce.nl",80)
  if not err then
    socket:timeout(2)
    err = socket:send("GET "..gourl..send)
      if not err then
        writeto(filen)
      x=0
      while not(x >2000) do      
          x=x+1
          line, err = socket:receive("*l")      
         w,q = strfind(line,'/fo')
         if(w~=nil) then    
          g,f = strfind(line,'?do=2')        
           if (g~=nil) then                  
              i,r = strfind(line,"")
            if (r~=nil) then
              line = strsub(line,g,(i-1))
              line = gsub(line, '">',' ')
              r=nil
            end
            write("http://www.nforce.nl/nfos/index.php"..line..strchar(13,10))
            g=nil
           end
        end

      end    
        writeto()
      end
  end
  socket:close()
end

function wr(target,text)
  target:SendPM(BotName,text)
end

function readfile(target,file)
readfrom(file)
   while 1 do
     local line = read()
     if line == nil then
       break
     else
       wr(target,line)
     end
   end
  readfrom()
end
Title:
Post by: fallen_ on 27 January, 2005, 19:03:11
Script doesn't work