PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: SilentHunterKiller on 05 August, 2005, 09:30:48

Title: Network hub pinger redirect Manager --> to LUA5
Post by: SilentHunterKiller on 05 August, 2005, 09:30:48
--============================================================

--========= Network hub pinger redirect Manager ==============

--============= By ??????Hawk?????? 25-05-04 =================

--============================================================

--=====This Script is designed to be run on its own hub ======

--======= Use another Ptokax hub on a different port =========

--============================================================

--========== +rdon = enable / +rdoff = disable ===============



--================== Editable settings =======================



sBot = "Network-Redirector-" --// Bot name

DefaultHub = "DefaultHub.no-ip.org:411" --// Default redirect hub Addy:Port

RedirectsEnabled = "true" --// true/false Auto start

mins = 1 --// Ping Next Hub after # mins

Hub_Adress = {

"Hub1.no-ip.com",

"411",

"Hub2.no-ip.org", --// Hubs In network

"415", --// you can add / remove as many as you want

"Hub3.servemp3.com", --// but keep the same layout

"412", --// hub  then port

"Hub4.no-ip.org",

"417",

"Hub5.servemp3.com",

"411",

"Hub6.no-ip.com",

"414",

"Hub7.no-ip.com",

"412",

 }



--=========  Mess With The Below at your own Peril ===========

Onlinehubs = {}

HubCounter = 1

curenthub = 1

curentport = 2

function Main()

hubcount = getn(Hub_Adress)

SetTimer(1000 * 60 * mins)

if RedirectsEnabled == "true" then

StartTimer()

end

end



function NewUserConnected(curUser)

if (RedirectsEnabled == "false") then

frmHub:SetRedirectAddress(DefaultHub)

end

SendToNick(curUser.sName, "<" ..sBot .."> Redirecting... |$ForceMove "..frmHub:GetRedirectAddress().."|")

end



function DataArrival(user, data)

  local data=strsub(data,1,strlen(data)-1)

local s,e,cmd = strfind(data,"%b<>%s+(%S+)")

if cmd=="+rdon" then

SendToOps(sBot," Redirects enabled ")

StartTimer()

RedirectsEnabled = "true"

elseif cmd=="+rdoff" then

SendToOps(sBot," redirects disabled ")

  StopTimer()

  RedirectsEnabled = "false"

end

end



function OnTimer()

if curentport == hubcount + 2 then

curenthub = 1

curentport = 2

end

displayhub(curenthub,curentport)

curenthub = curenthub + 2

curentport = curenthub + 1



frmHub:SetRedirectAddress(Onlinehubs[HubCounter])

if (getn(Onlinehubs) == 0)  then

frmHub:SetRedirectAddress(DefaultHub)

end

if HubCounter == getn(Onlinehubs) then

HubCounter = 1

else

HubCounter = HubCounter + 1

end

CurrentOnlineHubs()

end



--============================================================

--===================! ! !  PING ! ! ! =======================



function displayhub(curenthub,curentport)

local a = connect(Hub_Adress[curenthub],Hub_Adress[curentport])

CurrentChecking = Hub_Adress[curenthub]..":"..Hub_Adress[curentport]

Active = "false"

ActiveHubCount = getn(Onlinehubs) + 1

for index, value in Onlinehubs do

if Onlinehubs[index] == CurrentChecking then

    Active = "true"

    Position = index

end

end

if a == nil then

if Active == "false" then

SendToOps(sBot,CurrentChecking.."   Hub is still Offline")

elseif Active == "true" then

SendToOps(sBot,CurrentChecking.."   Hub Has Gone Offline")

Onlinehubs[Position] = nil

end



else

if Active == "false" then

SendToOps(sBot,CurrentChecking.."   Has Come Online")

Onlinehubs[ActiveHubCount] = CurrentChecking

elseif Active == "true" then

SendToOps(sBot,CurrentChecking.."   Hub is still online")

end



a:close()

end

end



--============================================================

--===================! ! !  PONG ! ! ! =======================



function CurrentOnlineHubs()

local names = "\r\n\r\n-------------Curent Online Hubs----------------\r\n\r\n\t"

for index, value in Onlinehubs do

local line = index

names = names.." "..Onlinehubs[line].."\r\n\t"

end

names = names.."\r\n\r\nCurently Redirecting to "..frmHub:GetRedirectAddress().."\r\n\r\n"

SendToOps(sBot,names)

end



--===================== End Of Script ========================


Hy all, is there anyone so gentile that can translate this lus4 script into lua5, it's what i was searching for since june... :))

P.S: this script was created by  ??????HAWK??????  :D
Title:
Post by: ??????Hawk?????? on 05 August, 2005, 09:47:00
hi m8  ..  it  cant be  done  at the moment ...
Title:
Post by: SilentHunterKiller on 05 August, 2005, 10:06:27
:( got an alternative solution like this one... or can i try to make it to lua5 myself ( it will take a year )
Title:
Post by: Dessamator on 05 August, 2005, 10:51:48
it cant be done as in , its not possible with the current ptokax
Title:
Post by: ??????Hawk?????? on 05 August, 2005, 14:39:28
QuoteOriginally posted by SilentHunterKiller
:( got an alternative solution like this one... or can i try to make it to lua5 myself ( it will take a year )

you could try terminator  as the GUI has it built in.   :))
Title:
Post by: SilentHunterKiller on 05 August, 2005, 15:56:40
tryed... but it doesn't work... :'(  i only need that script...
Title:
Post by: SilentHunterKiller on 05 August, 2005, 16:01:28
couldn't i just use an old version of the ptokax insted ???
Title:
Post by: Markitos on 05 August, 2005, 16:23:11
QuoteOriginally posted by SilentHunterKiller
couldn't i just use an old version of the ptokax insted ???
i would think 2 times be4 do that...
Title:
Post by: SilentHunterKiller on 05 August, 2005, 16:49:36
u say... i don't need it as a hubserver just a redirect hub... but does it have lots of bugs ??? or what...
Title:
Post by: Madman on 05 August, 2005, 17:24:18
I got a simple redirect script...
i just choose addys random from an table.. no check if the is online and shit...
Title:
Post by: SilentHunterKiller on 05 August, 2005, 20:44:32
it coulf help...nut that was the part that interested me... the online check
Title:
Post by: Madman on 06 August, 2005, 00:26:17
-- Network redirecter
-- Made by Madman

Bot = "NetworkRedirector"

Addys = {
"Addy1.no-ip.org",
"Addy2.myftp.com",
}

function NewUserConnected(curUser, data)
if Redirect == 1 then
curUser:SendData(Bot, "Redirecting..")
curUser:Redirect(Addys[math.random(table.getn(Addys))])
end
end

function ChatArrival(curUser, data)
local data =  string.sub(data, 1, -2)
local s,e,cmd = string.find(data, "%b<>%s+[%!%+%#%?](%S+)")
if cmd then
local tCmds = {
["rdon"] = function(curUser, data)
SendToOps(Bot, "Redirects enabled by " ..curUser.sName)
Redirect = 1
return 1
end,
["rdoff"] = function(curUser, data)
SendToOps(Bot, "Redicrects disabled by " ..curUser.sName)
Redirect = 0
return 1
end,
}
if tCmds[cmd] then
return tCmds[cmd](curUser, data)
end
end
end

There you go... =)
Title:
Post by: SilentHunterKiller on 06 August, 2005, 17:36:22
tnx... mad

but in the end i installed an old ptokax 15.30 and run the old script... i ha ve a little problem... :(
it just blocks it always redirects to the " DefaultHub "
how come ???
Title:
Post by: Rick on 27 September, 2005, 12:33:34
I'd be interested in something that would network 5 hub locations!
We tried terminator but too much was going wrong and the networking wasn't working

Hawk - when Terminator is installed we have to name a bot - that bot has a 20+GB share, apparantly your email address - what is going on with that? Advertising is great but it looks like you are an OP in our hub

Thanks
Rick
Title:
Post by: HillyBilly on 27 September, 2005, 13:34:02
QuoteOriginally posted by Rick
I'd be interested in something that would network 5 hub locations!
We tried terminator but too much was going wrong and the networking wasn't working

Hawk - when Terminator is installed we have to name a bot - that bot has a 20+GB share, apparantly your email address - what is going on with that? Advertising is great but it looks like you are an OP in our hub

Thanks
Rick

Maybe this would help.

CLICK HERE (http://www.hawks-world.com/hawksworld/modules.php?name=Forums&file=viewtopic&t=9)

Cheers HB
Title:
Post by: Rick on 28 September, 2005, 02:27:47
That's a link to Hawks site - how does that help?
Or answer the question?

Thanks
Rick
Title:
Post by: HillyBilly on 28 September, 2005, 12:03:12
QuoteOriginally posted by Rick
That's a link to Hawks site - how does that help?
Or answer the question?

Thanks
Rick

Maybe when you post the question there, it's easier to see that it is a question abouth Terminator and you get prob. a faster reply.

Cheers HB