Jump to content

urgente porfa (necesito script users online)


SeBuenoPorfa

Recommended Posts

<?php

mysql_select_db("player");

$output = mysql_query("SELECT COUNT(*) as count FROM player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play;");

$online_count = mysql_fetch_object($output)->count;

echo "Juegadores conectados: $online_count";

?>

Link to comment
Share on other sites

<?php

mysql_select_db("player");

$output = mysql_query("SELECT COUNT(*) as count FROM player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play;");

$online_count = mysql_fetch_object($output)->count;

echo "Juegadores conectados: $online_count";

?>

Eso te muestra en los últimos 5 minutos, no "exactamente ahora" xD

Link to comment
Share on other sites

<?phpmysql_select_db("player");$output = mysql_query("SELECT COUNT(*) as count FROM player WHERE DATE_SUB(NOW(), INTERVAL 1 SECOND) < last_play;");$online_pj = mysql_fetch_object($output)->count;echo "Jugadores conectados: $online_pj";?>

El de los 5 minutos es más adecuado, esto va a cargar mucho el sv, pero bueno, como quieras

 

Si quieres modificar el nº de segundos cambia esto

 

INTERVAL 1 SECOND

 

por 

INTERVAL 10 SECOND

INTERVAL 100 SECOND

..

 

Puedes poner SECOND (segundos), MINUTE (minutos), HOUR (hora), WEEK, MONTH, YEAR, etc.

Link to comment
Share on other sites

  • Dilong locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...