SA-MP Forums Archive
How to perform the "scheduled maintenance" save? - 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: How to perform the "scheduled maintenance" save? (/showthread.php?tid=442809)



How to perform the "scheduled maintenance" save? - Grooty - 09.06.2013

It's this in the script;
Код:
forward Maintenance();
public Maintenance()
{

	new string[128];

    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Locking Paintball Arenas...", 1);

    for(new i = 0; i < MAX_ARENAS; i++)
	        {
				foreach(Player, p)
				{
				    new arenaid = GetPVarInt(p, "IsInArena");
				    if(arenaid == i)
				    {
				        if(PaintBallArena[arenaid][pbBidMoney] > 0)
				        {
				            GivePlayerCash(p,PaintBallArena[GetPVarInt(p, "IsInArena")][pbBidMoney]);
							format(string,sizeof(string),"You have been refunded a total of $%d because of premature closure.",PaintBallArena[GetPVarInt(p, "IsInArena")][pbBidMoney]);
				            SendClientMessageEx(p, COLOR_WHITE, string);
				        }
				        if(arenaid == GetPVarInt(p, "ArenaNumber"))
			            {
							switch(PaintBallArena[arenaid][pbGameType])
							{
							    case 1:
							    {
							        if(PlayerInfo[p][pDonateRank] < 3)
							        {
							        	PlayerInfo[p][pPaintTokens] += 3;
										format(string,sizeof(string),"You have been refunded a total of %d Paintball Tokens because of premature closure.",3);
			            				SendClientMessageEx(p, COLOR_WHITE, string);
									}
							    }
							    case 2:
							    {
							        if(PlayerInfo[p][pDonateRank] < 3)
							        {
							        	PlayerInfo[p][pPaintTokens] += 4;
										format(string,sizeof(string),"You have been refunded a total of %d Paintball Tokens because of premature closure.",4);
			            				SendClientMessageEx(p, COLOR_WHITE, string);
									}
							    }
							    case 3:
							    {
							        if(PlayerInfo[p][pDonateRank] < 3)
							        {
						        		PlayerInfo[p][pPaintTokens] += 5;
										format(string,sizeof(string),"You have been refunded a total of %d Paintball Tokens because of premature closure.",5);
      									SendClientMessageEx(p, COLOR_WHITE, string);
									}
							    }
							    case 4:
							    {
							        if(PlayerInfo[p][pDonateRank] < 3)
							        {
							            PlayerInfo[p][pPaintTokens] += 5;
							            format(string,sizeof(string),"You have been refunded a total of %d Paintball Tokens because of premature closure.",5);
      									SendClientMessageEx(p, COLOR_WHITE, string);
							        }
							    }
							    case 5:
							    {
							        if(PlayerInfo[p][pDonateRank] < 3)
							        {
							            PlayerInfo[p][pPaintTokens] += 6;
							            format(string,sizeof(string),"You have been refunded a total of %d Paintball Tokens because of premature closure.",6);
      									SendClientMessageEx(p, COLOR_WHITE, string);
							        }
							    }
							}
        				}
				        LeavePaintballArena(p, arenaid);
				    }
				}
				ResetPaintballArena(i);
				PaintBallArena[i][pbLocked] = 2;
	        }

    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Freezing Accounts...", 1);
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Accounts...", 1);

	foreach(Player, i)
	{
	    GameTextForPlayer(i, "Scheduled Maintenance.", 5000, 5);
		DisablePlayerCheckpoint(i);
		gPlayerCheckpointStatus[i] = CHECKPOINT_NONE;
		for(new s = 0; s < 12; s++)
		{
			if(PlayerInfo[i][pAGuns][s] != 0)
			{
				RemovePlayerWeapon(i, PlayerInfo[i][pAGuns][s]);
			}
		}
		PlayerInfo[i][pInt] = GetPlayerInterior(i);
		PlayerInfo[i][pVW] = GetPlayerVirtualWorld(i);
		PlayerInfo[i][pChar] = PlayerInfo[i][pModel];

  		GetPlayerIp(i, PlayerInfo[i][pIP], 32);
		GetPlayerPos(i, PlayerInfo[i][pPos_x], PlayerInfo[i][pPos_y], PlayerInfo[i][pPos_z]);
		GetPlayerFacingAngle(i, PlayerInfo[i][pPos_r]);
		OnPlayerStatsUpdate(i);

		ResetPlayerWeapons(i);
		TogglePlayerControllable(i, false);
	}

	SetTimer("SaveMaintenance", 10000, false);

	return 1;
}

forward SaveMaintenance();
public SaveMaintenance()
{
	foreach(Player, i)
	{
	    GameTextForPlayer(i, "Scheduled Maintenance..", 5000, 5);
	}

    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Carrier...", 1);
    SaveCarrier();
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Houses...", 1);
	SaveHouses();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Dynamic Doors...", 1);
	SaveDynamicDoors();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Map Icons...", 1);
	SaveDynamicMapIcons();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Gates...", 1);
	SaveGates();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Event Points...", 1);
	SaveEventPoints();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Paintball Arenas...", 1);
	SavePaintballArenas();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Misc Stuff...", 1);
    SaveStuff();
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Office Elevator...", 1);
	SaveElevatorStuff();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Faction Pay...", 1);
	SaveThePay();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Server Stats...", 1);
	SaveServerStats();

	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Streamer Plugin Shutting Down...", 1);
	DestroyAllDynamicObjects();
	DestroyAllDynamicPickups();
	DestroyAllDynamic3DTextLabels();
	DestroyAllDynamicCPs();
	DestroyAllDynamicMapIcons();
	DestroyAllDynamicRaceCPs();
	DestroyAllDynamicAreas();

	SetTimer("FinishMaintenance", 10000, false);

	return 1;
}

forward FinishMaintenance();
public FinishMaintenance()
{

    SendClientMessageToAllEx(COLOR_LIGHTBLUE, "* The server will be going down for Scheduled Maintenance, Estimated Downtime: 1-10 Minutes.");
 	SendClientMessageToAllEx(COLOR_GRAD2, "We will be going down to do some maintenance on the server/script, we will be back online shortly.");

    foreach(Player, i)
	{
	    GameTextForPlayer(i, "Scheduled Maintenance...", 5000, 5);
	    Kick(i);
	}

	SendRconCommand("exit");
	return 1;
}
It saves everything and notifies all players it's going into maintenance, how do I execute this? There is no command...


Re: How to perform the "scheduled maintenance" save? - Infinitas - 09.06.2013

There might be a command for it that sets a timer for it to give players warning the server is going down.

Find "Maintenance" in your script and see.


Re: How to perform the "scheduled maintenance" save? - Grooty - 09.06.2013

Quote:
Originally Posted by Infinitas
Посмотреть сообщение
There might be a command for it that sets a timer for it to give players warning the server is going down.

Find "Maintenance" in your script and see.
Thank you! Found it.
/announcem

+repped.