do its possible? can someone create script like that
I type command !shutdown and then in main chat showstimer :)) like
Hub will shut down in 10
Hub will shut down in 9
Hub will shut down in 8
Hub will shut down in 7
Hub will shut down in 6
Hub will shut down in 5
Hub will shut down in 4
Hub will shut down in 3
Hub will shut down in 2
Hub will shut down in 1
Hub will shut down in 0
Hub is off! Bye bye!
-----------------------
And then shows Disconnected .. trying to reconnect.....
cant connect because hub is down :))
plzz plzz plzz help i need this script! and i think few other peoples need this script too :))
all depends on if lua can close its own host app... experts please help out this nice teletubbie guy! ;p
How can script shut down software? I dont think its possible... Anyway, maybe it could restart hub or scripts but shuting down whole application?
Well.. like bastya said - "experts please help out this nice teletubbie guy! ;p"
If Im correct, and Hub cannot be turned of by a script, my suggestion would be timed countdown message, that counts time till for ex. 22.00 and shows message, that hub will be turned of and somekind of standalone software, thats really shuts down PtokaX or maybe whole PC
hey mazmaajinsh,
It depends on what operatoring system you are running...
in winxp u can shutdown or restart your system in dos with the shutdown command...
so this can be in lua with
execute("shutdown -r -t 10 -f")
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
No args Display this message (same as -?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d [u][p]:xx:yy The reason code for the shutdown (u is the user code, p is a planned shutdown code, xx is the major reason code (positive integer less than 256), yy is the minor reason code (positive integer less than 65536)
why not use a script on bcdc and make it send !restart ??????
plop
It's also possible from server
exit(1);
Closes main application
I have tested and modified it a little..
And i do belive a client side script is better for this purpose as i am not sure how ptokax handles it aswell as if it releases memory and such!
In my task manager PtokaX were still "running" BUT, server were closed!
So an end process for me was necesary, also the PtokaX icon didn't release.
It does when you hover over it though
But, i was ( i am ) bored making this script so if you find it usefull and can live with this, im fine with that
------------------------------------------------------------------------------
------- countdown bot by plop ------------------------------------------------
------- original julian day made by tezlo ------------------------------------
------- modifyd by chilla 2 also handle hours, mins, seconds -----------------
------------------------------------------------------------------------------
------- Modified by Kepp due to request --------------------------------------
------- Shutdown a hub at a specific date & time -----------------------------
------------------------------------------------------------------------------
-- SETTINGS
------------------------------------------------------------------------------
-- Name of bot
Bot = "RebootingTimer"
-- Date to reboot, as follows : Year,Month,Day
SylYear,SylMonth,SylDay = 04,12,21
-- Time at above date to reboot, as follows : Hours,Minutes,Seconds
SylHour,SylMin,SylSec = 03,14,0
-- Last message to send before shutting down
sDownMessage = "Hub is off, bye bye!"
-- Send time left to users logging in
SendUserTimeLeft = 1
-- Send time left to operators logging in
SendOperatorTimeLeft = 1
-- Send time left when scripts are restarted
SendTimeLeft = 1
------------------------------------------------------------------------------
-- Modify below this point only if lua knowledge is in your forehead
------------------------------------------------------------------------------
function OnTimer()
if last == 0 then
SendToAll(Bot, TimeLeft())
Sync()
elseif last == 1 then
SendHubRestart() -- Send the message
--StopTimer() -- kill the timer
elseif last == 2 then
StopTimer() -- kill the timer
exit(1)
end
end
------------------------------------------------------------------------------
function jdatehms(d, m, y,ho,mi,se)
local a, b, c = 0, 0, 0
if m <= 2 then
y = y - 1
m = m + 12
end
if (y*10000 + m*100 + d) >= 15821015 then
a = floor(y/100)
b = 2 - a + floor(a/4)
end
if y <= 0 then c = 0.75 end
return floor(365.25*y - c) + floor(30.6001*(m+1) + d + 1720994 + b),ho*3600+mi*60+se
end
------------------------------------------------------------------------------
function TimeLeft()
local curday,cursec = jdatehms(tonumber(date("%d")),tonumber(date("%m")),tonumber(date("%y")),tonumber(date("%H")),tonumber(date("%M")),tonumber(date("%S")))
local sylday,sylsec = jdatehms(SylDay,SylMonth,SylYear,SylHour,SylMin,SylSec)
local tmp = sylsec-cursec
local hours, minutes,seconds = floor(mod(tmp/3600, 60)), floor(mod(tmp/60, 60)), floor(mod(tmp/1, 60))
return ("Time left till next reboot: "..sylday-curday.." Day's, "..hours.." Hours, "..minutes.." Minutes, "..seconds.." Seconds")
end
------------------------------------------------------------------------------
function SendHubRestart()
SendToAll(Bot,sDownMessage)
-- Delay by a second
last = 2
SetTimer(1000)
end
------------------------------------------------------------------------------
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"^%b<>%s+(%S+)")
if (cmd == "!nextreboot") then
user:SendData(Bot, TimeLeft().."|")
return 1
end
end
end
------------------------------------------------------------------------------
function NewUserConnected(user)
if (SendUserTimeLeft == 1) then
user:SendData(Bot, TimeLeft().."|")
end
end
------------------------------------------------------------------------------
function OpConnected(user)
if (SendOperatorTimeLeft == 1) then
user:SendData(Bot, TimeLeft().."|")
end
end
------------------------------------------------------------------------------
function Main()
SetTimer(100 * 1000)
StartTimer()
if (SendTimeLeft == 1) then
SendToAll(Bot, TimeLeft().."|")
end
Sync()
last = 0
end
------------------------------------------------------------------------------
function Sync()
local curday,cursec = jdatehms(tonumber(date("%d")),tonumber(date("%m")),tonumber(date("%y")),tonumber(date("%H")),tonumber(date("%M")),tonumber(date("%S")))
local sylday,sylsec = jdatehms(SylDay,SylMonth,SylYear,SylHour,SylMin,SylSec)
local tmp = sylsec-cursec
local hours, minutes,seconds = floor(mod(tmp/3600, 60)), floor(mod(tmp/60, 60)), floor(mod(tmp/1, 60))
local day = sylday-curday
if day ~= 0 then
adjust = (floor(mod(minutes, 60))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(3600 * 1000)
end
else
if tmp > 3600 then --- every hours a msg
adjust = (floor(mod(minutes, 60))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(3600 * 1000)
end
elseif tmp > 900 then -- every 15 mins a msg
adjust = (floor(mod(minutes, 15))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(900 * 1000)
end
elseif tmp > 300 then -- every 5 mins a msg
adjust = (floor(mod(minutes, 5))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(300 * 1000)
end
elseif tmp > 60 then -- every min a msg
adjust = (floor(mod(minutes, 1))*60)+seconds
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(60 * 1000)
end
elseif tmp > 15 then -- every 15 secs a msg
adjust = floor(mod(seconds, 15))
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(15 * 1000)
end
elseif tmp > 10 then -- every 10 secs a msg
adjust = floor(mod(seconds, 10))
if adjust ~= 0 then
SetTimer(adjust * 1000)
else
SetTimer(5 * 1000)
end
elseif tmp > 1 then
last = 0
SetTimer(1 * 1000)
else
last = 1
SetTimer(1 * 1000)
end
end
end
And it seems that it can only be set to trigger at 24,0,0
otherwise you end up spamming your own hub.
So not a good thing afterall
So, is this script good or not?
I'm interested in it too 8)
for now i can't recomend using it!
If you would like such a script then ask on the Client forum, Im sure they can help you there