ID:262667
 
Code:
client/New()
spawn(108000)
var/mob/M = src
M:GM_Announce("<b>WORLD REBOOT IN 5 MINUTES!</b>")
sleep(3000)
M:GM_Announce("World is rebooting in 10 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 9 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 8 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 7 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 6 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 5 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 4 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 3 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 2 seconds!")
sleep(10)
M:GM_Announce("World is rebooting in 1 second!")
sleep(10)
M:GM_Announce("World is rebooting!")
world.Reboot()


Problem description:As soon as i host it reboots. Whats goin on?

That system is awful. It will load up the instant anybody logs in, so you'll have several sets of it running. Why are you using the colon? Don't. I have no idea why it doesn't work, but I suspect it is because you've done several stupid things elsewhere in the code.

Oh, you probably need a ..() in the top of the Client/New() proc. That may fix it.

And the announcement should be handled like this:

for(var/b=10, b>0,b--)
world << "World reboot in [b] seconds
sleep(10)
world.Reboot()
In response to Jp
It should be called upon world.New()
var/const/TimeUntilReboot=3600 
//In seconds, this is one hour
world/New()
..()
var/T=TimeUntilReboot
while(T<0)
T--
if(T==60) world<<"Reboot in one minute."
sleep(10)
In response to CaptFalcon33035
In my situation, I use a world/New() then it call a AutoReboot() proc

proc
AutoReboot()
sleep(blah)

I never use spawn for a reboot code, just use a sleep on a new proc.
In response to CaptFalcon33035
CaptFalcon33035 wrote:
It should be called upon world.New()
var/const/TimeUntilReboot=3600 
//In seconds, this is one hour
world/New()
..()
var/T=TimeUntilReboot
while(T<0)
T--
if(T==60) world<<"Reboot in one minute."
sleep(10)


Augh. That loop is hideous. You should never do a bit-by-bit countdown when you can just do a simple spawn() and be done with it. You'd only want to do a loop like that if you were announcing it every second. Instead, try this one on for size:
// this var will be 0 or null if not rebooting,
// otherwise reboot when world.time reaches this value
var/reboottime

proc/SayTime(ticks)
. = ""
ticks = round(ticks,10) // round to nearest second
if(ticks >= 36000)
. = "[round(ticks/36000)] hour\s"
ticks %= 36000
if(ticks >= 600)
if(.) . += ", "
. += "[round(ticks/600)] minute\s"
ticks %= 600
if(ticks)
if(.) . += ", "
. += "[ticks/10] second\s"

proc/NextUnit(ticks)
--ticks
// every hour
if(ticks >= 36000)
return ticks - ticks%36000
// every 15 minutes within the last hour
if(ticks >= 9000)
return ticks - ticks%9000
// every minute within the last 5
if(ticks >= 3000) return 3000
if(ticks >= 600)
return ticks - ticks%600

proc/SetReboot(ticks)
world << "<span class=server>The server will [reboottime?"now ":""]reboot in [SayTime(ticks)].</span>"
reboottime = world.time + ticks
spawn(ticks-NextUnit(ticks)) SayReboot()

proc/SayReboot()
// if reboot was canceled, stop this proc
if(!reboottime) return
var/ticks = reboottime - world.time
// if time was updated, this will bail out and wait for the next update
if(ticks != NextUnit(ticks+1)) return
world << "<span class=server>The server will reboot in [SayTime(ticks)].</span>"
spawn(ticks-NextUnit(ticks))
SayReboot()

Lummox JR
In response to Polantaris
well i just used JP's help on that its much more simpilar lol