24h = Restart - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 24h = Restart (
/showthread.php?tid=91432)
24h = Restart -
Typhome - 14.08.2009
Hello, i need help, how do it
If 24h over then server restarting. like Auto-Restarter
Code pls
Thanks
((
www.sa-mp.pri.ee))
Re: 24h = Restart -
Typhome - 14.08.2009
NVM! I dont need!
Re: 24h = Restart -
iceZone - 16.01.2011
can i have this script ?
Re: 24h = Restart -
WillyP - 16.01.2011
Quote:
Originally Posted by iceZone
can i have this script ?
|
Why don't you just learn about timers rather than being fat and lazy and whining for other people's code.
Re: 24h = Restart -
iceZone - 16.01.2011
i am a biginer and i don't know ENG so good
Re: 24h = Restart -
WillyP - 16.01.2011
Quote:
Originally Posted by [MTZ]H34DSh07z
pawn Код:
SetTimer("restart",86400000,0);//under ongamemodeinit
pawn Код:
public restart { SendRconCommand("gmx"); return 1; }
|
You made a mistake:
it should be:
And this:
pawn Код:
SetTimer("restart",86400000,0);//under ongamemodeinit
Should be:
pawn Код:
SetTimer("restart",86400000,1);//under ongamemodeinit
So that it would repeat every 24hrs.
Re: 24h = Restart -
iceZone - 16.01.2011
Quote:
Originally Posted by [MTZ]H34DSh07z
pawn Код:
SetTimer("restart",86400000,0);//under ongamemodeinit
pawn Код:
public restart { SendRconCommand("gmx"); return 1; }
|
this i know how is made .. but i wana set the hour when the server resets
EX: i wana set to server to restart at the 8:00 PM
Re: 24h = Restart -
WillyP - 16.01.2011
Quote:
Originally Posted by iceZone
this i know how is made .. but i wana set the hour when the server resets
EX: i wana set to server to restart at the 8:00 PM
|
So? You want THIS and you WANT THAT.
wiki.sa-mp.com and stop asking for the whole world to bow down to you.
Re: 24h = Restart -
chaosnz - 14.02.2011
heres a better working "restart" code that also informs all players on the server of the restart
Код:
forward restart();
public restart()
{
for(new i=0; i <= MAX_PLAYERS; i++)
{
if ( IsPlayerConnected(i) )
{
GameTextForPlayer(i,"~w~Server is restarting! ~n~~y~-AutoRestart-",5000,5);
}
}
SendRconCommand("gmx");
return 1;
}
Under Gamemodeinit
Код:
SetTimer("restart",43200000,1);
43200000 is 12 real hours. Which seems about right.
Re: 24h = Restart - Unknown123 - 14.02.2011
Quote:
Originally Posted by chaosnz
heres a better working "restart" code that also informs all players on the server of the restart
Код:
forward restart();
public restart()
{
for(new i=0; i <= MAX_PLAYERS; i++)
{
if ( IsPlayerConnected(i) )
{
GameTextForPlayer(i,"~w~Server is restarting! ~n~~y~-AutoRestart-",5000,5);
}
}
SendRconCommand("gmx");
return 1;
}
Under Gamemodeinit
Код:
SetTimer("restart",43200000,1);
43200000 is 12 real hours. Which seems about right.
|
Why not just:
pawn Код:
public restart()
{
GameTextForAll("~w~Server is restarting! ~n~~y~-AutoRestart-", 5000, 5);
SendRconCommand("gmx");
return 1;
}
=_=_=_=_=_=_=Copy & Paste=_=_=_=_=_=_=_=
pawn Код:
#include <a_samp>
//I hope it works...
forward AutoRestart();
public OnFilterScriptInit()
{
SetTimer("AutoRestart", Hours(12), true);
return 1;
}
public AutoRestart()
{
GameTextForAll("~w~Server is restarting! ~n~~y~-AutoRestart-", 5000, 5);
SendRconCommand("gmx");
return 1;
}
stock Hours(hours)
{
if(hours)
{
hours*=3600000;
return hours;
}
return 0;
}