PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: GeceBekcisi on 17 October, 2005, 23:53:39

Title: Passive User Limiter
Post by: GeceBekcisi on 17 October, 2005, 23:53:39
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
-- ==================================================