login screen light modus

This commit is contained in:
hydrant
2020-05-05 18:31:15 +02:00
parent d21b30bcf0
commit 1b140a6119
7 changed files with 71 additions and 21 deletions

View File

@@ -31,6 +31,18 @@ export default function (globalData: IGlobalData): void {
mp.events.add('CEF:Login_RequestPlayerName', () => {
if (loginBrowser) {
// 5:30 - 21:00
var time = mp.game.time.getLocalTime(0, 0, 0, 0, 0, 0);
var date: Date = new Date(time.year, time.month, time.day, time.hour, time.minute, time.second);
var from: Date = new Date(time.year, time.month, time.day, 5, 30, 0);
var to: Date = new Date(time.year, time.month, time.day, 21, 0, 0);
mp.gui.chat.push(JSON.stringify(time));
if (!(date > from && date < to)) { // in Zeitspanne um Light-Modus auszumachen
loginBrowser.execute("disableLightMode();");
}
loginBrowser.execute(`setPlayerName("${localPlayer.name}");`);
}
});