Please convert script Slots vs Connection Speed
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

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