lwb5-in-2025/scripts/game/beta5/library/getPlayerStatus.inc

30 lines
533 B
PHP

<?php
class beta5_getPlayerStatus {
public function __construct($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($pid) {
$q = $this->db->query("SELECT cash FROM player WHERE id=$pid");
if ($q && dbCount($q)) {
list($cash) = dbFetchArray($q);
} else {
$cash = 0;
}
$q = $this->db->query("SELECT COUNT(*) FROM planet WHERE owner=$pid");
if ($q && dbCount($q)) {
list($planets) = dbFetchArray($q);
} else {
$planets = 0;
}
return array($planets, $cash, 0);
}
}
?>