ID:170714
 
mob
verb
Shutdown()
set category="Admin"
switch(alert("Are you sure you want to shutdown the world?",,"Yes","No"))
if("Yes")
for(var/mob/Player/M in world)
M.islocked = 0
M.SaveAuto()
sleep(100)
del (world)
mob/proc/SaveAuto()
src.client.Save()
src<<"<font color = #dc143c>Your game has been auto-saved."


Now, What i want this system to do is save every player before shutting down. It saves the player but the procedure ends after that and the world does not get deleted. Help?

~>Jiskuha
Try indenting sleep(100) and SaveAuto() one more time.
My guess is that client.Save() is for whatever reason not returning, which would have the for() loop hung up waiting for AutoSave() to finish. Do you (or any other players) see the <font color = #dc143c>Your game has been auto-saved</font>?

Also, add a check to make sure that all the /mob/Player actually have a client:

mob
verb
Shutdown()
set category="Admin"
switch(alert("Are you sure you want to shutdown the world?",,"Yes","No"))
if("Yes")
for(var/mob/Player/M in world)
if(M.client)
M.islocked = 0
M.SaveAuto()
sleep(100)
del (world)
mob/proc/SaveAuto()
src.client.Save()
src<<"<font color = #dc143c>Your game has been auto-saved."


In response to Nick231
Nick231 wrote:
My guess is that client.Save() is for whatever reason not returning, which would have the for() loop hung up waiting for AutoSave() to finish. Do you (or any other players) see the <font color = #dc143c>Your game has been auto-saved</font>?

Yes,I do.

Also, add a check to make sure that all the /mob/Player actually have a client:

> mob
> verb
> Shutdown()
> set category="Admin"
> switch(alert("Are you sure you want to shutdown the world?",,"Yes","No"))
> if("Yes")
> for(var/mob/Player/M in world)
> if(M.client)
> M.islocked = 0
> M.SaveAuto()
> sleep(100)
> del (world)
> mob/proc/SaveAuto()
> src.client.Save()
> src<<"<font color = #dc143c>Your game has been auto-saved."
>


I tried that and got no luck.


~>Jiskuha
In response to Jiskuha
Try putting a
world<<"<B>Server is shutting down in 10 seconds</B>
before the sleep(100). It's a nice little notice to the player (so they don't wonder why the game just disappeared), and if it shows you know its a problem with del(world).

If you see the message, go through your code and make sure you have ..() in every world/Del() you may have.
In response to Nick231
Nick231 wrote:
Try putting a
world<<"<B>Server is shutting down in 10 seconds</B>
before the sleep(100). It's a nice little notice to the player (so they don't wonder why the game just disappeared), and if it shows you know its a problem with del(world).
If you see the message, go through your code and make sure you have ..() in every world/Del() you may have.


Okay i dont get that message.

~>Jiskuha
In response to Jiskuha
Any help, i am stuck.

~>Jiskuha
In response to Jiskuha
Hmmm...there's only one thing I could guess.

Don't call auto save, call the main save proc.
Or there may be something wrong in your save proc.
In response to Hell Ramen
Hell Ramen wrote:
Hmmm...there's only one thing I could guess.

Don't call auto save, call the main save proc.
Or there may be something wrong in your save proc.

The auto save proc was an infinite loop so i did call the main save proc and it worked. I Can't believe i over looked this. Thank for the help guys!

~>Jiskuha