-- Banner script
-- By M-Dreamer
-- Lua 5 version by Markitos
sBot = "G?m?r??T?"
function Main()
frmHub:RegBot(sBot)
end
function ChatArrival(user, data)
if (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) then
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (cmd == "!banner" and user.bOperator) then
local s,e,msg = string.find(data, "%b<>%s+%S+%s+(.+)")
if (msg == nil) then
user:SendData(sBot, "Syntax Erro, !mc , tens de escrever uma mensagem.")
else
local sMsg = "By: "..user.sName.."\r\n"
sMsg = sMsg.."=========================================================================================================\r\n\r\n"
sMsg = sMsg..msg.."\r\n\r\n"
sMsg = sMsg.."=================================================================================================================="
SendToAll(sBot, sMsg)
end
return 1
end
end
end
Hello,
Wonderfull and nice script, but i get an error at "line 22 unexpected symbol near &".
Can anyone help me out with this?
Tnx
Blackrider
That was caused by the lua board, when he pasted it here find "& quot;" and replace with ".
Btw markitos, u forgot to remove the "if (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) then ".
This should be better, but didn't test it.-- Banner script
-- By M-Dreamer
-- Lua 5 version by Markitos
-- Touched by GeceBekcisi ( couldn't resist :P )
sBot = "G?m?r??T?"
function Main()
frmHub:RegBot(sBot)
end
function ChatArrival(curUser, data)
data = string.sub(data,1, -2)
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)")
if (cmd == "banner" and curUser.bOperator) then
local s,e,msg = string.find(data, "%b<>%s+%S+%s+(.+)")
if msg == nil then
curUser:SendData(sBot, "Syntax Error! Usage: !banner ")
else
local sMsg = "By: "..curUser.sName.."\r\n"..
""..string.rep("=",100).."\r\n\r\n"..
""..msg.."\r\n\r\n"..
""..string.rep("=",100).."\r\n\r\n"
SendToAll(sBot, sMsg)
end
return 1
end
end
Best regards
data = string.sub(data,1, -2)
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)")
Could be changed to this :
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)|")
Less code, since thats a simple script.