Share Restrict
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
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

Share Restrict

Started by sky202_how89, 27 September, 2010, 00:00:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sky202_how89

Mutor,

I'm wondering....
Can you rebuilt this script for Ptokax Latest Version.
I have discovered you had the script with Share Restrict 1.0 LUA 5.1 [Strict] but it's incompatible with the version right now.

I'm really appreciate it.

This is your code previously.
--[[

    Share Restrict 1.0 LUA 5.1 [Strict]
    
    By Mutor    08/03/07
    
    Requested by sphinx_spb
    
    Restricts downloads and searches by share amount.
    
    - Separate minimum share limits for xfer & search
    - Returns fraudulent search result for blocked users
    - Exclude block by profile and or nick
    - Option to tempban for > preset attempt count
    
    

]]

-- A name for the bot
local Bot = frmHub:GetHubBotName()
-- Minimum share required to transfer files
local XferMin = 5
-- Minimum share required to search the hub
local SearchMin = 8
-- Max transfer attempts before user is disconnected [0 = disable]
local MaxTry = 0
-- Exclude by Nicks
local Exclude = {
    ["zMutor"] = 1,
    ["OtherNick"] = 1,
    }
-- Exlude by profiles
-- [#] = 0/1, (0 = Exlude profile from block, 1 = Block this profiles transfer/search)
local Profiles  = {
    [-1] = 1,    -- Unregistered User
    [0] = 1,    -- Master
    [1] = 1,    -- Operator
    [2] = 0,    -- VIP
    [3] = 1,    -- Registered User
    [4] = 0,    -- Moderator
    [5] = 0,    -- NetFounder
    [6] = 0,    --Owner
    }

local Nicks = {}
Main = function()
    XferMin,SearchMin = (XferMin * (1024^3)),(SearchMin * (1024^3))
end

ConnectToMeArrival = function(user, data)
    if not Exclude[user.sName] then
        if not Profiles[user.iProfile] or Profiles[user.iProfile] == 1 then
            local s = ""
            if MaxTry > 0 then
                if not Nicks[user.sName:lower()] then
                    Nicks[user.sName:lower()] = 1
                else
                    Nicks[user.sName:lower()] = Nicks[user.sName:lower()] + 1
                end
                s = "("..Nicks[user.sName:lower()].." / ".. MaxTry..")"
                if Nicks[user.sName:lower()] > MaxTry then
                    Nicks[user.sName:lower()] = nil
                    return user:SendData(Bot,"You failed to heed  "..MaxTry.." warnings "..
                    "about attempting transfers. you will now be disconnected from the hub."),
                    user:TempBan(0, "Continued attempted transfer "..MaxTry.."x",Bot,0),1
                end
            end
            if user.iShareSize < XferMin or not user.bConnected then
                return user:SendData(Bot,"Sorry "..user.sName..", "..frmHub:GetHubName().." requires "..
                "you to share "..FmtSz(XferMin).." to enable file transfers."),
                user:SendData(Bot,"Your share of "..FmtSz(user.iShareSize).." is "..
                FmtSz(XferMin - user.iShareSize).." short of the limit."),
                user:SendData(Bot,"Please remove the transfer from your download queue "..
                "or you will be disconnected from the hub. "..s),1
            end
        end
    end
end
RevConnectToMeArrival = ConnectToMeArrival

SearchArrival = function (user, data)
    if not Exclude[user.sName] then
        if not Profiles[user.iProfile] or Profiles[user.iProfile] == 1 then
            if user.iShareSize < SearchMin or not user.bConnected then
                local hn,ip,pt = frmHub:GetHubName(),frmHub:GetHubIp(),frmHub:GetHubUdpPort()
                local s,e,search = string.find(data,"([^?]+)|$")
                search = search or "Invalid String"
                local res = "Unknown Path"..string.char(92)..user.sName..", search is "..
                "disabled for you :P "..string.rep("\t",75)..search
                user:SendData("$SR "..frmHub:GetHubBotName().." "..res..
                " 0 0/0"..hn.." ("..ip..":"..pt..")")
                user:SendData(Bot,"Sorry "..user.sName..", "..frmHub:GetHubName().." requires "..
                "you to share "..FmtSz(SearchMin).." to enable searching.")
                user:SendData(Bot,"Your share of "..FmtSz(user.iShareSize).." is "..
                FmtSz(SearchMin - user.iShareSize).." short of the limit.")
                return 1
            end
        end
    end
end

FmtSz = function(int)
    local i,u,x=tonumber(int) or 0,{"","K","M","G","T","P"},1
    while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u[x])
end


My Best Regards,
SKy

sky202_how89


SMF spam blocked by CleanTalk