This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/beta5/library/getPlayerCount.inc

24 lines
401 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_getPlayerCount {
function beta5_getPlayerCount($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
/** Get player count. */
function run() {
$r = $this->db->query("SELECT COUNT(*) FROM player "
. "WHERE (quit IS NULL OR UNIX_TIMESTAMP(NOW())-quit<86400) AND NOT hidden");
if (!$r) {
return 0;
}
list($c) = dbFetchArray($r);
return $c;
}
}
?>