Format of getDateTime is
MM/DD/YY HH:MM:SS
and time is in 24h
so your checkTimeLoop would be something like
$PasswordOnTime = "6:00:00";
$PasswordOffTime = "22:00:00";
$AutoPassword = "password";
function passwordCheckLoop() {
cancel($PasswordCheckLoopSched);
if (!isObject(MissionCleanup)) { //if this is a non-dedi and the server is shut off
return;
}
%time = getWord(getDateTime(), 1);
%onTime = $PasswordOnTime;
%offTime = $PasswordOffTime;
%onTimeConcat = stripChars(%onTime, ":");
%offTimeConcat = stripChars(%offTime, ":");
%currTimeConcat = stripChars(%time, ":");
if (%onTimeConcat > %offTimeConcat) {
//its turned on overnight
if ( %offTimeConcat > %currTimeConcat || %onTimeConcat < %currTimeConcat) {
$Pref::Server::Password = $AutoPassword;
} else {
$Pref::Server::Password = "";
}
} else {
//its turned off overnight
if ( %onTimeConcat < %currTimeConcat && %currTimeConcat < %offTimeConcat ) {
$Pref::Server::Password = $AutoPassword;
} else {
$Pref::Server::Password = "";
}
}
$PasswordCheckLoopSched = schedule(30000, 0, passwordCheckLoop);
}