PtokaX forum

Archive => Archived 5.1 boards => Conversion Requests => Topic started by: -SkA- on 11 February, 2008, 13:41:27

Title: MaxLimiter conversion
Post by: -SkA- on 11 February, 2008, 13:41:27
Hi all,

this is one of the last script wich I need the conversion before upgrade my PX to new API  ::)

Quote--[[
   Max uploadlimit check for profiles
   * Stripped From Horus script *
   by C��o�y�� (04/12/07)
   Cleanup by amenay (saw it on the PXA Hub Codeboard and couldn't resist)
]]--

settings = {
   botname = SetMan.GetString( 21 ) or "Bot-Name",
   limiter = {   -- profile number,max limit (0=off)
      [-1] = 20,  -- if user has limit value 40 he gets redirected,if 51 he can login
   },
   redirect = SetMan.GetString( 6 ) or "anyhub.somedns.net";
}

MyINFOArrival = function( user, data )
   if settings.limiter[ user.iProfile ] then
      local sAmount = limitercheck( user )
      if sAmount then
         local sMsg = "Connection limited too much (Found: "..sAmount.." kb/s Limit: "..settings.limiter[user.iProfile].." kb/s)";
         Core.Redirect( user, settings.redirect, sMsg )
         BanMan.TempBanIP( user.sIP, 5, sMsg , settings.botname, false )
      end
   end
end

limitercheck = function( user )
   local amount = Core.GetUserValue( user, 22 ) or Core.GetUserValue( user, 4 ):match( ("^%d+"), 13 );
   amount = tonumber( amount )
   if amount and amount < settings.limiter[ user.iProfile ] and not amount == 0 then
      return amount;
   end
end

It's already been converted by amenay but it doesn't works....

Thanks in advance  ;D
Title: Re: MaxLimiter conversion
Post by: Semjon on 15 February, 2008, 20:51:38
It is a little diffrent, but you can use another script (UpLimit 1.0 L5.1). :) Tell thanks Mutor.  ;)