Redirect script based on share
 

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

Redirect script based on share

Started by 3lancer, 01 March, 2004, 00:21:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

3lancer

Does anyone know if there is any script that you can run in one hub that will redirect all connecting users to other hubs based upon their share?

\\3lancer

nErBoS

Hi,

Hpoe it helps..

--Requested by 3lancer
--Made by nErBoS

Bot = "Share-Redirecter"

redshare1 = "1.1.1.1"
redshare2 = "1.1.1.2"
share1 = "5" --GB
share2 = "10" --GB

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)

local s,e,share = strfind(user.sMyInfoString, "$MyINFO $ALL [^$]+$ $[^$]*$[^$]*$([^$]+)")
share = share / (1024*1024*1024)

if(share > share1 and share < share2) then
user:SendData("$ForceMove "..redshare1.."|")
elseif(share >= share2) then
user:SendData("$ForceMove "..redshare2.."|")
else
end

end

Best regards, nErBoS
--## nErBoS Spot ##--

3lancer

Thanks nErBoS, I'll try it right away :-)

3lancer

Hmm I can't get it to work...

I've added it as it is...just saved it as lua into the scriptfolder. Shouldn't the script override the hubsettings?

Also I get this message....

Syntax Error: attempt to compare number with string

NightLitch

hopefully a simple correction:

--Requested by 3lancer
--Made by nErBoS

Bot = "Share-Redirecter"

redshare1 = "1.1.1.1"
redshare2 = "1.1.1.2"
share1 = 5 --GB
share2 = 10 --GB

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)

local s,e,share = strfind(user.sMyInfoString, "$MyINFO $ALL [^$]+$ $[^$]*$[^$]*$([^$]+)")
share = share / (1024*1024*1024)

if(tonumber(share) > tonumber(share1) and tonumber(share) < share2) then
user:SendData("$ForceMove "..redshare1.."|")
elseif(tonumber(share) >= tonumber(share2)) then
user:SendData("$ForceMove "..redshare2.."|")
else
end

end

hope this solves your prob.

/NL
//NL

nErBoS

Hi,

Thanks Litch forgot that complety :P

Best regards, nErBoS
--## nErBoS Spot ##--

nErBoS

Hi,

To also evitated the nil error..

--Requested by 3lancer
--Made by nErBoS
--Corrected by NightLitch

Bot = "Share-Redirecter"

redshare1 = "1.1.1.1"
redshare2 = "1.1.1.2"
share1 = 5 --GB
share2 = 10 --GB

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)

local s,e,share = strfind(user.sMyInfoString, "$MyINFO $ALL [^$]+$ $[^$]*$[^$]*$([^$]+)")
share = share / (1024*1024*1024)
if(tonumber(share) ~= nil) then
if(tonumber(share) > tonumber(share1) and tonumber(share) < share2) then
user:SendData("$ForceMove "..redshare1.."|")
elseif(tonumber(share) >= tonumber(share2)) then
user:SendData("$ForceMove "..redshare2.."|")
else
end
else
end

end

Best regards, nErBoS
--## nErBoS Spot ##--

3lancer

#7
Wicked...thanks m8:s

SMF spam blocked by CleanTalk