Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/tick/reseteachnight.class.php
<?php
include_once $PATH_TO_CODE."/script/tick/allincludefortick.php";

class ResetEachNightTick extends Tick {
	public function getName() {
		return "Reset each night";
	}
	public function run() {
		Log::info("clock is ".((time()/3600)%24)." hour");
		if((floor(time()/3600)%24) == 4) {
			Log::info("Reset server");
			//If we are around 4 hour (tick runs once each hour)
			$res=executer("SHOW TABLES");
			while($row=mysql_fetch_array($res)) {
				$locTableName = $row[0];
				if($locTableName <> "serverInfo" && $locTableName <> "playerConnection") {
					executer("DELETE FROM ".$row[0]);
				}
			}
			MonsterCreateTick::createMonsterPlayer();
			Server::reset();
			Constante::generateConstante(1, 7, 500, 500, 0, 0);
			disconnect();
			exit();
		}
	}
}
?>
Return current item: PhpBlock