viewing paste rA-105192-s maintenance | Athena

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
-       script  Server_Maintenance      -1,{
OnTalk:
        /***********************************/
        /**/.npc$ = "[Server Maintenance]";
        /**/.gm = 99; //Level GM
        /**/.user$ = "root"; //root
        /**/.password = 12345; //Password
        /**********************************/
 
        mes .npc$;
        if ( getgmlevel() < .gm ) {
                mes "Sorry but you don't have a permission";
                close;
        }
        mes "Hello "+ strcharinfo(0) +".";
        mes "Please enter the username:";
        next;
        input .@usr$;
        mes .npc$;
        mes "Please enter password";
        next;
        input .@psw;
        mes .npc$;
        if ( .@usr$ != .user$ || .@psw != .password ) {
                mes "There was a problem with your login information!";
                close;
        }
        mes "Current state of the server : "+( ($server_maintenance)? "^00FFFFON": "^FF0000OFF" )+"^000000.";
        mes "Do you want to activate the server in maintenance mode?";
        next;
        if ( select( "Turn On", "Turn Off" ) == 1 ) {
                mes .npc$;
                if ( $server_maintenance == true ) {
                        mes "The server is already turn on maintenance mode";
                        close;
                }
                mes "Server in maintenance mode ^00ff7fenabled^000000";
                donpcevent "#maintenance::OnStartMaintenance";
                close;
        } else {
                mes .npc$;
                if ( $server_maintenance == false ) {
                        mes "The server is already turn off maintenance mode";
                        close;
                }
                mes "Server in maintenance mode ^00ff7fdisabled^000000";
                $server_maintenance = false;
                close;
        }
        end;
}
prontera,150,185,5      duplicate(Server_Maintenance)   Server Maintenance      73
 
-       script  #maintenance    -1,{
OnInit:
        bindatcmd "maintenance", "Server_Maintenance::OnTalk";
        end;
OnStartMaintenance:
        .@one_sec = 1000; // just to debug this script
        announce "The server will be temporarily closed for maintenance -- from 5 minutes", bc_all;
        sleep 60 * .@one_sec;
        announce "The server will be temporarily closed for maintenance -- from 4 minutes", bc_all;
        sleep 60 * .@one_sec;
        announce "The server will be temporarily closed for maintenance -- from 3 minutes", bc_all;
        sleep 60 * .@one_sec;
        announce "The server will be temporarily closed for maintenance -- from 2 minutes", bc_all;
        sleep 60 * .@one_sec;
        announce "The server will be temporarily closed for maintenance -- from 1 minutes", bc_all;
        sleep 30 * .@one_sec;
        announce "-- Server Shutdown in 30 seconds --", bc_all;
        sleep 10 * .@one_sec;
        announce "-- Server Shutdown in 20 seconds --", bc_all;
        sleep 10 * .@one_sec;
        announce "-- Server Shutdown in 10 seconds --", bc_all;
        sleep 5 * .@one_sec;
        announce "-- We will be back soon. Bye bye --", bc_all;
        $server_maintenance = true;
        addrid 0;
        if ( getgmlevel() >= 99 ) end; // com'on ... wtf you kick another admin ?
        if ( checkvending() & 2 ) end; // shouldn't kick @autotraders too ... hercules members complained in my topic
        atcommand "@kick "+ strcharinfo(0);
        end;
OnPCLoginEvent:
        if ( $server_maintenance == false )
                end;
        if ( getgmlevel() >= 99 ) {
                message strcharinfo(0), "The server is currently in maintenance mode";
                end;
        }
        mes "[^55aaffXXXRO Server^000000]";
        mes "Sorry but the server is temporarily out of service,";
        mes "for maintenance.";
        mes "Please try again later!";
        sleep2 5000;
        atcommand "@kick "+ strcharinfo(0);
        end;
}
Viewed 265 times, submitted by AnnieRuru.