i have a script of upload limiter for old ptokax can sum1 plz give me a script for new ptokax a working script so tat i can switch to new ptokax again
--[[
LimitCheck 1.0 LUA 5.0/5.1
By Mutor 04/18/07
Requested by vrnutz
Disconnects users with less than 'X' KB/s limit set
]]
--Set your profiles permissions here.
--profile_idx, Check Profile's Limit? [0=no 1=yes], "Profile Name"
local Profiles = {
[-1] = {1,"Unregistered User"},
[0] = {1,"Master"},
[1] = {1,"Operator"},
[2] = {1,"Vip"},
[3] = {1,"Registered User"},
[4] = {1,"Moderator"},
[5] = {1,"NetFounder"},
[6] = {1,"Owner"},
}
--Least permissible bandwidth limit [In KB/s]
local Limit = 1024
Main = function()
local msg = "was removed for setting a limit < "..Limit.." KB/s"
for i,user in ipairs(frmHub:GetOnlineUsers()) do
CheckLimit(user,user.sName.." "..msg)
end
end
MyINFOArrival = function(user,data)
if user.bConnected then
local msg = user.sName.." was removed for setting to limit < "..Limit.." KB/s"
CheckLimit(user,msg)
end
end
CheckLimit = function(user,msg)
if not Profiles[user.iProfile] or Profiles[user.iProfile][1] == 1 then
local a,b = math.max(0,user.iBlimit),math.max(0,user.iLlimit)
local c = math.max(a,b)
if c > 0 and c < Limit then
local usrmsg = user.sName.." you may not limit less than "..Limit..
" KB/s. Please increase your limit by "..(Limit - c ).." KB/s before you return."
msg = msg..". Your limit of "..c.." KB/s is "..(Limit - c ).." KB/s short of acceptable"
return user:SendData(frmHub:GetHubName(),usrmsg),
user:Disconnect(),SendToOps(frmHub:GetHubName(),msg),1
end
end
end
and
userlevels={
[-1]=1,
[0]=5,
[1]=4,
[2]=3,
[3]=2
}
checklevel = 6
upload_limit = 1024
function NewUserConnected(user)
-- user:SendPM("[SECURITY?]","Welcome to THANE CENTRAL")
investigate(user)
end
function MyINFOArrival(user, data)
if user.sMyInfoString and string.len (user.sMyInfoString) > (string.len(user.sName)+13) then
investigate(user)
end
end
function checklimit(user)
if string.find(user.sMyInfoString,"[BLU]") then
local upstream
local _,_,Slots = string.find(user.sMyInfoString, "H:[^,]+,S:(%d+).*>")
local _,_,limit1 = string.find(user.sMyInfoString,"[BLU]:(%d+)")
local _,_,limit2 = string.find(user.sMyInfoString,"F:%d+/(%d+)")
if Slots and Slots~="0" then
if limit1 then
upstream=calclimit(user,limit1,Slots)
elseif limit2 then
upstream=calclimit(user,limit2,Slots)
end
else
user:SendPM("?GiGaByTe?","Please Use Strong dc ,CZDC++ & Xion to limit your upload speed. Settings/Limits/Select Upload limit, Set value 1024.")
user:Disconnect()
end
return upstream
end
end
function calclimit(user,limit,s)
if string.find(user.sMyInfoString,"<DCGUI") then
return tonumber(limit)*tonumber(s)
else
return tonumber(limit)
end
end
function investigate(user)
if checklevel > userlevels[user.iProfile] then
local limit = checklimit(user)
if not limit or limit ~= upload_limit then
user:SendPM("?GiGaByTe?","Set your upload limit to a maximum of "..upload_limit..".Strongdc, CZDC++ & Xion settings are Settings/Limits/Select Upload limit, Set value 1024 EnjoY.")
user:Disconnect()
end
end
end
can sum1 get it converted it wil be great ;D
Could you please post to the right forum next time? Thanks.
(You know, it's easier to convert a script than to write one from scratch, hence this forum.)