PHP Code:
#include <amxmodx>
#pragma semicolon 1
new g_MaxClients;
public plugin_init()
{
register_concmd("say /uptime", "Command_Time");
g_MaxClients = get_maxplayers();
}
public Command_Time(client)
{
new Float:theTime = get_gametime();
new days = floatround(theTime / 86400, floatround_tozero);
new hours = floatround( (theTime-days) / 3600, floatround_tozero);
new minutes = floatround( (theTime-days-hours)/60, floatround_tozero);
new seconds = floatround(theTime - days - hours - minutes, floatround_tozero);
new milli = floatround( (theTime - days - hours - minutes - seconds) * 1000, floatround_tozero);
if(client > 0 && client <= g_MaxClients && is_user_connected(client))
{
client_print(client, print_chat, "Uptime: %d days %d hours %d minutes %d seconds and %d milliseconds", days, hours, minutes, seconds, milli);
}
else if(client == 0)
{
server_print("Uptime: %d days %d hours %d minutes %d seconds and %d milliseconds", days, hours, minutes, seconds, milli);
}
return PLUGIN_HANDLED;
}