Can someone covert Banner 1.0b for the new API
 

News:

11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Can someone covert Banner 1.0b for the new API

Started by ThugLife, 06 February, 2008, 22:34:58

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ThugLife

Code: lua

-- Banner 1.0b LUA 5.1
-- by Mutor 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
Skype: galin93

SMF spam blocked by CleanTalk