PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Genius on 12 September, 2005, 22:01:45

Title: Problem in the script
Post by: Genius on 12 September, 2005, 22:01:45
Hi ppl

I have one big problema in this script


 --## Iniciu do Script LUA 5 ##--
--## Script adaptado DvdRip.sytes.net por [NT]Genius ##--

sBot = "--=(?DvdRip?)=--"

sOpChatName = "--=(?Opchat?)=--"


--## Configura??o ##--

-- Put in this table the Prefixes you want the users to have
 
sPrefix = { "[CV]" ,}

-- Insere nesta tabe?a as rangs dos Users que t?m que uzar o prefixo

arrIP = {
   ["10.6.0.0"] = "10.6.0.30",
   ["84.90.0.0"] = "84.91.255.255",      --  Cabovisao,SA
   ["213.228.128.0"] = "213.228.191.255",   --  Cabovisao,SA
   ["217.129.0.0"] = "217.129.255.255",      --  Cabovisao,SA
}
--## Fim da Configura??o ##--

function Main()
   frmHub:RegBot(sBot)
end

function NewUserConnected(user)
   if (CheckUserPrefix(user) == nil) and not (isGoodIP(user.sIP) == nil) then
      user:SendPM(sBot, "\r\n\r\n        ---={}=-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --={}=---\r\n\r\n                       DvdRip.sytes.net:411\r\n\r\n                       Boas caro utilizador.\r\n                       Vimos por este meio informar que foram postam novas regras em vigor no Hub.\r\n                       Ter?s que acrescentar o prefixo [CV] no teu nickname para puderes efectuar downloads no Hub.\r\n\r\n                          Ex: [CV]user\r\n\r\n                       Estar?s a perguntar a ti mesmo porque temos tal regras no hub. Mas eu explico.\r\n                       Todos sabemos que temos uns fornecedores de Internet [ ISP?s ] muito fatelas, \r\n                      pagamos servi?os que n?o uzamos entre outras injusti?as.\r\n                       No caso do Fornecedor SAPO Adsl ? bastante grave porque todos os downloads que eles fazem\r\n                      dos utilizadores CaboVis?o ou Telepac contam como internacional.\r\n                       Dai existir tal regra. Se todos os Utilizadores usarem uma TAG a mencionar o Fornecedor \r\n                      de Internet [ ISP ] que utiliza, os users podem gerir os seus downloads e tb ter certezas\r\n                      da fonte dos mesmos.\r\n\r\n                       Esta regra ? para ser aplicada. Aviza-mos que quem n?o a cumprir ser? Banido do Hub.\r\n\r\n                       Colaborem n?o custa nada.\r\n\r\n                       DvdRip.sytes.net  -? N?o somos melhores nem piores. Apenas difer?ntes ?-\r\n\r\n                       ---={}=--  Bons Downloads  --={}=---\r\n\r\n        ---={}=-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --={}=---\r\n")
      SendPmToOps(sOpChatName, "   --=( O utilizador "..user.sName.." foi requisitado para usar o prefixo [CV] )=--")
   end
end

OpConnected = NewUserConnected

function ConnectToMeArrival(user,data)
   if (CheckUserPrefix(user) == nil) and not (isGoodIP(user.sIP) == nil) then
      user:SendData(sBot, "\r\n\r\n        ---={}=-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --={}=---\r\n\r\n                       DvdRip.sytes.net:411\r\n\r\n                       Boas caro utilizador.\r\n                       Vimos por este meio informar que foram postam novas regras em vigor no Hub.\r\n                       Ter?s que acrescentar o prefixo [CV] no teu nickname para puderes efectuar downloads no Hub.\r\n\r\n                          Ex: [CV]user\r\n\r\n                       Enquanto n?o o fizeres, ficas impossibilitado de efectuar downloads no Hub.\r\n\r\n        ---={}=-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --={}=---.")
      return 1
   end
end

RevConnectToMeArrival = ConnectToMeArrival

function CheckUserPrefix(user)
   for key,pre in sPrefix do
      if string.find(string.lower(user.sName), string.lower(pre),1,1) then
         return 1
      end
   end
end

function isGoodIP(sIP)
   sIP = ipToNumber(sIP)
   local iFirst,iLast
   for iFirst, iLast in arrIP do
      if (sIP >= ipToNumber(iFirst) and sIP <= ipToNumber(iLast)) then
         return 1
      end
   end
   return nil
end

function ipToNumber(sIP)
   iAux = ""
   string.gsub(sIP,"(%d+)", function(w)
      w = tonumber(w)
      if (w < 10) then
         iAux = iAux.."00"..w
      elseif (w < 100) then
         iAux = iAux.."0"..w
      else
         iAux = iAux..w
      end
   end)
   return tonumber(iAux)
end

--## Fim do Script LUA 5 ##--

Users no receive message and downloads are not blok :S

Please change the script for me

Sory about my bad inglish