PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Woody on 09 January, 2004, 15:12:54

Title: Hub Script
Post by: Woody on 09 January, 2004, 15:12:54
Hi i am new to all this as some of you already know :)

I am looking for a script that will give you commands to open a text file or something alike.

I know of a hub that is using what im looking for but cant get hold of Hub Owner to ask him what he is using

The hub is UK ADSL - 2        addy: ollyj.no-ip.com

Any help will be appreciated

Thanx

Woody
Title:
Post by: pHaTTy on 09 January, 2004, 15:30:19
that hub is using YHub they have external bots but not as good as ptokax, ptokax is so much more customisable :)

try a script package, Gekko, Allin1, ChannelBot, Robocop, AI, and plenty others im sre you will find one to ur needs, and if you want some phun scripts / games then i have just started working on a great script game, killing buying selling etc, and theres many others, Chilla's trivia ex, check out Optimus's script collection look on this main website and lok for script archive ;)

goodluck l8rr
Title:
Post by: Woody on 09 January, 2004, 16:04:05
I have found what im looking for thanx phatty :)

Compliments to yourself

All i need now is some very kind nice generous person to edit it a bit for me seeing as i have no idea what i am doing!

-- Jason 0.5, by Phatty
-- Jason 0.1 wrote on 5th October 2k3
-- You can add ur own files
-- For example make a file named help.txt in the docs folder and then type in main !show help
-- ATM you cant make files with spaces like....Friday the 13th.txt <<< this will not work, but will add soon :)
-- Don't forget to make a folder named docs inside script folder
-- Added no such file error
-- Added who-to now, !show   =  example !show pmme test
-- There is pmme, me, or all
-- Added !lock
-- Added !version
-- Added self prefix
-- Fixed 1 line read only

Bot = "J???"
Version = "0.5"

mcmd="#"

Blacklist={}

function Main()
frmHub:RegBot(Bot)
end

function WhileRead(user,data)
   while 1 do
      line = read("*a")
      if line == nil then
         user:SendData(Bot,"I know of no such file")
         break end
      if to == "me" then
         user:SendData(Bot,line)
      elseif to == "all" then
         SendToAll(Bot,line)
      elseif to == "pmme" then
         user:SendPM(Bot,line)
      end
   readfrom()
   return 1
   end
end

function LockOut(user)
if arg == "on" then
   user:SendData(Bot,"You have blacklisted: "..to)
   Blacklist[to]=1
   buser = GetItemByName(to)
   buser:SendPM(Bot,"You have been blacklisted")
   return 1
elseif arg == "off" then
   user:SendData(Bot,"You have removed "..to.." from the blacklist")
   Blacklist[to]=nil
   buser = GetItemByName(to)
   buser:SendPM(Bot,"You have been removed from the blacklist")
   return 1
   end
end


function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
   data=strsub(data,1,strlen(data)-1)
   s,e,cmd,to,arg = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)")

   if cmd == mcmd.."show" then
      if Blacklist[user.sName]==nil then
         readfrom("docs/"..arg..".txt")
         WhileRead(user,data)
         return 1
      else
         user:SendData(Bot,"I am denying you access to this command")
         return 1
      end
   elseif cmd == mcmd.."lock" then
      if user.bOperator then
         LockOut(user)
         return 1   
      end
   end
end

   s,e,cmd = strfind(data,"%b<>%s+(%S+)")
   if cmd == mcmd.."version" then
      user:SendData(Bot,"I am Jason "..Version..", by Phatty")
   return 1
   end
end


Thats the original .lua

Could someone please make the following changes :) PLEASE

Make it standard to pm whoever types the command in main.....

For Ops only, have the ability to pm all

If we edit it like this will we still be able to use same way of storing the files, in the scripts folder under docs??

I will be REALLY grateful to the person who does this for me, if any!

Thanx alot

Woody
Title:
Post by: pHaTTy on 09 January, 2004, 16:15:01
here you go ;)


-- Jason 0.7, by Phatty
-- Jason 0.1 wrote on 5th October 2k3
-- You can add ur own files
-- For example make a file named help.txt in the docs folder and then type in main !show help
-- ATM you cant make files with spaces like....Friday the 13th.txt <<< this will not work, but will add soon :)
-- Don't forget to make a folder named docs inside script folder
-- Added no such file error
-- Added who-to now, !show   =  example !show pmme test
-- There is pmme, me, or all
-- Added !lock
-- Added !version
-- Added self prefix
-- Fixed 1 line read only
-- Few little changed and tweaks

-- Show pmme, all, allpm, me

Bot = "J???"
Version = "0.7"

mcmd="#"

Blacklist={}

function Main()
frmHub:RegBot(Bot)
end

function WhileRead(user,data)
while 1 do
line = read("*a")
if line == nil then
user:SendData(Bot,"I know of no such file")
break
end
if to == "me" then
user:SendData(Bot,line)
elseif to == "all" then
SendToAll(Bot,line)
elseif to == "all" then
SendPmToAll(Bot,line)
elseif to == "allpm" then
user:SendPM(Bot,line)
else
user:SendPM(Bot,line)
end
readfrom()
return 1
end
end

function LockOut(user)
if arg == "on" then
user:SendData(Bot,"You have blacklisted: "..to)
Blacklist[to]=1
buser = GetItemByName(to)
buser:SendPM(Bot,"You have been blacklisted")
return 1
elseif arg == "off" then
user:SendData(Bot,"You have removed "..to.." from the blacklist")
Blacklist[to]=nil
buser = GetItemByName(to)
buser:SendPM(Bot,"You have been removed from the blacklist")
return 1
end
end


function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,to,arg = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)")

if cmd == mcmd.."show" then
if Blacklist[user.sName]==nil then
readfrom("docs/"..arg..".txt")
WhileRead(user,data)
return 1
else
user:SendData(Bot,"I am denying you access to this command")
return 1
end
elseif cmd == mcmd.."lock" and user.bOperator then
LockOut(user)
return 1
elseif cmd == mcmd.."version" then
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
user:SendData(Bot,"I am Jason "..Version..", by Phatty")
return 1
end
end
end


for pm all its !show allpm (whatever)
enjoy ;)
Title:
Post by: Woody on 09 January, 2004, 16:50:14
Thanx for the pmall works a treat

when i type !show test - nothing happens

is it possible for it to pop up in pm by just typing that?
Title:
Post by: pHaTTy on 09 January, 2004, 17:14:03
as long as you dont have txt files named pmall lol

function WhileRead(user,data)
while 1 do
line = read("*a")
if line == nil then
user:SendData(Bot,"I know of no such file")
break
end
if to == "me" then
user:SendData(Bot,line)
elseif to == "all" then
SendToAll(Bot,line)
elseif to == "all" then
SendPmToAll(Bot,line)
elseif to == "allpm" then
user:SendPM(Bot,line)
else
user:SendPM(Bot,line)
end
readfrom()
return 1
end
end


change to

function WhileRead(user,data)
while 1 do
line = read("*a")
if line == nil then
user:SendData(Bot,"I know of no such file")
break
end
if to == "me" then
user:SendData(Bot,line)
elseif to == "all" then
SendToAll(Bot,line)
elseif to == "all" then
SendPmToAll(Bot,line)
elseif to == "allpm" then
user:SendPM(Bot,line)
else
arg = to
user:SendPM(Bot,line)
end
readfrom()
return 1
end
end

Title:
Post by: Woody on 09 January, 2004, 17:28:32
Thanx :) :) :)