Hello everyone,I createdthis scriptfor servermaintenance,you canexplain to mehow I couldimprove it?The script works,but I wantedyour advice. In practice,when the serveris undergoing maintenance,only thegmcanaccess it. Here'sthescript:
Server_Maintenance.txt
prontera,150,150,4 script Server Maintenance 73,{
/***********************************/
/**/.npc$ = "[Server Maintenance]";
/**/.gm = 99; //Level GM
/**/.user$ = "root"; //root
/**/.password = 12345; //Password
/**********************************/
if(getgmlevel() >= .gm){
mes .npc$;
mes "Hello"+ strcharinfo(0) +".";
mes "Please enter the username:";
next;
input .@usr$;
if(.@usr$ == .user$){
mes "Please enter password";
next;
input .@psw;
if(.@psw == .password){
mes .npc$;
mes "Do you want to activate the server in maintenance mode?";
switch(select("Yes:No:Reset Server")){
case 1:
initnpctimer;
mes "Server in maintenance mode ^00ff7fenabled^000000";
announce "The server will be temporarily closed for maintenance -- from 5 minutes",bc_all|bc_npc;
close;
break;
OnTimer60000: // 1min.
announce "The server will be temporarily closed for maintenance -- from 4 minutes",bc_all|bc_npc;
end;
OnTimer120000: // 2min.
announce "The server will be temporarily closed for maintenance -- from 3 minutes",bc_all|bc_npc;
end;
OnTimer180000: // 3min.
announce "The server will be temporarily closed for maintenance -- from 2 minutes",bc_all|bc_npc;
end;
OnTimer240000: // 4min.
announce "The server will be temporarily closed for maintenance -- from 1 minutes",bc_all|bc_npc;
end;
OnTimer330000:
announce "-- Server Shutdown in 30 seconds --",bc_all|bc_npc;
end;
OnTimer430000:
announce "-- Server Shutdown in 20 seconds --",bc_all|bc_npc;
end;
OnTimer540000:
announce "-- Server Shutdown in 10 seconds --",bc_all|bc_npc;
end;
OnTimer655000:
announce "-- We will be back soon. Bye bye --",bc_all|bc_npc;
set $srv_mnt$,"ON";
stopnpctimer;
sleep2 5000;
atcommand "@kickall";
end;
case 2:
mes .npc$;
mes "Bye";
close;
case 3:
set $srv_mnt$,"OFF";
mes "Reset";
close;
}
}
}
}
mes .npc$;
mes "Sorry but you don't have a permission";
close;
}
OnPc_srv.txt
- script ServerMaintenance -1,{
OnPCLoginEvent:
if($srv_mnt$ == "ON"){
if(getgmlevel() >= 99){
mes "Hello "+ strcharinfo(0) +".";
mes "The server is "+ $srv_mnt$ +" mode";
close;
}
mes "[^55aaffLeoRO Server^000000]";
mes "Sorry but the server is temporarily out of service,";
mes "for maintenance.";
mes "Please try again later!";
next;
atcommand "@kick " + strcharinfo(0);
end;
}
else if($srv_mnt$ == "OFF"){
end;
}
else if($srv_mnt$ == "DEFAULT"){
end;
}
end;
}
Question
Valcars
Hello everyone, I created this script for server maintenance, you can explain to me how I could improve it? The script works, but I wanted your advice.
In practice, when the server is undergoing maintenance, only the gm can access it.
Here's the script:
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.