Passive User Limiter
 

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

Passive User Limiter

Started by GeceBekcisi, 17 October, 2005, 23:53:39

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GeceBekcisi

Do you dislike passive users? Want to force them to use active mode in a kind way? With this script you can limit max number of passive users in your hub and specify a different minimum share size and slots limit for passive users.

Best Regards
-- ==================================================
--// PassiveLimiter by GeceBekcisi, 18-10-2005
--// Limits max number of passive users and specifies
--// different share & slot limits for them
--// Rules doesn't apply for operators
-- ==================================================
-- Bot nick to send information with on disconnection
sBotName = frmHub:GetHubBotName()
-- Passive user ratio to all users in %
iPassiveUserRatio = 25
-- Passive user share limit ratio ( X times normal limit specified in hub)
iPassiveShareRatio = 2
-- Passive user slot limit ratio ( X times normal limit specified in hub)
iPassiveSlotRatio = 1.5
-- Passive user counter (DO NOT TOUCH!)
iPassiveUsers = 0
-----------------------------------------------------
function NewUserConnected(curUser)
	if not curUser.bOperator and not curUser.bActive then
		iPassiveUsers = iPassiveUsers + 1
	end
end

function MyINFOArrival(curUser, sData)
	if not curUser.bOperator and not curUser.bActive then
	local iMaxPassiveUsers = tonumber(string.format("%.0f",((frmHub:GetUsersCount()*iPassiveUserRatio)/100)))
		if iPassiveUsers > iMaxPassiveUsers then
				curUser:SendData(sBotName, "Our passive user limit is exceeded and you're not allowed to enter our hub now. Please try later or use active mode. Thanks...")
				curUser:Disconnect()
		else
			if (curUser.iShareSize < frmHub:GetMinShare()*iPassiveShareRatio) then
				curUser:SendData(sBotName, "You share ("..string.format( "%.2f",(curUser.iShareSize/(1024*1024*1024)))..") GiB, but the min share rule is ("..string.format( "%.2f",(2*frmHub:GetMinShare()/(1024*1024*1024)))..") GiB for passive users. So you can't enter our hub.")
				curUser:Disconnect()
			end
			if (curUser.iSlots < (frmHub:GetMinSlots()*3)/2) then
				curUser:SendData(sBotName, "You have opened ("..curUser.iSlots..") slots, but the min slots rule is ("..tonumber(string.format("%.0f",(frmHub:GetMinSlots()*tonumber(iPassiveSlotRatio))))..") slots for passive users. So you can't enter our hub.")
				curUser:Disconnect()
			end
		end
	end
end

function UserDisconnected(curUser)
	if not curUser.bOperator and not curUser.bActive then
		iPassiveUsers = iPassiveUsers - 1
	end
end
-- ==================================================
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

SMF spam blocked by CleanTalk