restart system - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: restart system (
/showthread.php?tid=484873)
restart system -
SRB - 01.01.2014
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?
Re: restart system - Patrick - 01.01.2014
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");
}
Re: restart system -
Mauzen - 01.01.2014
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.
Re: restart system -
SRB - 01.01.2014
Thanks man
Re: restart system -
SRB - 01.01.2014
can you make it say Server Restarting in 10 minutes before 10 minutes? with gamertext
Re: restart system - Patrick - 01.01.2014
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.
}
}
Re: restart system -
SRB - 01.01.2014
Why not?
Re: restart system - Patrick - 01.01.2014
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.
|
****
Re: restart system -
SRB - 02.01.2014
give the script when you make the second timer
Re: restart system - Patrick - 02.01.2014
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.
}
}