Host Access Time

Started by Mariu22S, Apr 30, 2015, 10:48 PM

Previous topic - Next topic

Mariu22S

Can not create a function that counts the time from power on the server and displays the server is online idea is:

Server is online 1 day 12hour 30min. Cen you help me guys. Function on 0.3 not work

0.3 function

MessagePlayer( "Host is online: " + floor( GetTickCount()/3600000) + "h "+floor( GetTickCount()%3600000/60000)+"m.", player );
How create this function on 0.4 ? I need this format  Host online: 1 day 12hour 30minute

I did so but did not work:

MessagePlayer( "Host is online: " + floor( time()/3600000) + "h "+floor( time()%3600000/60000)+"m.", player );

.

#1
The time() function returns the time in seconds elapsed since January 1'st 1970. Therefore, using time() won't help you much in this regard. I'll be back with some code later.

EDIT:

Do you need the up time of the host machine or the game server? You haven't really specified that properly.
.

Mariu22S

I need time if the server is online. To count the number of hours starting the server if it is already on

.

Quote from: Mariu22S on May 01, 2015, 08:54 AMI need time if the server is online. To count the number of hours starting the server if it is already on

You might be easier to get the time since your game server started. There isn't any cross platform way to get the system up-time right now.
.

Mariu22S

Do you have any idea to create such a system?

Sk

Quote from: Mariu22S on May 01, 2015, 11:05 AMDo you have any idea to create such a system?
what SLC meant is,  create a global variable on onScriptLoad event something like
Start_time <- time();
and then make a function to get the time in seconds
function GetSeconds()
{
local a = time()-Start_time;
return a;
}
now you got seconds convert them to readable time your self.

Mariu22S