import * as alt from 'alt-server';
function isWinterMonth() {
const currentMonth = new Date().getMonth();
return currentMonth === 11 || currentMonth === 0 || currentMonth === 1;
}
function getAdjustedWinterDate(): Date {
const adjustedDate = new Date();
if(adjustedDate.getHours() <= 5){
adjustedDate.setHours(0);
}
if(adjustedDate.getHours() >= 10){
adjustedDate.setHours(Math.min(adjustedDate.getHours() + 4, 23));
}
return adjustedDate;
}
alt.on('playerConnect', (player) => {
if(!isWinterMonth()){
return;
}
const adjustedDate = getAdjustedWinterDate();
player.setDateTime(adjustedDate.getDate(), adjustedDate.getMonth() + 1, adjustedDate.getFullYear(), adjustedDate.getHours(), adjustedDate.getMinutes(), adjustedDate.getSeconds());
});
alt.setInterval(() => {
if(!isWinterMonth()){
return;
}
const adjustedDate = getAdjustedWinterDate();
for (const player of alt.Player.all) {
player.setDateTime(adjustedDate.getDate(), adjustedDate.getMonth() + 1, adjustedDate.getFullYear(), adjustedDate.getHours(), adjustedDate.getMinutes(), adjustedDate.getSeconds());
}
}, 60000);
pagrazinau koda be chatgpt