restart system
#1

I've been search for a restart system for my samp server and i didnt find any.
anyone here who can make a restart system wich does that the server restarts every 24 hours?
Reply
#2

Use gettime() and use hour to check if it's 24, sorry for the indentation I created this without using any PAWNO

pawn Код:
new Time[3];

gettime(Time[0], Time[1], Time[2]);

if(Time[0] == 24)
{
SendRconCommand("gmx");
}
Reply
#3

pawn Код:
// in OnGameModeInit()
SetTimer("AutoRestart", 86400000, 0); // 86400000ms = 24 hours

// somewhere else
forward AutoRestart();
public AutoRestart() {
    SendRconCommaned("gmx");
}
Would also work, probably the "cleanest" version, as it doesnt need any other timers or checks.
Reply
#4

Thanks man
Reply
#5

can you make it say Server Restarting in 10 minutes before 10 minutes? with gamertext
Reply
#6

You could create a 1 second timer, or use OnPlayerUpdate (I do not suggest this)

pawn Код:
public OnPlayerUpdate(playerid)
{
    AutoRestart();
    return true;
}

stock AutoRestart()
{
    new Time[3];
    gettime(Time[0], Time[1], Time[2]);
    if(Time[0] == 24)
    {
        SendRconCommand("gmx");
    }
    else if(Time[0] == 23 && Time[1] == 50) // 10 minutes before 24
    {
        GameTextForPlayer(..); //edit this line to your choice.
    }
}
Reply
#7

Why not?
Reply
#8

Quote:
Originally Posted by SRB
Посмотреть сообщение
Why not?
Quote:
Originally Posted by SA-MP Wikipedia
This callback is called everytime a client/player updates the server with their status.

Important Note: This callback is called very frequently per second per player, only use it when you know what it's meant for.
****
Reply
#9

give the script when you make the second timer
Reply
#10

Quote:
Originally Posted by SRB
Посмотреть сообщение
give the script when you make the second timer
It's really easy to create a timer Mauzen have given you a clue how to do it, anyways sorry for the late reply was watching a documentary.

pawn Код:
public OnGameModeInit()
{
    SetTimer("AutoRestart", 1000, true);
    return true;
}

forward AutoRestart();
public AutoRestart()
{
    new Time[3];
    gettime(Time[0], Time[1], Time[2]);
    if(Time[0] == 24)
    {
        SendRconCommand("gmx");
    }
    else if(Time[0] == 23 && Time[1] == 50) // 10 minutes before 24
    {
        GameTextForPlayer(..); //edit this line to your choice.
    }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)