PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: LiqUiD~TrolL on 14 November, 2004, 17:17:42

Title: crazy script functionality
Post by: LiqUiD~TrolL on 14 November, 2004, 17:17:42
well hello everybody

well i have a good question for all the scripters arround
some ppl told me to use PLOPS script to show some txt i want in my hub
and the problem IS  :

i m useing the script,it s working fine but there is a problem, the perfixes in the script are ( + )  and the script it is working with(  !  )  ehehhe what the hell is going on??

but i have + not !  


and here is the script my firends  :

-- texter bot by plop
-- modified 2 show only 6 files,
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.


Bot = "something"

FDFolder = "text"

cmd1 = "+ophelp"
file1 = "ophelp.txt"

cmd2 = "+ad"
file2 = "ad.txt"

cmd3 = "+help"
file3 = "help.txt"

cmd4 = "+masterhelp"
file4 = "masterhelp.txt"

cmd5 = "+viphelp"
file5 = "viphelp.txt"

cmd6 = "+hubinfo"
file6 = "hubinfo.txt"


function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1)
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      if cmd == cmd2 then
         showtext(user, file2)
         return 1
      elseif cmd == cmd1 and user.iProfile ==1 then
         showtext(user, file1)
         return 1
      elseif cmd == cmd3 and (user.iProfile ==3 or user.iProfile ==-1) then
         showtext(user, file3)
         return 1
      elseif cmd == cmd4 and user.iProfile ==0 then
         showtext(user, file4)
         return 1
      elseif cmd == cmd5 and user.iProfile ==2 then
         showtext(user, file5)
         return 1
      elseif cmd == cmd6 and user.iProfile ==0 then
         showtextmain(user, file6)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S(%w+)")
      if cmd == cmd2 then
         showtext(user, file2)
         return 1
      elseif cmd == cmd1 and user.iProfile ==1 then
         showtext(user, file1)
         return 1
      elseif cmd == cmd3 and (user.iProfile ==3 or user.iProfile ==-1) then
         showtext(user, file3)
         return 1
      elseif cmd == cmd4 and user.iProfile ==0 then
         showtext(user, file4)
         return 1
      elseif cmd == cmd5 and user.iProfile ==2 then
         showtext(user, file5)
         return 1
      elseif cmd == cmd6 and user.iProfile ==0 then
         showtextmain(user, file6)
         return 1
      end
   end
end

function showtext(user, file)
local handle = openfile(FDFolder.."/"..file..".txt", "r")
local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
closefile (handle)
user:SendPM(Bot, "\r\n"..contents.."\r\n|")
end

function showtextmain(user, file)
local handle = openfile(FDFolder.."/"..file..".txt", "r")
local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")

closefile (handle)
SendToAll(Bot, "\r\n"..contents.."\r\n|")
end



does anybody have clue about this functionality???

 :rolleyes:
Title:
Post by: plop on 14 November, 2004, 19:26:42
your mistaking here.
version 2 is the only 1 which takes only 1 prefix type, on all the others it doesn't mather.
it's a sneaky trick 2 make it easyer for the users.

plop
Title:
Post by: LiqUiD~TrolL on 14 November, 2004, 22:32:31
hello plop

thank you very much for your really nice script

my point is that in the script all the perfixes are +
why are they working with !???
it s a big question i have

and exept of that in my hub i like more use + and i would like to change this stupid !


and something more
can i fix it to send the txt in PM????
Title:
Post by: bastya_elvtars on 14 November, 2004, 23:32:07
download the latest ver

http://www.plop.nl/ptokaxbots/Plop/texter4.5.lua
Title:
Post by: LiqUiD~TrolL on 19 November, 2004, 16:22:56
well my friend i founnd it and i fix it good now i m useing a script with 6txts and it s wroking just great
thnaks for your help ppl