function exit_from_craft($add_query = '', $exit = 1, $userid = 0, $block = 0) { global $user_id; if ($userid == 0) { $userid = $user_id; } if ($exit == 1) { craft_DelFunc($userid); myquery("delete from craft_build_rab where user_id={$userid}"); myquery("delete from craft_user_func where user_id={$userid}"); } else { myquery("update craft_build_rab set date_rab=0,dlit=0,eliksir=0,`add`=0 where user_id={$userid}"); } /*myquery("update craft_build_lumberjack set user_id=0, end_time=0 where user_id=$userid"); myquery("update craft_build_stonemason set user_id=0, end_time=0 where user_id=$userid"); myquery("update craft_build_lumberjack set reserve_user_id=0, reserve_time=0 where reserve_user_id=$userid"); myquery("update craft_build_stonemason set reserve_user_id=0, reserve_time=0 where reserve_user_id=$userid");*/ myquery("update craft_build_mining set user_id=0, end_time=0 where user_id={$userid}"); if ($add_query != '') { $str_query = "update game_users set user_id={$userid}"; $str_query .= $add_query; $str_query .= ' where user_id=' . $userid; myquery($str_query); } if ($exit == 1) { set_craft_delay($userid, $block); ForceFunc($userid, 5); } }
function break_axe(&$action1) { global $user_id; myquery("UPDATE game_items SET item_uselife=item_uselife-2 WHERE priznak=0 AND user_id={$user_id} AND used=21"); list($id_item, $cur_uselife) = mysql_fetch_array(myquery("SELECT id,item_uselife FROM game_items WHERE priznak=0 AND user_id={$user_id} AND used=21")); if ($cur_uselife <= 0) { $Item = new Item($id_item); $Item->down(); craft_DelFunc($user_id); $action1 = 'У тебя сломано кайло!'; } }