PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: 3lancer on 01 March, 2004, 00:21:22

Title: Redirect script based on share
Post by: 3lancer on 01 March, 2004, 00:21:22
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
Title:
Post by: nErBoS on 01 March, 2004, 00:35:49
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
Title: Redirect script based on share
Post by: 3lancer on 01 March, 2004, 00:40:33
Thanks nErBoS, I'll try it right away :-)
Title:
Post by: 3lancer on 01 March, 2004, 01:32:10
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
Title:
Post by: NightLitch on 01 March, 2004, 01:34:20
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
Title:
Post by: nErBoS on 01 March, 2004, 01:39:12
Hi,

Thanks Litch forgot that complety :P

Best regards, nErBoS
Title:
Post by: nErBoS on 01 March, 2004, 01:47:28
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
Title:
Post by: 3lancer on 01 March, 2004, 02:01:29
Wicked...thanks m8:s