--lua5 version
--made by Dessamator borrowing some ideas from timebot
sBot = frmHub:GetHubBotName()
sec = 1000
min = sec*60
botDesc = ""
botSpeed = ""
botEmail = ""
botShare = 0
startchars ="•" -- shows before
endchrs = "•" -- shows after
--------------------------------------------------------
function Main()
SetTimer(sec)
end
--------------------------------------------------------
function OnTimer()
if time > 0 then
frmHub:UnregBot(startchars..time..endchrs)
time = time - 1
frmHub:RegBot(startchars..time..endchrs)
else
frmHub:UnregBot(startchars..time..endchrs)
frmHub:Restart()
end
end
--------------------------------------------------------
--------------------------------------------------------
function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (string.lower(cmd) == "!restartimer") then
timer(user, data)
return 1
end
end
ToArrival=ChatArrival
function timer(user,data)
Nick = user
local s,e,input = string.find(data, "%b<>%s+%S+%s+(.+)")
if input== nil or tonumber(input)==nil then
SendPmToNick(user.sName,sBot, "Syntax error, the correct syntax is: !restartimer ")
elseif user.iProfile==5 or user.iProfile==0 then
time=tonumber(input)
StartTimer()
SendToAll(sBot,"• THE HUB WILL RESTART IN "..time.." SECS •")
frmHub:RegBot(startchars..time..endchrs)
else
user:SendData(sBot,"You Cant restart the hub")
return 1
end
end
can you make a timer bot for execute the command '!restartscripts' ?
just to restart scripts if no masters are there to do it ;)
QuoteOriginally posted by aL1en
can you make a timer bot for execute the command '!restartscripts' ?
just to restart scripts if no masters are there to do it ;)
hmm,ok ill c if its possible, workin on it !
here u go :
--by Dessamator
sBot = frmHub:GetHubBotName()
sec = 1000
min = sec*60
hour = min*60
time =12*hour
--------------------------------------------------------
function Main()
dofile("test1.lua") -- write here the name of ur script between the quotations, ps it must b the exact name!!!!
dofile("test2.lua") --
SetTimer(time)
StartTimer()
end
--------------------------------------------------------
function OnTimer()
SendPmToOps(sBot,"Scripts restarted automatically!!")
OnExit()
Main()
end
--------------------------------------------------------
--------------------------------------------------------
function OnExit()
end
ps. u have to write the name of each script,
ex.:dofile("trivia.lua").
ptokax doesnt seem to have an option to restartscripts without the using the server, at least i couldnt find it!!
hope it helps!
--for ptokax 17.02 and above
--by Dessamator
sBot = frmHub:GetHubBotName()
-----------------------------------------------------------
sec = 1000
min = sec*60
hour = min*60
time =12*hour
--------------------------------------------------------
function Main()
SetTimer(time)
StartTimer()
end
--------------------------------------------------------
function OnTimer()
SendPmToOps(sBot,"Scripts restarted automatically!!")
frmHub:RestartScripts()
end
--------------------------------------------------------
--------------------------------------------------------
new way of doing it, in new ptokax, ;)
-- small mod now shows countdown in topic also
--lua5 version
--made by Dessamator borrowing some ideas from timebot
HubName= frmHub:GetHubName()
sBot = frmHub:GetHubBotName()
sec = 1000
min = sec*60
botDesc = ""
botSpeed = ""
botEmail = ""
botShare = 0
startchars ="?" -- shows before
endchrs = "?" -- shows after
--------------------------------------------------------
function Main()
SetTimer(sec)
end
--------------------------------------------------------
function OnTimer()
if time > 0 then
frmHub:UnregBot(startchars..time..endchrs)
time = time - 1
SendToAll("$HubName "..HubName.." ? - THE HUB WILL RESTART IN "..startchars..time..endchrs.." SECS ?")
frmHub:RegBot(startchars..time..endchrs)
else
SendToAll("$HubName "..HubName.." ? - THE HUB WILL RESTART IN "..startchars..time..endchrs.." SECS ?")
frmHub:UnregBot(startchars..time..endchrs)
frmHub:Restart()
end
end
--------------------------------------------------------
--------------------------------------------------------
function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (string.lower(cmd) == "!restartimer") then
timer(user, data)
return 1
end
end
ToArrival=ChatArrival
function timer(user,data)
Nick = user
local s,e,input = string.find(data, "%b<>%s+%S+%s+(.+)")
if input== nil or tonumber(input)==nil then
SendPmToNick(user.sName,sBot, "Syntax error, the correct syntax is: !restartimer ")
elseif user.iProfile==5 or user.iProfile==0 then
time=tonumber(input)
StartTimer()
SendToAll(sBot,"? THE HUB WILL RESTART IN "..time.." SECS ?")
SendToAll("$HubName "..HubName.." ? - THE HUB WILL RESTART IN "..startchars..time..endchrs.." SECS ?")
frmHub:RegBot(startchars..time..endchrs)
else
user:SendData(sBot,"You Cant restart the hub")
return 1
end
end
First of all..Very nice script..
Second...
Is there any way to close the hub withthis script??
Like !shutdown so the hub will be shutdown totally??
Well, theres nothing in the api to allow that, so i guess theres no way .
Damit =p
Thx for the reply tough...
ur welcome