24h = Restart
#1

Hello, i need help, how do it

If 24h over then server restarting. like Auto-Restarter

Code pls

Thanks

((www.sa-mp.pri.ee))
Reply
#2

NVM! I dont need!
Reply
#3

can i have this script ?
Reply
#4

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.
Reply
#5

i am a biginer and i don't know ENG so good
Reply
#6

Quote:
Originally Posted by [MTZ]H34DSh07z
Посмотреть сообщение
pawn Код:
forward restart();
pawn Код:
SetTimer("restart",86400000,0);//under ongamemodeinit
pawn Код:
public restart
{
      SendRconCommand("gmx");
      return 1;
}
You made a mistake:
pawn Код:
public restart
it should be:
pawn Код:
public restart()
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.
Reply
#7

Quote:
Originally Posted by [MTZ]H34DSh07z
Посмотреть сообщение
pawn Код:
forward restart();
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
Reply
#8

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.
Reply
#9

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.
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)