I'm trying a little server hack to make server report status to a site, so i can parse it with php, and make a little box on my site with the server status.
I don't know if there is already a cleaver way to do this, i hope not.....
Here it goes: (from net_server.c function NetworkServerMonthlyLoop)
Code: Select all
void NetworkServerMonthlyLoop(void)
{
FILE *f1;
char tmp[256];
int year;
f1 = fopen("status.txt","w+");
sprintf(tmp,"Server revision = %s\n",_network_game_info.server_revision);
fputs(tmp,f1);
year = ConvertDateInt(_network_game_info.game_date);
sprintf(tmp,"Current year = %i\n",year);
fputs(tmp,f1);
sprintf(tmp,"Game start = %i\n",_network_game_info.start_date);
fputs(tmp,f1);
sprintf(tmp,"Clients on = %i\n",_network_game_info.clients_on);
fputs(tmp,f1);
sprintf(tmp,"Max Clients = %i\n",_network_game_info.clients_max);
fputs(tmp,f1);
sprintf(tmp,"Spectators = %i\n",_network_game_info.spectators_on);
fputs(tmp,f1);
fclose(f1);
NetworkCheckRestartMap();
NetworkAutoCleanCompanies();
}
So can someone save me the trouble? thanks in advance!
P.S.-Some loops to display player/companies status would be apreciated too