"Mostrar players online en top servers"


May 16, 2025 8:51 pm
Como aparecer en https://helbreathhub.com/topservers mostrando players online:
En el ontimmer deben contar la cantidad de usuarios cada cierto tiempo y grabarla en un log (un arhivo)
deben grabar el numero pelado
luego desde el back end de la web leeer el archivo y escribir el resultado sin ningun tag
yo use este code (desde c#):
En el ontimmer deben contar la cantidad de usuarios cada cierto tiempo y grabarla en un log (un arhivo)
deben grabar el numero pelado
try{
FILE *data;
if ( (data = fopen("UsersOnline.txt", "w")) == NULL)
{
//Error opening file
}else{
if (data != NULL){
fprintf(data,"%d", m_iTotalGameServerClients);
fclose(data);
}
}
}catch(exception e){
}
luego desde el back end de la web leeer el archivo y escribir el resultado sin ningun tag
yo use este code (desde c#):
protected void Page_Load(object sender, EventArgs e)
{
int cantidad = 0;
try
{
string line;
System.IO.StreamReader file = new System.IO.StreamReader(@"C:\Server\GameServers\GameServer\UsersOnline.txt");
while ((line = file.ReadLine()) != null)
{
cantidad = Convert.ToInt32(line);
}
file.Close();
Response.Write(cantidad.ToString());
}
catch (Exception ex)
{
Response.Write("0");
}
}
You must log in to reply.