[REQUEST] Restart Command Script

  • Hello, I am trying to write a function.
    Function: /restart


    Procedure:



    1.saveall
    2.chat message ...
    3.Function should wait 15 seconds
    then
    4.shutdownserver


    here is my idea:
    [lua] elseif cmd[1] == "/restart" then
    if not event.player:isAdmin() then return msgAccessDenied(event.player) end
    restart(event.player);[/lua]


    [lua]function restart(player)
    server:saveall
    player:sendTextMessage("Der Server wird in 15sec restartet ")
    sleep(15)
    server:shutdownserver
    end[/lua]




    can someone help me?
    thx and sry for my bad english

  • You can't restart server or save data via Lua right now. But you already can broadcast message and set timer! 50% of your list! ;)

  • How can I do that in my case with the timer?


    do you mean that?
    That would be my idea!


    15 sec Server Restart
    14 ...
    13 ...
    12 ...
    ...
    3 ...
    2 ...
    1 ...
    Server ist restarting


    thy for the help


    lg

  • Consider using Linux/Mac/Windows script for regular restarts, I don't know how actually this can be done, but it can :) Ask on forum :)
    To warn users about the restart - there is already a request of this script here: {REQUEST} Timer Script
    Also in this topic you can find red51's answer about timers.
    If I get some time and motivation on the weekend, I'll write this timer script (if anyone else doesn't before me :) )

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!