PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: RDB on 17 April, 2004, 21:43:18

Title: New Window
Post by: RDB on 17 April, 2004, 21:43:18
I currently use this script

BotName = "Hub bot"
Files = {
["+hubnews"] = "Section/news.txt",
["+com"] = "Section/commands.txt",
["+links"] = "Section/links.txt", --If you're using CHANEEL, don't uncomment this line
}
function Main()
end
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
s,e,msg = strfind(data, "%b<> ([ -z]*)")
for key, value in Files do
if( strfind( strlower(msg), key) ) then
txtToShow, x = gsub(value, "%b[]", user.sName)
SendToAll( data )
Show(user, TheFile)
return 1
end
end
end
end
function Show(user, TheFile)
readfrom(txtToShow, "r")
local message = ""
while 1 do
local line = read()
if line == nil then break
else
message = message..line.."\r\n"
end
end
user:SendPM(BotName, message)
readfrom()
return 1;
end

However, the commands arent supressed in main, i.e. they are shown in main chat. Ive been told to add return 1 in there - but its already there.

Any help greatly appreciated.

Thank you in advance
Title:
Post by: nErBoS on 17 April, 2004, 22:09:48
Hi,

Remove this line...

SendToAll( data )
Best regards, nErBoS
Title:
Post by: RDB on 18 April, 2004, 01:35:01
Thanks, that works, is it possible to have the command, instead, sent to all OPs? so ops know who is typing it in in case the hub starts to lag they will have a fair idea of what is going on.

Thanks in advance
Title:
Post by: Sprinting on 18 April, 2004, 02:03:41
even if that script was used properly and not abused, don't you think that pm'ing all ops when it is used would get a little annoying? I know my ops wouldn't want it but it's your hub.......

cheers
Title:
Post by: nErBoS on 18 April, 2004, 02:24:15
Hi,

Here you had the "SendToAll( data )" put this...

SendToOps( data )
Best regards, nErBoS
Title:
Post by: RDB on 18 April, 2004, 02:31:14
unfortunately ops do not get that message  ?(

Using:

BotName = "HouseBot"
Files = {
["!gun"] = "Files/gun.txt",
["!p"] = "Files/p.txt",
["!kickass"] = "Files/kickass.txt",  --If you're using CHANEEL, don't uncomment this

line
}
function Main()
end
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
s,e,msg = strfind(data, "%b<> ([ -z]*)")
for key, value in Files do
if( strfind( strlower(msg), key) ) then
txtToShow, x = gsub(value, "%b[]", user.sName)
SendToOps( data )
Show(user, TheFile)
return 1
end
end
end
end
function Show(user, TheFile)
readfrom(txtToShow, "r")
local message = ""
while 1 do
local line = read()
if line == nil then break
else
message = message..line.."\r\n"
end
end
SendToAll(BotName, message)
readfrom()
return 1;
end
Title:
Post by: nErBoS on 18 April, 2004, 03:09:24
Hi,

Try this then...

SendToOps(BotName, data)
Best regards, nErBoS
Title:
Post by: pHaTTy on 18 April, 2004, 03:38:27
first of all please remember to use the [code ] [ /code] tag around the script

ok u could do

SendToOps(user.sName,msg)

BotName = "HouseBot"

Files = {
["!gun"] = "Files/gun.txt",
["!p"] = "Files/p.txt",
["!kickass"] = "Files/kickass.txt", --If you're using CHANEEL, don't uncomment this line
}


function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
local s,e,msg = strfind(data, "%b<> ([ -z]*)")
for key, value in Files do
if( strfind( strlower(msg), key) ) then
txtToShow, x = gsub(value, "%b[]", user.sName)
SendToOps(user.sName,msg)
Show(TheFile)
return 1;
end;
end;
end;
end;

function Show(TheFile) -- Was no point sending user
readfrom(txtToShow, "r")
local message = "\r\n"
while 1 do
local line = read()
if line == nil then break
else
message = message..line.."\r\n"
end;
end;
SendToAll(message) --Dont really need the bot name ;-)
readfrom()
return 1;
end;

Title:
Post by: RDB on 18 April, 2004, 14:14:00
Thanks.

Would it be possible to have this sent in a pm thru the hub's bot? I tried changing

SendToOps(user.sName,msg)
TO:

SendPMToOps(user.sName,msg)
But no luck  :(
Title:
Post by: Snooze on 18 April, 2004, 14:36:15
just change

SendPMToOps(user.sName,msg)
to

SendPmToOps(user.sName,msg)

You had a BIG 'PM' in there when it should have been 'Pm'.


Good luck..

**Snooze