Is there a way I could get the servers uptime?
I am trying to make a plugin that will log the servers uptime, but have hit a wall, i have the command to find when the server is shutdown[plugin_end()], now i need a command to tell when the server starts up!
I am then going to use this and find the uptime by taking when the server started, lets call that S, and when the server ended, lets call that E and by taking away S from E i will get the uptime or T. S-E=T Please do not lock this post, i will have more qustions when this is answered. |
isnt it just halflife_time?
|
1) Yes, halflife_time should return the amount of seconds since the map start (as a float).
2) The command which gets called when the map starts is plugin_init. 3) If you want to know the server's total uptime, you could write the map time to a vault in plugin_end and load it again in plugin_init. If the difference is smaller than 30 seconds, you could assume that the server did not crash :) |
Thanks :D
|
Also, for times it crashes in the middle of the map this is what you could do:
Well, when a server crashes the plugin_end() wouldn't execute right? So each time plugin_end() executes, you could write something to vault saying that the server successfully shut down the map. Now if it crashes after a map change, it's usually to a bad WAD file or too many precached textures, in which case (at least on Windows) the server will not automatically restart until someone hits "OK" for the error message, so you could just compare the time it takes for the map to change like PM said. |
Ya see this is what i am going to do to contend with that, if there are two start lines in the vault then i know the server crashed between these times :).
|
Ok found halflife_time() in engine.inc, but is there a specific way i must handel floats?
Code:
Ok so ... give me a block of code on how i should go about this, please. |
Code:
|
Thank you soo much, this has been a great help.
|
Can you post the plugin. Make it like "thetime" plugin. but only do "theuptime" ;).
|
| All times are GMT -4. The time now is 14:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.