i would like a help script that when you type !help say loads a text file up in pm to the user any help please
If you had searched the forum before, you had found this one. Anyway:
-- help script based on rules by jiten
-- Added option to send .txt to Main/PM/All
sConf = {
sBot = frmHub:GetHubBotName(),
sFile1 = "help.txt",
sView = 0 -- 0: Help in PM; 1: Help in Main; 2: Help sent to everyone
}
function Main()
frmHub:RegBot(sConf.sBot)
end
function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
if cmd then
local tCmds = {
["help"] = function(user,data)
if sConf.sView == 0 then
user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
elseif sConf.sView == 1 then
user:SendData(sConf.sBot,ReadFile(sConf.sFile1))
else
SendToAll(sConf.sBot,ReadFile(sConf.sFile1))
end
end,
}
if tCmds[cmd] then return tCmds[cmd](user,data) end
end
end
function ReadFile(file)
local fFile = io.open(file)
if fFile then
local message = ""
for line in io.lines(file) do
message = message..line.."\n"
end
fFile:close()
return message
else
return file.." not found!"
end
end
Cheers
i did search but found that many must have missed it thx for the script anyways