PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: plop on 20 October, 2003, 06:07:50

Title: dc-gui tag checker functions
Post by: plop on 20 October, 2003, 06:07:50
no need 2 ask, free 2 use for every1 in every bot.
dcgui is NOT a fake client.

--original slots/limiter functions made by nathanos (channelbot 0.9f
--modified for dcgui by plop
--tag and version check made by plop
--all stripped from artificial insanety (channelbot 0.9f mod version O.g by plop)
--big thx to yep ([TGA]YEPSSSS) and mathen/ender
--and ofcourse just_a_cat for explaining/showing me a lot about dcgui
--without him yep might not have been able 2 help me



-- this function checks if dcgui has the tag enabled, kick if not found
function CheckIfDcguiHasTagEnabled(user)
   if strfind(user.sMyInfoString, "dc-gui", 1, 1) or strfind(user.sMyInfoString, "dc.ketelhot.de", 1, 1) or strfind(user.sMyInfoString, "DCGUI", 1, 1) then
      if not strfind(user.sMyInfoString, "         user:SendData(" Pls enable your dc tag, you are now being disconnected  |")
         user:Disconnect()
         return
      end
   end
end


-- this function kicks if the dcgui version is to old (keep 12 as minimum, solves the hub tag showing 0 on entry and no faked share posible)
DCGUIMINVERSION = 2
DCGUIMINVERSION2 = 12
function VersionCheckDcgui(user)
   _,b, dcver = strfind(user.sMyInfoString,"V:0.(%x+).%x+")
   _,b, dcver2 = strfind(user.sMyInfoString,"V:0.%x+.(%d+)")
   user:SendData(" The oldest allowed version of Dcgui is 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
   user:SendData(" You are using Dcgui version 0."..dcver.."."..dcver2.." |")
   if (tonumber(dcver2) < DCGUIMINVERSION2) or (tonumber(dcver) < DCGUIMINVERSION) then
      user:SendData(" You are using a to old client use at least version 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
      user:SendData(" you are now being disconnected ... |")
      user:Disconnect()
      return
   end
end


-- this function checks the bandwidth limiter
-- use supressionstate "on" in data arival, "off" in userconnected
function CheckTheBandwidthDcGui(user, suppressionstate)
s,e,dcpp = strfind(user.sMyInfoString, "%$")

if dcpp ~= nil then
      s,e,bandwidth = strfind( dcpp, "L:(%d+%.%d+)")
      s,e,slots = strfind( dcpp, "S:(%d+)")

      if bandwidth == nil then
         s,e,bandwidth = strfind( dcpp "L:(%d+)")
      end

if bandwidth == nil then
bandwidth = "unlimited"
      else
         bandwidth = bandwidth * slots -- the tag shows the speed per slot
end
         
      minBandwidth = MinbandwithlimiterChecker(user)--- use this 1 if you have different settings for different connection types
      --minBandwidth = -- uncomments this line and place the comment on the above line if you use a single setting for all connection types
if suppressionstate == "off" then
user:SendData(" The minimum amount of upload bandwidth in k/s required for your class is set to: "..minBandwidth.." |")
user:SendData(" You currently are sharing with a maximum k/s upload restriction of: "..bandwidth.." |")
if bandwidth ~= "unlimited" then
if (tonumber(bandwidth) < minBandwidth) then
user:SendData(" You do not meet the minimum upload bandwidth required, and are being disconnected ... |")
               user:Disconnect()
return
end
end
elseif suppressionstate == "on" then
if bandwidth ~= "unlimited" then
if (tonumber(bandwidth) < minBandwidth) then
user:SendData(" You no longer meet the minimum upload bandwidth required, and are being disconnected ... |")
user:Disconnect()
return
end
end
end
else
return
end
end


-- this function checks the slots (it normaly kicks, but it can ban user who have isane high amounts of opened slots)
-- use supressionstate "on" in data arival, "off" in userconnected
WAYTOMUCHSLOTS =
function CheckTheSlotsDcGui(user, suppressionstate)
s,e,dcpp = strfind(user.sMyInfoString, "%$")

minSlots = SSBDefinitions(user, "slot")   --- use this 1 if you have different settings for different connection types
   --minSlots = -- uncomments this line and place the comment on the above line if you use a single setting for all connection types

if dcpp ~= nil then
s,e,slots = strfind( dcpp, "S:(%d+)")
      maxSlots = MaxSlotChecker(user)  --- use this 1 if you have different settings for different connection types
      --maxSlots = -- uncomments this line and place the comment on the above line if you use a single setting for all connection types
   
   if slots == nil or slots == 0 then
         user:SendData(" Don't use unlimited slots, your connection isn't unlimited either. use a preset number ... |")
         user:SendData(" you are now being disconnected ... |")
         user:Disconnect()
         return
   end
   
if suppressionstate == "off" then
user:SendData(" The minimum number of open slots required for your class is set to: "..minSlots.." |")
         user:SendData(" The maximum number of open slots required for your class is set to: "..maxSlots.." |")
user:SendData(" You currently have "..slots.." open slot(s). |")
if (tonumber(slots) < minSlots) then
user:SendData(" You do not meet the slot minimum, and are being disconnected ... |")
user:Disconnect()
return
         elseif (tonumber(slots) > maxSlots) then
            if WAYTOMUCHSLOTS ~= 0 then
               if (tonumber(slots)) > WAYTOMUCHSLOTS then
                  user:SendData(" You opened so much slots that your not getting a kick  |")
                  user:SendData(" you are now being banned ... |")
                  user:Ban()
                  return
               end
            end
user:SendData(" You do not meet the slot maximum, and are being disconnected ... |")
user:Disconnect()
return
end
elseif suppressionstate == "on" then
if (tonumber(slots) < minSlots) then
user:SendData(" You no longer meet the slot minimum, and are being disconnected ... |")
user:Disconnect()
return
         elseif (tonumber(slots) > maxSlots) then
            if WAYTOMUCHSLOTS ~= 0 then
               if (tonumber(slots)) > WAYTOMUCHSLOTS then
                  user:SendData(" You opened so much slots that you whill not get a kick  |")
                  user:SendData(" you are now being banned ... |")
                  user:Ban()
                  return
               end
            end
user:SendData(" You no longer meet the slot maximum, and are being disconnected ... |")
user:Disconnect()
return
end
end
else
return
end
end

plop
Title:
Post by: plop on 03 December, 2003, 03:40:44
tiny update.
fixed bug wich caused dcgui version 0.3.0 2 be kicked as being 2 old.
fixed suppresion mode now works correct (damn should have seen this earlyer).

function CheckIfDcguiHasTagEnabled(user, suppressionstate)
   if strfind(user.sMyInfoString, "dc-gui", 1, 1) or strfind(user.sMyInfoString, "dc.ketelhot.de", 1, 1) or strfind(user.sMyInfoString, "DCGUI", 1, 1) then
      if not strfind(user.sMyInfoString, "         user:SendData(" Pls enable your dc tag, you are now being disconnected  |")
         user:Disconnect()
         return 1
      end
   end
end


function VersionCheckDcgui(user, suppressionstate)
   _,b, dcver,dcver2 = strfind(user.sMyInfoString,"V:0.(%x+).(%x+)")
   if suppressionstate == "off" then
      user:SendData(" The oldest allowed version of Dcgui is 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
      user:SendData(" You are using Dcgui version 0."..dcver.."."..dcver2.." |")
   end
   if (tonumber(dcver2) < DCGUIMINVERSION2) and (tonumber(dcver) <= DCGUIMINVERSION) then
      user:SendData(" You are using a to old client use at least version 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
      user:SendData(" you are now being disconnected ... |")
      user:Disconnect()
      return 1
   elseif (tonumber(dcver) < DCGUIMINVERSION) then
      user:SendData(" You are using a to old client use at least version 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
      user:SendData(" you are now being disconnected ... |")
      user:Disconnect()
      return 1
   end
end
plop
Title:
Post by: _Satan_ on 02 October, 2004, 04:54:19
is there a script to deny hub access to those who have limited uplad bandwidths
Title:
Post by: plop on 02 October, 2004, 16:11:19
if they show the tag they cannot hide it so just kick whenever the L: shows in the tag.

plop