Author Topic: [Script request] easy restart script  (Read 760 times)

0 Members and 1 Guest are viewing this topic.

Offline Bonecrusher

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1397
  • High above
    • Zabijaka.pl
[Script request] easy restart script
« on: January 22, 2012, 12:05:57 am »
Hey, [yay]1st of all im proud to announce that there are people playing on one of my servers 24/7[yay]. therefore i need a script which restarts the server once per day when theres least players on the server. I have enabled scheduled server restarts on zabijaka.pl adm panel but ive noticed people are still playing when the restart occurs and its hard to get back to full server at late nigh[4-5am]

so anyone willing to help me out will receive karma point and special place on my servers if he wants

inb4 learn pascal at last bone

Im chill like that

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Script request] easy restart script
« Reply #1 on: January 22, 2012, 10:59:14 am »
Code: (pascal) [Select]
const
     RESTARTTIMER = 86400; //60*60*24

procedure AppOnIdle(Ticks: integer);
var
     i: byte;
begin
if Ticks mod 60 = 0 then begin
     if Ticks >= RESTARTTIMER*60 then
          for i := 32 downto 1 do
               if GetPlayerStat(i, 'active') then
                    break;
     if i = 0 then
          Shutdown();
end;
end;

untested though, i wrote it in quick reply textbox.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.