AuthorMessage
I_Am_Canadian
Clone
Posts: 1

Code:
-- redirector for dchpp by plop.  Moddifed by I_Am_Canadian
-- uses a table of hub's and every new conection user gets,
-- redirected by Min Share
-- Counts how Many users are redirected
tSettings = {
   -- name and level settings of the bot.
   sBot = "Admin",
   iLevel = 0,
   bOp = true,
   
   bRedirect = false, -- enable for default hub (dchpp.xml)
   TotalCount = 0,
   tHubs = {
      --[number] = "url:port",
      [1] = {"lt-100gb.udgnet.com:411", "0", "107374182400"},
      [2] = {"lt-dabasement.udgnet.com:411", "0", "26843545600"}, 
      [3] = {"lt-rock.udgnet.com:411", "0", "21474836480"},
      [4] = {"lt-pirate.udgnet.com:411", "0", "16106127360"},
      [5] = {"lt-master.udgnet.com:411", "0", "10737418240"},     
      [6] = {"lt-langold.udgnet.com:411", "0", "8589934592"},
      [7] = {"lt-hive.udgnet.com:411", "0", "7516192768"},
      [8] = {"lt-thezooo.udgnet.com:415", "0", "5368709120"},
      [9] = {"lt-cp.udgnet.com:1411", "0", "2147483648"},
      [10] = {"lt-sp33dzone.udgnet.com:411", "0", "1073741824"},
      [11] = {"lt-rjont.udgnet.com:714", "0", "524288000"}, 
      [12] = {"trolls.udgnet.scom:411", "0", "0"},
},
   -- no more editable settings below here.
   iCount = 0
}
function dchpp.startup()
   dchpp.addNick(tSettings.sBot, tSettings.iLevel, tSettings.bOp)
   tSettings.iHubs = CountHubs()
end
function dchpp.clientMessage( client, msg )
   local cmd = string.sub( msg, 1, 6 )
   local level = client:getLevel()
   if level >= 3 then   
      if cmd == "+info" then
         dchpp.hubMessage("Total Redirected Users: "..tSettings.TotalCount, tSettings.sbot)
         for i, v in tSettings.tHubs do
             dchpp.hubMessage(tSettings.tHubs[i][1].." Total Users: "..tSettings.tHubs[i][2], tSettings.sbot)
         end
return dchpp.ACTION_STOP
      end
   end
end
function dchpp.userConnected(client)
if client:isOp() then
   client:hubMessage("Welcome Admin, "..client:getNick(), tSettings.sbot)
else      
   for i, v in tSettings.tHubs do
           if client:getShared() > tSettings.tHubs[i][3] then
            client:hubMessage("Redirecting... |$ForceMove "..tSettings.tHubs[i][1].."|", tSettings.sBot)
              end
        end
    tSettings.TotalCount = tSettings.TotalCount + 1
    tSettings.tHubs[(tSettings.iCount)][2] = tSettings.tHubs[(tSettings.iCount)][2] + 1
end
end
function NextHub()
   if tSettings.iCount >= tSettings.iHubs then
      tSettings.iCount = 1
   else
      tSettings.iCount = tSettings.iCount + 1
   end
   return tSettings.tHubs[(tSettings.iCount)][1]
end
function CountHubs()
   local iCount = 0
   for a, b in pairs(tSettings.tHubs) do
      iCount = iCount + 1
   end
   return iCount
end

am trying to get it to redirect a user based on share but it dosent seem to be able to do it