--Max Slot Per Connection 1.0b -- --by Mutor -- --Requested by exlepra -- --Check users connection type setting, if user slot setting greater than allowed user is kicked. -- --Note: this script cannot check if user has set connection type correctly. -- -- +Changes from 1.0 -- -- + Now checking in DataArrival to catch those who change slot count after login. -- --User Settings------------------------------------------------------------------------------------- Secs = 1 --Delay for kick in seconds, so user gets message Bot = frmHub:GetHubBotName() --Bot name pulled from hub SendPM = "off" --Send message in PM as well as in main chat 'on=yes/off=no' -- Set allowable slots per conection type here MaxSlot = { ["28.8Kbps"] = 1, ["33.6Kbps"] = 2, ["56Kbps"] = 2, ["ISDN"] = 3, ["Satellite"] = 8, ["Cable"] = 6, ["DSL"] = 6, ["LAN[T1]"] = 12, ["LAN[T3]"] = 20 } --End User Settings---------------------------------------------------------------------------------- Kick = {} function Main() SetTimer(Secs*1000) end function DataArrival(user,data) if strsub(data, 1, 12) == "$MyINFO $ALL" then --and not user.bOperator then data = strsub(data, 14, -2) _,_, client = strfind(data,"(%b<>)<") _,_, speed = strfind(data,"[^ ]+ [^$]*%$ $([^$]+)[^$]%$") _,_, slots = strfind(data,"%,S%:(%d+)") Slot = CheckSlot(speed) if client ~= nil then return 1 end if (tonumber(slots)<= tonumber(Slot)) then return 1 else Diff = (tonumber(slots) - tonumber(Slot)) user:SendData(Bot,"\r\n\r\n\tA "..speed.." connection is permitted only "..Slot.." slots.\r\n\tPlease reduce slots by "..Diff.." and then reconnect.\r\n") if SendPM == "on" then user:SendPM(Bot,"\r\n\r\n\tA "..speed.." connection is permitted only "..Slot.." slots.\r\n\tPlease reduce slots by "..Diff.." and then reconnect.\r\n") end Kick[user.sName]=1 StartTimer() end end end function OnTimer() for i,v in Kick do DisconnectByName(i) Kick[i]=nil StopTimer() end end function CheckSlot(speed) for Type, Slot in MaxSlot do if Type == speed then return Slot end end end