[Help] Server Date and Time

Newbie Spellweaver
Joined
Jan 20, 2017
Messages
13
Reaction score
17
Hey i wanted to make a RP Server with a decent story and the Map Should be like 24 H day/night so Real Time .. and this is already Done now i have a Other Problem How do i set the Server Date from for example 18.2.2058 to 12.4.2017 and get the Real Time
 
Look function like "CompresedTime"



ps : For make zone work for rp use function mission zone :)


Yep , you can do it like that or check isCloseToNPC function for make it fully serverside.

Also it sounds interesting , if you want to share you development stage you can open thread about it.
 
Upvote 0
Yeah Would be rly Cool if we Could get a Nice Group of Dev together : ) but let us use discord pls :)) and btw ty Oosmar02 it Helped me : )) and For the Progress its rly slow due i dont know that much about C++ ^^
 
Upvote 0
Solution: WarZ.sln
File: HUDPause.cpp
Search by
Code:
void HUDPause::setTime(__int64 utcTime)

View and study the code shown below
Code:
void HUDPause::setTime(__int64 utcTime){    const static char* months[12] = {        "January",        "February",        "March",        "April",        "May",        "June",        "July",        "August",        "September",        "October",        "November",        "December"    };    struct tm* tm = _gmtime64(&utcTime);    char date[128];    char time[128];    sprintf(date, "%s %d, %d", gLangMngr.getString(months[tm->tm_mon]), tm->tm_mday, 1900 + tm->tm_year);    sprintf(time, "%02d:%02d", tm->tm_hour, tm->tm_min);    Scaleform::GFx::Value var[2];    var[0].SetString(date);    var[1].SetString(time);    gfxMovie.Invoke("_root.api.setTime", var, 2);}[COLOR=#000000][/COLOR]
You can make changes, I believe.



Here is the code for 24 hours in game, only change to real time world.

Code:
void ClientGameLogic::SetServerGameTime(int hour, int min) {     //SetServerGameTime(12, 0); will set it to 12     __int64 gameUtcTime = gClientLogic().GetServerGameTime();    struct tm* tm = _gmtime64(&gameUtcTime);    r3d_assert(tm);    gClientLogic().gameStartUtcTime_ -= tm->tm_sec;    gClientLogic().gameStartUtcTime_ -= (tm->tm_min) * 60;    gClientLogic().gameStartUtcTime_ += (hour - tm->tm_hour) * 60 * 60;    gClientLogic().gameStartUtcTime_ += (min) * 60;    gClientLogic().lastShadowCacheReset_ = -1; }
 
Upvote 0
Back