PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: badtrip on 10 February, 2005, 21:52:07

Title: DOWLOAD SCRIPT [ Neded ]
Post by: badtrip on 10 February, 2005, 21:52:07
Hello,


I nead a script like this

if the user have 0 of share can not dowload

if the user have 1G of share then the user have permission to dowload


help me please  :(
Title: Download script
Post by: damo on 10 February, 2005, 22:52:23
Try Search for dowload block or leech block.theres a wef about
Title:
Post by: badtrip on 10 February, 2005, 23:47:45
yes i no but i dont find  ?(



helllpppp mmeee  plz
Title: re blocker
Post by: damo on 11 February, 2005, 01:07:49
try this one should work for you.



----------------------
-- GLOBAL VARIABLES --  make changes here only
----------------------
smDebugging       = "1"   -- Default is "0" (silent mode). "1" sends msgs to OPs
smBlockSearches   = "1"   -- Default is "0" (do not block searches)
smBlockSearchExceptions = { "scores", "sheet music" }

MsgToAliens = "\t\t\t*** warning***\r\n\t"..
            "YOU ARE UNABLE TO DOWNLOAD IN THIS HUB\r\n\t"..
            "Only registered users can download.\r\n\t"..
            "...but the hub won't let you download until you register.\r\n"..
            "\tIn order to become a registered member:\r\n\t"..
            "1) Share at least 5GB of files\r\n\t"..
            "2) You have to be vouched for by a operator \r\n\t"
LetLeechCommand = "!letleech"

----------------------------------
-- Do not change anything below --
----------------------------------
smBot = frmHub:GetHubBotName() -- This line gets bot name from PtokaX hubsoftware;
                               -- therefore, your Hub Bot should be enabled.

ToBlock = { "^$ConnectToMe%s(%S+)", "^$RevConnectToMe%s(%S+)", "^$Search%s+(%S+)"}
LetLeech = {}

--// This function is called when hub or script starts
function Main()
  frmHub:EnableFullData(1)
  frmHub:UnregBot(smBot)
  frmHub:RegBot(smBot)
  --// If thus configured, remove search from blocking table:
  if smBlockSearches == "0" then
    for i,v in ToBlock do
      if v == "^$Search%s+(%S+)" then ToBlock = nil end
    end
  end
end

--// This function is fired when a new user (non-OP) finishes login
function NewUserConnected(user)
  if user.iProfile == -1 then
    user:SendPM(smBot,"\r\n"..MsgToAliens)
  end
end

--// This function is fired when new data arrives
function DataArrival (user, data)

  --// See if data is the !letleech command:
  if strsub(data, 1, 1) == "<" then
    local line=strsub(data,1,strlen(data)-1)  -- remove last char
    local s,e,cmd = strfind(line, "%b<>%s+(%S+)")
    local s,e,arg = strfind(line, "%b<>%s+%S+%s+(%S+)")
    if strlower(cmd)==strlower(LetLeechCommand) then
      if user.iProfile ~= 0 and user.iProfile ~= 1 then
        SendToAll(smBot, "...but you are not an OP!")
        return nil
      end
      who = GetItemByName(arg)
      if not who then
        SendToOps(smBot, arg.." is not online.")
        return 1
      end
      if who.iProfile ~= -1 then
        SendToOps(smBot, arg.." is registered and does not need a leech license.")
        return 1
      end
      LetLeech[arg] = 1
      SendToOps(smBot,arg.." has been granted a special leech license.")
      who:SendData(smBot,arg..", you are now authorized to download for this session.")
      return 1
    end
  end

  --// See if data should be blocked:
  for _,blockstring in ToBlock do
    local _, _, who = strfind(data, blockstring)
    if who then return smBlock(user,data,who) end
  end
end

function smBlock(user,data,who)
  local report
  local profnam = GetProfileName(user.iProfile)
  if profnam then
    profnam = strlower(profnam)
  else
    profnam = "alien"
  end
--// Activity by Masters, OPs, VIPs and REGs are just reported to OPs:
--// Also, searches pass if they are in the exception list:
--// Data also passes if user is in LetLeech list:
  if (user.iProfile ~= -1) or smMatchException(data)
      or IsInLeechList(user) then
    report = "\t"..user.sName.." ("..profnam..") sends:\r\n\t"..data
    smDebugToOPs(report)
    return nil
  end
--// Alien (not registered) users get blocked:
  local report = "\tBlocked from "..user.sName.." ("..
        profnam.."):\r\n\t"..data
  smDebugToOPs(report)
  return 1
end

function smMatchException(data)
  if strfind (data, "^$Search%s+(%S+)") then
    for _,exceptword in smBlockSearchExceptions do
      if strfind (strlower(data), strlower(exceptword)) then
        return 1
      end
    end
  end
  return nil
end

function IsInLeechList(user)
  for i,v in LetLeech do
    if i == user.sName then return 1 end
  end
  return nil
end

function smDebugToOPs(data)
  if smDebugging == "1" then
    SendToOps(smBot,data)
  end
end
Title:
Post by: badtrip on 11 February, 2005, 01:23:16
tk?s friend but i dont nead this one, i nead a blocker only for 0 bits share user , i nead a dowload blocker to block users whith < 1G of share