Closer Timer?
Hello!
I need a timer for a climb-server that calculates the time between start and end. I think about a timer that trigger all 0.1 seconds and calculate per player the current playtime. This is very computationally intensive for the server, therefore i think its not good. How can i realize that? I need a value with double-digit seconds, for example 10.23 seconds. In PHP i would realize that with microtime(), but i don't found a function like that in SourcePAWN. |
Re: Closer Timer?
Use GetEngineTime(). You might want to use GetTickInterval() and the forward OnGameFrame() too.
|
Re: Closer Timer?
The most accurate time you can get is with GetGameTime().
GetEngineTime() should only be used for profiling as stated in the API. |
Re: Closer Timer?
But GetGameTime() returns not the milliseconds, right?
|
Re: Closer Timer?
Quote:
It is not under GetEngineTime() nor GetGameTime(). I also searched GetGameTime in the wiki and didn't find anything... |
Re: Closer Timer?
|
Re: Closer Timer?
The functions aren't mentioned in the wiki.
Float:GetEngineTime() Quote:
Quote:
|
Re: Closer Timer?
Quote:
Quote:
|
Re: Closer Timer?
Quote:
The reason why you can't get more accurate than GetGameTime() is because the game is based on frames. The frame rate resolution is usually around ~60 frames / second. 60 frames / second => each 0,0166 seconds a frame is processed. The origin of a player is only updated each frame, there is nothing inbetween. GetEngineTime() is much more accurate, but this accuracy is pretty useless for game stuff because you can only call this function when a frame is processed. GetGameTime() is what is used in the game's code also internally, it has a resolution of 1 / framerate. |
All times are GMT -4. The time now is 19:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.