I use functions similar to Baaleos but you only need to store one Int. And instead of using a recursive delay or HB I just put the function all over the place (OnPlayerRest, area OnEnter/OnExit, etc.). However I do manually go in and adjust my server starting month, starting day and starting hour to 1, 1, 0. Just another way of doing it:
void SaveCurrentDateTime()
{
int iYear = GetCalendarYear();
int iMonth = GetCalendarMonth();
int iDay = GetCalendarDay();
int iHour = GetTimeHour();
int iDate = (iYear * 8064) + ((iMonth - 1) * 672) + ((iDay -1) * 24) + iHour;
//SetPersistentInt(GetModule(), "INT_DATE_TIME", iDate);
SetCampaignInt("MODULE1", "DATE_TIME", iDate);
}
void LoadPersistentDateTime()
{
//int iDate = GetPersistentInt(GetModule(), "INT_DATE_TIME");
int iDate = GetCampaignInt("MODULE1", "DATE_TIME");
if (iDate)
{
int iYear = iDate / 8064;
int iMonth = ((iDate % 8064) / 672) + 1;
int iDay = ((iDate % 672) / 24) + 1;
int iHour = iDate % 24;
SetCalendar(iYear, iMonth, iDay);
SetTime(iHour, GetTimeMinute(), GetTimeSecond(), GetTimeMillisecond());
SaveCurrentDateTime();
}
else
{
SaveCurrentDateTime();
}
}
Modifié par GhostOfGod, 16 janvier 2013 - 08:58 .