Author Topic: Can someone covert Banner 1.0b for the new API  (Read 2439 times)

0 Members and 1 Guest are viewing this topic.

Offline ThugLife

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Can someone covert Banner 1.0b for the new API
« on: 06 February, 2008, 22:34:58 »
Code: Lua
  1.  
-- Banner 1.0b LUA 5.1
-- by American Idiot The Ugly 7/15/05
--
--      +Changes from 1.0 12/23/05
--         +Added centering function
--         +Added border 2
--
--              +Converted to 5.1 03/21/06
--
--
--????[ User Settings ]??????????????????????????????????????????????????????????
--Send command
BannerCmd = "+banner"
--Max length of allowed banner
MaxLength = 1000
--Border charachter for banner ad
BorderChar1 = "="
--Name for bot
--Bot = frmHub:GetHubBotName()
BannerBot = "PtokaX"
--Menu name pulled from hub, uses hub name for menu
Menu = frmHub:GetHubName()
--Custom submenu
SubMenu ="General"
--Who may use this command/receive context menu
Profiles  = {
[-1] = 0, --Unregistered User
  • = 1, --Master
  • [1] = 1, --Operator
    [2] = 1, --Vip
    [3] = 0, --Registered User
    [4] = 1, --Moderator
    [5] = 1, --NetFounder
    }
    --????[ End User Settings ]??????????????????????????????????????????????????????

    function Main()
       if BannerBot ~= frmHub:GetHubBotName() then
          frmHub:RegBot(BannerBot, 1, "I Send Banner Advertisements", "")
       end
    end

    function NewUserConnected(user)
       if Profiles
[user.iProfile] == 1 then
      user:SendData("$UserCommand 1 3 "..Menu.."\\"..SubMenu.."\\Hub Banner $<%[mynick]> "..BannerCmd.." %[line:Banner Text]&#124;")
   end
end

OpConnected = NewUserConnected

function ChatArrival(user, data)
data=string.sub(data,1,-2)
local s,e,cmd = string.find(data, "%b<>%s+(%p%w+)")
local s,e,advert = string.find(data,"%b<>%s+%S+%s+(.+)")
   if (cmd==BannerCmd) then
         if not advert then
            local reply1 = "Nothing to send, try again."
            user:SendData(reply1)
            return 1
         elseif Profiles[user.iProfile] == 1 then
            if cmd and advert then
               if string.len(advert) > MaxLength then
                  local reply2 = "\tThat banner has too many charachters ["..string.len(advert).."]. "..
                  "The maximum number characters allowed is "..MaxLength
                  user:SendData(reply2)
                  return 1
               else
                  SendBanner(user,advert)
                  return 1
               end
            end
         else
            SendToNick(user.sName,"Sorry "..user.sName..", your not allowed use of the "..BannerCmd.." command.")
            return 1
         end
   end
end

function SendBanner(user,advert)
   local border = "\r\n\r\n"
   local border1 = border..string.rep("=",10).." Banner by "..user.sName.." "..string.rep("=",75).."\r\n\r\n"
   local border2 = border..string.rep("=",75).." Banner by "..user.sName.." "..string.rep("=",10)..".\r\n."
   if user and advert then
      SendToAll(BannerBot,border1..Spacer(advert,string.len(border1))..advert..border2)
   return 1
   end
end

Spacer = function(str,len)
   if str then
   local tab = ""
      if string.len(str) < len then
         local count = ((len - string.len(str)) / 2) / 10
         if count > 0 then
            for x = 1,count do
               tab = tab.."\t"
            end
         end
      end
   str = nil
   return tab
   end
end
Code: Lua
  1.  
Skype: galin93

PtokaX forum

Can someone covert Banner 1.0b for the new API
« on: 06 February, 2008, 22:34:58 »