PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: CookieMonster on 29 March, 2004, 01:37:03

Title: No D/l Script for testdrive 4.99
Post by: CookieMonster on 29 March, 2004, 01:37:03
I used to belong to a hub that ran a script that stopped people who wernt reg'ed from d/ling anything does anyone know where i can get this script or its name??????

Thanks
Title:
Post by: KX250 on 29 March, 2004, 01:43:26
that hub Software is unofficial!
Title:
Post by: [G-T-E]Gate? on 29 March, 2004, 01:43:27
Try This , may be an update , dont know. Good Luck

code
---------------------
-- LEECHBLOCKER 01 --    for PtokaX TD4
---------------------
-- Created by SAMPLERman - HUB: samplerman.no-ip.info
-- 2/August/2003
-- Based on an idea by OpiumVolage and RabidWombat (greetings)

-- This LUA script prevents users that are not registered in the hub (=aliens)
-- from connecting to other users (for downloading).
-- New users (=aliens) can chat, upload and be searched. They just can't download.
-- Optionally, the script also blocks searches (from nonregged users).
-- This way your previously private hub can again be public,
-- in a sort of semi-open way.

-- To do for next version:
-- Add a !letleech command for OPs to allow an alien to download for 1 session

-------------------------------
-- SOURCES OF SCRIPTING INFO --
-------------------------------
-- Scripting.txt (comes with PtokaX)
-- http://lua.bcs-solutions.de/
-- LUA reference manual 4.0.pdf

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

MsgToAliens = "\t\t\twarning\r\n\tYOU ARE NOT A REGISTERED USER OF THIS HUB\r\n\t"..
            "Therefore, you are automatically prevented from downloading.\r\n\t"..
            "You can search and chat...\r\n\t"..
            "...but you won't be able to download until you register.\r\n"..
            "\tIn order to become a registered member:\r\n\t"..
            "1) Share classical sheet music in a separate folder called SCORES\r\n\t"..
            "2) only then, ask an OP for a password."

----------------------------------
-- Do not change anything below --
----------------------------------
smScriptVersion = "01"
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+)"}

--// 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

function DataArrival (user, data)
  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:
  if (user.iProfile ~= -1) or smMatchException(data) 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 smDebugToOPs(data)
  if smDebugging == "1" then
    SendToOps(smBot,data)
  end
end
Title: YAY
Post by: CookieMonster on 29 March, 2004, 02:09:44
Thanks gate :)
Title:
Post by: frankyk on 31 March, 2004, 08:16:27
I have a hub that doesn't allowed unreg users in, is there a way to have this script modified so that a user can be blacklisted if they do something wrong and can't download for "X" amount of hours which can be specified by a command?