Просмотр файла element_function/element_function_mission.php

Размер файла: 1.6Kb
<?php

	function status_game($user_life, $bot_life, $avto) {
		if ($user_life == 0 AND $bot_life == 0 AND $avto == 0) $status = 0; // Бой с ботом: руками
		if ($user_life == 0 AND $bot_life == 0 AND $avto == 1) $status = 1; // Бой с ботом: автобой
		if ($user_life == 1 OR  $bot_life == 1) 			   $status = 2; // Результат боя
		return $status;
	}


	function mission_user_location($user) {
	$user_mission = mysql_fetch_array(mysql_query("SELECT * FROM `element_mission_user` WHERE `lost_user` = '$user' LIMIT 1"));
		if (!$user_mission) {
			mysql_query("INSERT INTO `element_mission_user` SET `lost_user` = '$user'");
			$user_mission = mysql_fetch_array("SELECT * FROM `element_mission_user` WHERE `lost_user` = '$user' LIMIT 1");
		}
		return $user_mission;
	}
	
	function mission_access($user,$mission) 
	{
	if ($mission > 1)
		{
	$temp = mysql_fetch_array(mysql_query("SELECT * FROM `element_mission_user` WHERE lost_user = $user LIMIT 1"));
	
	$res =  mysql_query("SELECT lost_count FROM `element_mission` WHERE lost_id <= $mission");
	$row = mysql_num_rows($res);
	$key1 = $temp['lost_location1']+$temp['lost_location2']+$temp['lost_location3']+$temp['lost_location14']+$temp['lost_location15'];
	for ($i = 0; $i <= $row-2; $i++) $key2 = $key2 + mysql_result($res,$i);
	//echo('<pre>');
	//print_r($key2);
	//echo('</pre>');
	if ($key2 <= $key1) return true; 
		else return false;
		} else return true;
	}

	
	$user_mission = mission_user_location($user['lost_id']);
	
	function mission_close_location($count_mission, $count_win) {
	
	
	}


?>