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/ticks/quit/library.inc

33 lines
708 B
PHP

<?php
//--------------------------------------------
// "Quit tick": account deletion for quitters
//--------------------------------------------
class beta5_ticks_quit_library {
public function __construct($lib) {
$this->lib = $lib;
$this->db = $lib->game->db;
$this->main = $lib->game->getLib();
}
public function runTick() {
$this->db->safeTransaction(array($this, 'quit'));
}
public function quit() {
$q = $this->db->query(
"SELECT id FROM player "
. "WHERE quit IS NOT NULL AND (UNIX_TIMESTAMP(NOW()) - quit) < 86400 "
. "AND (UNIX_TIMESTAMP(NOW()) - quit) > 86339"
);
while ($r = dbFetchArray($q)) {
$this->main->call('leaveGame', $r[0], 'QUIT');
}
}
}
?>