Author Topic: Banner script  (Read 2417 times)

0 Members and 1 Guest are viewing this topic.

Markitos

  • Guest
Banner script
« on: 17 October, 2005, 13:34:42 »
Code: [Select]
-- 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
« Last Edit: 17 October, 2005, 13:35:53 by Markitos »

PtokaX forum

Banner script
« on: 17 October, 2005, 13:34:42 »

Offline Blackrider

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
(No subject)
« Reply #1 on: 19 November, 2005, 10:07:42 »
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

Offline Dessamator

  • Scripter
  • Emperor
  • ******
  • Posts: 1 262
  • Karma: +13/-9
(No subject)
« Reply #2 on: 19 November, 2005, 11:06:37 »
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 ".
Ignorance is Bliss.

Offline GeceBekcisi

  • Scripter
  • Lord
  • ******
  • Posts: 311
  • Karma: +10/-1
  • You don't need eyes to see, you need vision..
(No subject)
« Reply #3 on: 19 November, 2005, 11:31:00 »
This should be better, but didn't test it.
Code: [Select]
-- 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
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

Offline Dessamator

  • Scripter
  • Emperor
  • ******
  • Posts: 1 262
  • Karma: +13/-9
Looks good, but..
« Reply #4 on: 19 November, 2005, 12:20:23 »
Code: [Select]
data = string.sub(data,1, -2)
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)")


Could be changed to this :
Code: [Select]
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)|")

Less code, since thats a simple script.
Ignorance is Bliss.

PtokaX forum

Looks good, but..
« Reply #4 on: 19 November, 2005, 12:20:23 »