Please convert script Slots vs Connection Speed
 

Please convert script Slots vs Connection Speed

Started by Zigurds, 04 March, 2005, 21:26:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zigurds

-- Slots vs Connection Speed by   [aXs] Wellx   11/06-03
-- Thx goes to Sedulus & aMutex for idea's and help
-- This script checks for slots vs speed and Disconnect if not Master/Operator/VIP
-- Optimized a bit made some no-used code at first...p

Connection={}
Connection["28.8Kbps"] = 4   
Connection["33.6Kbps"] = 4
Connection["56Kbps"] = 4
Connection["ISDN"] = 6
Connection["Satellite"] = 6
Connection["Cable"] = 8
Connection["DSL"] = 12
Connection["LAN(T1)"] = 18
Connection["LAN(T3)"] = 21

function DataArrival(curUser, data)
   if string.sub( data, 1, 8 ) == "$MyINFO " and (curUser.iProfile < 0 or curUser.iProfile > 2) then
   SlotsCheck(curUser, string.sub(data, 1, string.len(data) -1))
   end
end

function SlotsCheck(curUser, myinfo)   
local s,e,Slots,speed = string.find(myinfo, "S:([^,>]+).*>$ $([^$]*)")  
local Slots = tonumber(Slots)  
   if speed then
   local speed = string.sub(speed,1,string.len(speed)-1)
      if Connection[speed] and Slots > Connection[speed] then
      curUser:SendPM("<-SLOTBOTS->", "Par daudz atveertu slotu shim piesleegumam! Maksimums ir ("..Connection[speed]..") Tev atveerti ("..Slots..") sloti")
--      SendToOps("<-SLOTBOTS->","*** Juuzeris <"..curUser.sName.."> IP <" ..curUser.sIP.."> Nepareizs slotu skaits! Atvienots:)")
      curUser:Disconnect()
      end
   end
end

-------------------------------------
owner for Latvian hub Alfa

PPK

-- PtokaX with Lua 5 version by PPK

-- Slots vs Connection Speed by [aXs] Wellx 11/06-03
-- Thx goes to Sedulus & aMutex for idea's and help
-- This script checks for slots vs speed and Disconnect if not Master/Operator/VIP
-- Optimized a bit made some no-used code at first...p

Connection={}
Connection["Modem"] = 4
Connection["28.8Kbps"] = 4
Connection["33.6Kbps"] = 4
Connection["56Kbps"] = 4
Connection["ISDN"] = 6
Connection["Satellite"] = 6
Connection["Wireless"] = 6
Connection["Cable"] = 8
Connection["DSL"] = 12
Connection["LAN(T1)"] = 18
Connection["LAN(T3)"] = 21

function MyINFOArrival(curUser, data)
	if curUser.iProfile < 0 or curUser.iProfile > 2 then
		SlotsCheck(curUser)
	end
end

function SlotsCheck(curUser)
	if curUser.sConnection then
		if Connection[curUser.sConnection] and curUser.iSlots > Connection[curUser.sConnection] then
			curUser:SendPM("<-SLOTBOTS->", "Par daudz atveertu slotu shim piesleegumam! Maksimums ir ("..Connection[curUser.sConnection]..") Tev atveerti ("..curUser.iSlots..") sloti")
			-- SendToOps("<-SLOTBOTS->","*** Juuzeris <"..curUser.sName.."> IP <" ..curUser.sIP.."> Nepareizs slotu skaits! Atvienots:)")
			curUser:Disconnect()
		end
	end
end
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Zigurds

Thanks, work ok :)

uffetjur

thinks the connection checker aint doin any good because for example with client fulDC u can set whatever u like in connection info, and most users never set it correct because it has no affect on clients
Somewhere in Cyberspace

SMF spam blocked by CleanTalk