[MU] giúp mình reset không mất nhiệm vụ 220
Follow us on
Follow us on Facebook Follow us on Twitter Linked In Flickr Watch us on YouTube My Space Blogger
 
Kết quả 1 đến 10 của 10
  1. #1
    Thành Viên thaoq12's Avatar
    Ngày tham gia
    Nov 2008
    Bài viết
    219
    Thanks
    44
    Thanked 10 Times in 9 Posts

    giúp mình reset không mất nhiệm vụ 220

    hiện tại mình reset song là mất nhiệm vụ 220 phải làm lại mình xài web nbb ver4
    ai biết cách sửa chỉ mình với
    Khách viếng thăm hãy cùng thaoq12 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  2. #2
    Nà Ní Team 👑 hackluv's Avatar
    Ngày tham gia
    Nov 2011
    Đang ở
    ĐỊA NGỤC
    Bài viết
    2,557
    Thanks
    427
    Thanked 1,644 Times in 897 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    xem cái reset trên web ==!

    30 charrrrrrrrrrrrrrrrrrr
    BÁN VPS và máy chủ vật lý [Only registered and activated users can see links. ]
    VietGuards Khuyến Mại Tết [Only registered and activated users can see links. ]

  3. #3
    Thành Viên thaoq12's Avatar
    Ngày tham gia
    Nov 2008
    Bài viết
    219
    Thanks
    44
    Thanked 10 Times in 9 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    Trích dẫn Gửi bởi hackluv [Only registered and activated users can see links. ]
    xem cái reset trên web ==!

    30 charrrrrrrrrrrrrrrrrrr
    <?php include_once("security.php");
    include_once('config.php');
    include_once('config/config_reset.php');
    include_once('config/config_hotrotanthu.php');
    include_once('config/config_gioihanrs.php');
    include_once('config/config_relife.php');
    include_once('config/config_event.php');
    include_once('function.php');


    $login = $_POST['login'];
    $name = $_POST['name'];


    $resetnow = $_POST['resetnow']; $resetnow = abs(intval($resetnow));


    $passtransfer = $_POST['passtransfer'];


    if ($passtransfer == $transfercode) {


    $string_login = $_POST['string_login'];
    checklogin($login,$string_login);


    fixrs($name);
    check_resetday();
    check_resetmonth();


    $inventory_query = "SELECT CAST(Inventory AS image) FROM Character WHERE AccountID = '$login' AND Name='$name'";


    kiemtra_doinv($login,$name);
    kiemtra_online($login);


    $inventory_result_sql = $db->Execute($inventory_query);
    $inventory_result = $inventory_result_sql->fetchrow();


    $sql_PkLevel_check = $db->Execute("SELECT PkLevel FROM Character WHERE PkLevel > 3 and Name='$name'");
    $PkLevel_check = $sql_PkLevel_check->numrows();


    $sql_char_back_reged_check = $db->Execute("SELECT Name FROM Character_back WHERE Name='$name' and AccountID = '$login'");
    $char_back_reged_check = $sql_char_back_reged_check->numrows();


    $result = $db->Execute("Select Clevel,Resets,Money,LevelUpPoint,Class,Relifes,NoR esetInDay,Resets_Time, Top50 From Character where Name='$name'");
    $row = $result->fetchrow();


    if($resetnow >0 && abs(intval($row[1])) == 0) {
    echo "Hệ thống Reset bị gián đoạn. Vui lòng Reset lại";
    exit();
    }


    $vpoint_result = $db->Execute("Select vpoint From MEMB_INFO where memb___id='$login'");
    $vpoint = $vpoint_result->fetchrow();


    $check_jewel = $db->Execute("SELECT jewel_chao,jewel_cre,jewel_blue FROM MEMB_INFO WHERE memb___id='$login'");
    $jewel = $check_jewel->fetchrow();


    $thehe_result = $db->Execute("Select thehe From MEMB_INFO where memb___id='$login'");
    $thehe_fetch = $thehe_result->fetchrow();
    $thehe = $thehe_fetch[0];


    $inventory = $inventory_result[0];
    $inventory = bin2hex($inventory);
    $inventory3 = substr($inventory,76*32);
    $inventory3 = strtoupper($inventory3);


    $total_item_inventory3 = floor(strlen($inventory3)/32);


    $no_item = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
    $count_item_inventory3 = 0;


    // Tu Season 6.1 tro xuong
    if($total_item_inventory3 <= 32) {
    for ($i=0;$i<$total_item_inventory3;$i++) {
    $check_item = substr($inventory3,$i*32, 32);
    if($check_item != $no_item) {
    $count_item_inventory3++;
    }
    }
    }
    // Tu Season 6.2 tro len
    else {
    for ($i=128;$i<$total_item_inventory3;$i++) {
    $check_item = substr($inventory3,$i*32, 32);
    if($check_item != $no_item) {
    $count_item_inventory3++;
    }
    }
    }


    if ($count_item_inventory3 > 0) { echo "Cửa hàng cá nhân có vật phẩm. Vui lòng bỏ ra khỏi cửa hàng cá nhân để tránh bị mất đồ."; exit(); }


    $CountNoResetInDay=$row[6]+1;


    //Begin Giới hạn Reset trong ngày
    if($use_gioihanrs[$thehe] == 1) {
    $ResetDay = $row[6];
    $char_in_top = $row[8];

    if($char_in_top >0 && $char_in_top<=10) $gioihanrs = $gioihanrs_top10[$thehe];
    elseif($char_in_top >10 && $char_in_top<=20) $gioihanrs = $gioihanrs_top20[$thehe];
    elseif($char_in_top >20 && $char_in_top<=30) $gioihanrs = $gioihanrs_top30[$thehe];
    elseif($char_in_top >30 && $char_in_top<=40) $gioihanrs = $gioihanrs_top40[$thehe];
    elseif($char_in_top >40 && $char_in_top<=50) $gioihanrs = $gioihanrs_top50[$thehe];
    else $gioihanrs = $gioihanrs_other[$thehe];




    if( isset($gioihanrs) && $ResetDay >= $gioihanrs) {
    echo "Bạn đã Reset hết số lần Reset trong ngày. Xin vui lòng Ủy thác và đợi Reset tiếp vào ngày mai"; exit();
    }
    }
    //End Giới hạn Reset trong ngày


    if ($PkLevel_check > 0){
    echo "Bạn đang là Sát thủ. Phải rửa tội trước khi Reset."; exit();
    }


    if ( ($row[1] >= $reset_cap_0) AND ($row[1] < $reset_cap_1) )
    {
    $level = $level_cap_1;
    $zen = $zen_cap_1;
    $time_reset_next = $time_reset_next_1;
    $chao = $chao_cap_1;
    $cre = $cre_cap_1;
    $blue = $blue_cap_1;
    }
    elseif ( ($row[1] >= $reset_cap_1) AND ($row[1] < $reset_cap_2) )
    {
    $level = $level_cap_2;
    $zen = $zen_cap_2;
    $time_reset_next = $time_reset_next_2;
    $chao = $chao_cap_2;
    $cre = $cre_cap_2;
    $blue = $blue_cap_2;
    }
    elseif ( ($row[1] >= $reset_cap_2) AND ($row[1] < $reset_cap_3) )
    {
    $level = $level_cap_3;
    $zen = $zen_cap_3;
    $time_reset_next = $time_reset_next_3;
    $chao = $chao_cap_3;
    $cre = $cre_cap_3;
    $blue = $blue_cap_3;
    }
    elseif ( ($row[1] >= $reset_cap_3) AND ($row[1] < $reset_cap_4) )
    {
    $level = $level_cap_4;
    $zen = $zen_cap_4;
    $time_reset_next = $time_reset_next_4;
    $chao = $chao_cap_4;
    $cre = $cre_cap_4;
    $blue = $blue_cap_4;
    }
    elseif ( ($row[1] >= $reset_cap_4) AND ($row[1] < $reset_cap_5) )
    {
    $level = $level_cap_5;
    $zen = $zen_cap_5;
    $time_reset_next = $time_reset_next_5;
    $chao = $chao_cap_5;
    $cre = $cre_cap_5;
    $blue = $blue_cap_5;
    }
    elseif ( ($row[1] >= $reset_cap_5) AND ($row[1] < $reset_cap_6) )
    {
    $level = $level_cap_6;
    $zen = $zen_cap_6;
    $time_reset_next = $time_reset_next_6;
    $chao = $chao_cap_6;
    $cre = $cre_cap_6;
    $blue = $blue_cap_6;
    }
    elseif ( ($row[1] >= $reset_cap_6) AND ($row[1] < $reset_cap_7) )
    {
    $level = $level_cap_7;
    $zen = $zen_cap_7;
    $time_reset_next = $time_reset_next_7;
    $chao = $chao_cap_7;
    $cre = $cre_cap_7;
    $blue = $blue_cap_7;
    }
    elseif ( ($row[1] >= $reset_cap_7) AND ($row[1] < $reset_cap_8) )
    {
    $level = $level_cap_8;
    $zen = $zen_cap_8;
    $time_reset_next = $time_reset_next_8;
    $chao = $chao_cap_8;
    $cre = $cre_cap_8;
    $blue = $blue_cap_8;
    }
    elseif ( ($row[1] >= $reset_cap_8) AND ($row[1] < $reset_cap_9) )
    {
    $level = $level_cap_9;
    $zen = $zen_cap_9;
    $time_reset_next = $time_reset_next_9;
    $chao = $chao_cap_9;
    $cre = $cre_cap_9;
    $blue = $blue_cap_9;
    }
    elseif ( ($row[1] >= $reset_cap_9) AND ($row[1] < $reset_cap_10) )
    {
    $level = $level_cap_10;
    $zen = $zen_cap_10;
    $time_reset_next = $time_reset_next_10;
    $chao = $chao_cap_10;
    $cre = $cre_cap_10;
    $blue = $blue_cap_10;
    }
    elseif ( ($row[1] >= $reset_cap_10) AND ($row[1] < $reset_cap_11) )
    {
    $level = $level_cap_11;
    $zen = $zen_cap_11;
    $time_reset_next = $time_reset_next_11;
    $chao = $chao_cap_11;
    $cre = $cre_cap_11;
    $blue = $blue_cap_11;
    }
    elseif ( ($row[1] >= $reset_cap_11) AND ($row[1] < $reset_cap_12) )
    {
    $level = $level_cap_12;
    $zen = $zen_cap_12;
    $time_reset_next = $time_reset_next_12;
    $chao = $chao_cap_12;
    $cre = $cre_cap_12;
    $blue = $blue_cap_12;
    }
    elseif ( ($row[1] >= $reset_cap_12) AND ($row[1] < $reset_cap_13) )
    {
    $level = $level_cap_13;
    $zen = $zen_cap_13;
    $time_reset_next = $time_reset_next_13;
    $chao = $chao_cap_13;
    $cre = $cre_cap_13;
    $blue = $blue_cap_13;
    }
    elseif ( ($row[1] >= $reset_cap_13) AND ($row[1] < $reset_cap_14) )
    {
    $level = $level_cap_14;
    $zen = $zen_cap_14;
    $time_reset_next = $time_reset_next_14;
    $chao = $chao_cap_14;
    $cre = $cre_cap_14;
    $blue = $blue_cap_14;
    }
    elseif ( ($row[1] >= $reset_cap_14) AND ($row[1] < $reset_cap_15) )
    {
    $level = $level_cap_15;
    $zen = $zen_cap_15;
    $time_reset_next = $time_reset_next_15;
    $chao = $chao_cap_15;
    $cre = $cre_cap_15;
    $blue = $blue_cap_15;
    }
    elseif ( ($row[1] >= $reset_cap_15) AND ($row[1] < $reset_cap_16) )
    {
    $level = $level_cap_16;
    $zen = $zen_cap_16;
    $time_reset_next = $time_reset_next_16;
    $chao = $chao_cap_16;
    $cre = $cre_cap_16;
    $blue = $blue_cap_16;
    }
    elseif ( ($row[1] >= $reset_cap_16) AND ($row[1] < $reset_cap_17) )
    {
    $level = $level_cap_17;
    $zen = $zen_cap_17;
    $time_reset_next = $time_reset_next_17;
    $chao = $chao_cap_17;
    $cre = $cre_cap_17;
    $blue = $blue_cap_17;
    }
    elseif ( ($row[1] >= $reset_cap_17) AND ($row[1] < $reset_cap_18) )
    {
    $level = $level_cap_18;
    $zen = $zen_cap_18;
    $time_reset_next = $time_reset_next_18;
    $chao = $chao_cap_18;
    $cre = $cre_cap_18;
    $blue = $blue_cap_18;
    }
    elseif ( ($row[1] >= $reset_cap_18) AND ($row[1] < $reset_cap_19) )
    {
    $level = $level_cap_19;
    $zen = $zen_cap_19;
    $time_reset_next = $time_reset_next_19;
    $chao = $chao_cap_19;
    $cre = $cre_cap_19;
    $blue = $blue_cap_19;
    }
    elseif ( ($row[1] >= $reset_cap_19) AND ($row[1] < $reset_cap_20) )
    {
    $level = $level_cap_20;
    $zen = $zen_cap_20;
    $time_reset_next = $time_reset_next_20;
    $chao = $chao_cap_20;
    $cre = $cre_cap_20;
    $blue = $blue_cap_20;
    }


    //Begin hỗ trợ tân thủ
    if ($hotrotanthu == 1) {
    $Resetnow = $row[1];
    $Relifenow = $row[5];

    if( ($capsudung >= 1) && ($cap1_reset_min<=$Resetnow && $Resetnow<=$cap1_reset_max) && ($cap1_relife_min<=$Relifenow && $Relifenow<=$cap1_relife_max) ) {
    $level = $level - $cap1_levelgiam;
    }
    elseif( ($capsudung >= 2) && ($cap2_reset_min<=$Resetnow && $Resetnow<=$cap2_reset_max) && ($cap2_relife_min<=$Relifenow && $Relifenow<=$cap2_relife_max) ) {
    $level = $level - $cap2_levelgiam;
    }
    elseif( ($capsudung >= 3) && ($cap3_reset_min<=$Resetnow && $Resetnow<=$cap3_reset_max) && ($cap3_relife_min<=$Relifenow && $Relifenow<=$cap3_relife_max) ) {
    $level = $level - $cap3_levelgiam;
    }
    elseif( ($capsudung >= 4) && ($cap4_reset_min<=$Resetnow && $Resetnow<=$cap4_reset_max) && ($cap4_relife_min<=$Relifenow && $Relifenow<=$cap4_relife_max) ) {
    $level = $level - $cap4_levelgiam;
    }
    elseif( ($capsudung >= 5) && ($cap5_reset_min<=$Resetnow && $Resetnow<=$cap5_reset_max) && ($cap5_relife_min<=$Relifenow && $Relifenow<=$cap5_relife_max) ) {
    $level = $level - $cap5_levelgiam;
    }


    }
    //End hỗ trợ tân thủ




    switch ($row[5]) {
    case 0:
    $reset_relifes = $rl_reset_relife1;
    $point_relifes = 0;
    $ml_relifes = 0;
    break;
    case 1:
    $reset_relifes = $rl_reset_relife2;
    $point_relifes = $rl_point_relife1;
    $ml_relifes = $rl_ml_relife1;
    break;
    case 2:
    $reset_relifes = $rl_reset_relife3;
    $point_relifes = $rl_point_relife2;
    $ml_relifes = $rl_ml_relife2;
    break;
    case 3:
    $reset_relifes = $rl_reset_relife4;
    $point_relifes = $rl_point_relife3;
    $ml_relifes = $rl_ml_relife3;
    break;
    case 4:
    $reset_relifes = $rl_reset_relife5;
    $point_relifes = $rl_point_relife4;
    $ml_relifes = $rl_ml_relife4;
    break;
    case 5:
    $reset_relifes = $rl_reset_relife6;
    $point_relifes = $rl_point_relife5;
    $ml_relifes = $rl_ml_relife5;
    break;
    case 6:
    $reset_relifes = $rl_reset_relife7;
    $point_relifes = $rl_point_relife6;
    $ml_relifes = $rl_ml_relife6;
    break;
    case 7;
    $reset_relifes = $rl_reset_relife8;
    $point_relifes = $rl_point_relife7;
    $ml_relifes = $rl_ml_relife7;
    break;
    case 8:
    $reset_relifes = $rl_reset_relife9;
    $point_relifes = $rl_point_relife8;
    $ml_relifes = $rl_ml_relife8;
    break;
    case 9:
    $reset_relifes = $rl_reset_relife10;
    $point_relifes = $rl_point_relife9;
    $ml_relifes = $rl_ml_relife9;
    break;
    case 10:
    $reset_relifes = $rl_reset_relife11;
    $point_relifes = $rl_point_relife10;
    $ml_relifes = $rl_ml_relife10;
    break;
    }


    if ( $row[1] >= $reset_relifes ) {
    echo "$name đang ReLife: $row[5] - Reset: $row[1]. Để Reset tiếp bạn cần phải ReLife."; exit();
    }


    $relife = $row[5];
    $resetold = $row[1]; $resetold = abs(intval($resetold));
    $resetup = $resetold + 1;




    //Cong thuc Reset
    if ( ($jewel[0] < $chao) OR ($jewel[1] < $cre) OR ($jewel[2] < $blue) )
    {
    echo "Bạn không đủ Jewel trong ngân hàng.<br>Số lần Reset hiện tại của bạn là $row[1]. Bạn cần $chao Chao , $cre Creation , $blue Blue Feather."; exit();
    }
    if ($row[0] < $level) {echo "$name cần $level level để Reset lần $resetup."; exit();}
    if ($row[2] < $zen) {echo "$name cần $zen Zen để Reset lần $resetup."; exit();}


    $time_reset_next = $row[7]+$time_reset_next*60;
    if ($time_reset_next > $timestamp) {
    $time_free = $time_reset_next - $timestamp;
    echo "$name cần $time_free giây nữa để Reset lần tiếp theo."; exit();
    }


    //Reset lần 1
    if ($row[1] == $reset_cap_0)
    {
    $resetpoint=$point_relifes+$point_cap_1;
    $resetmoeny = $row[2] - $zen_cap_1;
    $leadership = $ml_relifes+$ml_cap_1;
    }
    //Reset cấp 1
    elseif ($row[1] < $reset_cap_1)
    {
    $resetpoint=$point_relifes+$point_cap_1+$row[1]*$point_cap_1;
    $resetmoeny = $row[2] - $zen_cap_1;
    $leadership = $ml_relifes+$ml_relifes+$ml_cap_1+$row[1]*$ml_cap_1;
    }
    //Reset cấp 1 -> 2
    elseif ($row[1] >= $reset_cap_1 AND $row[1] < $reset_cap_2)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($row[1]-($reset_cap_1-1))*$point_cap_2;
    $resetmoeny = $row[2] - $zen_cap_2;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $row[1]-($reset_cap_1-1))*$ml_cap_2;
    }
    //Reset cấp 2 -> 3
    elseif ($row[1] >= $reset_cap_2 AND $row[1] < $reset_cap_3)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($row[1]-($reset_cap_2-1))*$point_cap_3;
    $resetmoeny = $row[2] - $zen_cap_3;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($row[1]-($reset_cap_2-1))*$ml_cap_3;
    }
    //Reset cấp 3 -> 4
    elseif ($row[1] >= $reset_cap_3 AND $row[1] < $reset_cap_4)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($row[1]-($reset_cap_3-1))*$point_cap_4;
    $resetmoeny = $row[2] - $zen_cap_4;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($row[1]-($reset_cap_3-1))*$ml_cap_4;
    }
    //Reset cấp 4 -> 5
    elseif ($row[1] >= $reset_cap_4 AND $row[1] < $reset_cap_5)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($row[1]-($reset_cap_4-1))*$point_cap_5;
    $resetmoeny = $row[2] - $zen_cap_5;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($row[1]-($reset_cap_4-1))*$ml_cap_5;
    }
    //Reset cấp 5 -> 6
    elseif ($row[1] >= $reset_cap_5 AND $row[1] < $reset_cap_6)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($row[1]-($reset_cap_5-1))*$point_cap_6;
    $resetmoeny = $row[2] - $zen_cap_6;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($row[1]-($reset_cap_5-1))*$ml_cap_6;
    }
    //Reset cấp 6 -> 7
    elseif ($row[1] >= $reset_cap_6 AND $row[1] < $reset_cap_7)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($row[1]-($reset_cap_6-1))*$point_cap_7;
    $resetmoeny = $row[2] - $zen_cap_7;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($row[1]-($reset_cap_6-1))*$ml_cap_7;
    }
    //Reset cấp 7 -> 8
    elseif ($row[1] >= $reset_cap_7 AND $row[1] < $reset_cap_8)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($row[1]-($reset_cap_7-1))*$point_cap_8;
    $resetmoeny = $row[2] - $zen_cap_8;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($row[1]-($reset_cap_7-1))*$ml_cap_8;
    }
    //Reset cấp 8 -> 9
    elseif ($row[1] >= $reset_cap_8 AND $row[1] < $reset_cap_9)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($row[1]-($reset_cap_8-1))*$point_cap_9;
    $resetmoeny = $row[2] - $zen_cap_9;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($row[1]-($reset_cap_8-1))*$ml_cap_9;
    }
    //Reset cấp 9 -> 10
    elseif ($row[1] >= $reset_cap_9 AND $row[1] < $reset_cap_10)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($row[1]-($reset_cap_9-1))*$point_cap_10;
    $resetmoeny = $row[2] - $zen_cap_10;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($row[1]-($reset_cap_9-1))*$ml_cap_10;
    }
    //Reset cấp 10 -> 11
    elseif ($row[1] >= $reset_cap_10 AND $row[1] < $reset_cap_11)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($row[1]-($reset_cap_10-1))*$point_cap_11;
    $resetmoeny = $row[2] - $zen_cap_11;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($row[1]-($reset_cap_10-1))*$ml_cap_11;
    }
    //Reset cấp 11 -> 12
    elseif ($row[1] >= $reset_cap_11 AND $row[1] < $reset_cap_12)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($row[1]-($reset_cap_11-1))*$point_cap_12;
    $resetmoeny = $row[2] - $zen_cap_12;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($row[1]-($reset_cap_11-1))*$ml_cap_12;
    }
    //Reset cấp 12 -> 13
    elseif ($row[1] >= $reset_cap_12 AND $row[1] < $reset_cap_13)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($row[1]-($reset_cap_12-1))*$point_cap_13;
    $resetmoeny = $row[2] - $zen_cap_13;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($row[1]-($reset_cap_12-1))*$ml_cap_13;
    }
    //Reset cấp 13 -> 14
    elseif ($row[1] >= $reset_cap_13 AND $row[1] < $reset_cap_14)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($row[1]-($reset_cap_13-1))*$point_cap_14;
    $resetmoeny = $row[2] - $zen_cap_14;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($row[1]-($reset_cap_13-1))*$ml_cap_14;
    }
    //Reset cấp 14 -> 15
    elseif ($row[1] >= $reset_cap_14 AND $row[1] < $reset_cap_15)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($row[1]-($reset_cap_14-1))*$point_cap_15;
    $resetmoeny = $row[2] - $zen_cap_15;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($row[1]-($reset_cap_14-1))*$ml_cap_15;
    }
    //Reset cấp 15 -> 16
    elseif ($row[1] >= $reset_cap_15 AND $row[1] < $reset_cap_16)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($row[1]-($reset_cap_15-1))*$point_cap_16;
    $resetmoeny = $row[2] - $zen_cap_16;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($row[1]-($reset_cap_15-1))*$ml_cap_16;
    }
    //Reset cấp 16 -> 17
    elseif ($row[1] >= $reset_cap_16 AND $row[1] < $reset_cap_17)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($row[1]-($reset_cap_16-1))*$point_cap_17;
    $resetmoeny = $row[2] - $zen_cap_17;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($row[1]-($reset_cap_16-1))*$ml_cap_17;
    }
    //Reset cấp 17 -> 18
    elseif ($row[1] >= $reset_cap_17 AND $row[1] < $reset_cap_18)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($point_cap_17*($reset_cap_17-$reset_cap_16))+($row[1]-($reset_cap_17-1))*$point_cap_18;
    $resetmoeny = $row[2] - $zen_cap_18;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($ml_cap_17*($reset_cap_17-$reset_cap_16))+($row[1]-($reset_cap_17-1))*$ml_cap_18;
    }
    //Reset cấp 18 -> 19
    elseif ($row[1] >= $reset_cap_18 AND $row[1] < $reset_cap_19)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($point_cap_17*($reset_cap_17-$reset_cap_16))+($point_cap_18*($reset_cap_18-$reset_cap_17))+($row[1]-($reset_cap_18-1))*$point_cap_19;
    $resetmoeny = $row[2] - $zen_cap_19;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($ml_cap_17*($reset_cap_17-$reset_cap_16))+($ml_cap_18*($reset_cap_18-$reset_cap_17))+($row[1]-($reset_cap_18-1))*$ml_cap_19;
    }
    //Reset cấp 19 -> 20
    elseif ($row[1] >= $reset_cap_19 AND $row[1] < $reset_cap_20)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($point_cap_17*($reset_cap_17-$reset_cap_16))+($point_cap_18*($reset_cap_18-$reset_cap_17))+($point_cap_19*($reset_cap_19-$reset_cap_18))+($row[1]-($reset_cap_19-1))*$point_cap_20;
    $resetmoeny = $row[2] - $zen_cap_20;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($ml_cap_17*($reset_cap_17-$reset_cap_16))+($ml_cap_18*($reset_cap_18-$reset_cap_17))+($ml_cap_19*($reset_cap_19-$reset_cap_18))+($row[1]-($reset_cap_19-1))*$ml_cap_20;
    }
    //Fix Menh lenh DarkLord > 32k
    if ( $leadership>32000 ) $leadership=32000;




    $ClassType = $row[4];
    switch ($ClassType){
    case 0:
    case 1:
    case 2:
    case 3:
    $Class_Default = 0;
    break;

    case 16:
    case 17:
    case 18:
    case 19:
    $Class_Default = 16;
    break;

    case 32:
    case 33:
    case 34:
    case 35:
    $Class_Default = 32;
    break;

    case 48:
    case 49:
    case 50:
    $Class_Default = 48;
    break;

    case 64:
    case 65:
    case 66:
    $Class_Default = 64;
    break;

    case 80:
    case 81:
    case 82:
    case 83:
    $Class_Default = 80;
    break;

    case 96:
    case 97:
    case 98:
    $Class_Default = 96;
    break;

    default :
    $Class_Default = 0;
    }
    $default_query = "SELECT Strength, Dexterity, Vitality, Energy, Life, MaxLife, Mana, MaxMana, MapNumber, MapPosX, MapPosY FROM DefaultClassType WHERE Class=" . $Class_Default;
    $default_result = $db->execute($default_query);
    check_queryerror($default_query, $default_result);
    $point_default = $default_result->fetchrow();
    $Strength_Default = $point_default[0];
    $Dexterity_Default = $point_default[1];
    $Vitality_Default = $point_default[2];
    $Energy_Default = $point_default[3];
    $Life_Default = $point_default[4];
    $MaxLife_Default = $point_default[5];
    $Mana_Default = $point_default[6];
    $MaxMana_Default = $point_default[7];
    $MapNumber_Default = abs(intval($point_default[8]));
    $MapPosX_Default = abs(intval($point_default[9]));
    $MapPosY_Default = abs(intval($point_default[10]));


    $Strength = $Strength_Default;
    $Dexterity = $Dexterity_Default;
    $Vitality = $Vitality_Default;
    $Energy = $Energy_Default;
    $Life = $Life_Default;
    $MaxLife = $MaxLife_Default;
    $Mana = $Mana_Default;
    $MaxMana = $MaxMana_Default;
    $MapNumber = $MapNumber_Default;
    $MapPosX = $MapPosX_Default;
    $MapPosY = $MapPosY_Default;
    $Mapdir=0;


    $Point_Default_total = $Strength + $Dexterity + $Vitality + $Energy;


    //End Cong thuc Reset


    //Tat ca cac Quest
    $all_quest="Update character set Quest=0xaaeaffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffff ffffff where name='$name'";
    if( intval($level_after_reset) >1 ) $clevel = $level_after_reset;
    else $clevel = 1;


    $point_event_qr = $db->Execute("SELECT point_event FROM Character WHERE Name='$name'");
    $point_event = $point_event_qr->fetchrow();
    $resetpoint = $resetpoint + $point_event[0];


    if( $resetpoint > 65000) {
    $pointup = 65000;
    $resetpoint = $resetpoint - 65000;
    } else {
    $pointup = $resetpoint;
    $resetpoint = 0;
    }


    switch ($month)
    {
    case '01' : $fieldtopmonth = 'TopMonth01'; break;
    case '02' : $fieldtopmonth = 'TopMonth02'; break;
    case '03' : $fieldtopmonth = 'TopMonth03'; break;
    case '04' : $fieldtopmonth = 'TopMonth04'; break;
    case '05' : $fieldtopmonth = 'TopMonth05'; break;
    case '06' : $fieldtopmonth = 'TopMonth06'; break;
    case '07' : $fieldtopmonth = 'TopMonth07'; break;
    case '08' : $fieldtopmonth = 'TopMonth08'; break;
    case '09' : $fieldtopmonth = 'TopMonth09'; break;
    case '10' : $fieldtopmonth = 'TopMonth10'; break;
    case '11' : $fieldtopmonth = 'TopMonth11'; break;
    case '12' : $fieldtopmonth = 'TopMonth12'; break;
    default : $fieldtopmonth = 'TopMonth01';
    }


    kiemtra_doinv($login,$name);
    kiemtra_online($login);


    // Ghi log nhung nhan vat Reset qua nhanh
    if($timestamp < $row[7] + 300) {
    $time_chenh = $timestamp - $row[7];
    $phut_chenh = floor($time_chenh/60);
    $giay_chenh = $time_chenh%60;
    $log_Des = "$name Reset lần thứ $resetup quá nhanh. Cách lần Reset trước $phut_chenh phút $giay_chenh giây";
    if($timestamp < $row[7] + 60) {
    $log_Des .= ". Khóa nhân vật.";
    //Block Char
    $block_query = "UPDATE Character SET ctlcode='99',ErrorSubBlock=99 WHERE name='$name'";
    $block_result = $db->Execute($block_query);
    check_queryerror($block_query, $block_result);

    // Tru 1 lan Reset
    $resetup = $resetup - 1;
    }
    //Ghi vào Log Reset nhanh
    $info_log_query = "SELECT gcoin, gcoin_km, vpoint FROM MEMB_INFO WHERE memb___id='$login'";
    $info_log_result = $db->Execute($info_log_query);
    check_queryerror($info_log_query, $info_log_result);
    $info_log = $info_log_result->fetchrow();

    $log_acc = "$login";
    $log_gcoin = $info_log[0];
    $log_gcoin_km = $info_log[1];
    $log_vpoint = $info_log[2];
    $log_price = " - ";
    $log_time = $timestamp;

    $insert_log_query = "INSERT INTO Log_TienTe (acc, gcoin, gcoin_km, vpoint, price, Des, time) VALUES ('$log_acc', $log_gcoin, $log_gcoin_km, $log_vpoint, '$log_price', '$log_Des', $log_time)";
    $insert_log_result = $db->execute($insert_log_query);
    check_queryerror($insert_log_query, $insert_log_result);
    //End Ghi vào Log Reset nhanh
    }
    // End Ghi log nhung nhan vat Reset qua nhanh




    // Reset nhan vat la Darklord
    if ($row[4] == 64 OR $row[4] == 65 OR $row[4] == 66)
    {
    $sql_reset_script="Update dbo.character set [clevel]='$clevel',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$pointup',[pointdutru]='$resetpoint',[resets]=$resetup, ResetNBB=$resetup,[strength]='$Strength',[dexterity]='$Dexterity',[vitality]='$Vitality',[energy]='$Energy',[Life]='$Life',[MaxLife]='$MaxLife',[Mana]='$Mana',[MaxMana]='$MaxMana',[MapNumber]='$MapNumber',[MapPosX]='$MapPosX',[MapPosY]='$MapPosY',[MapDir]='0',[Leadership]='$leadership',[isThuePoint]='0',[NoResetInDay]=$CountNoResetInDay,[". $fieldtopmonth ."]=". $fieldtopmonth ."+1,[Resets_Time]='$timestamp',[ResetVIP]='0',[PointThue]='0' where name='$name'";
    $sql_reset_exec = $db->Execute($sql_reset_script) or die("Lỗi Query: $sql_reset_script");


    //Nhan vat dang ki tai sinh
    if ($char_back_reged_check > 0) {
    $msquery = "Update Character_back set [Resets]=$resetup, [LevelUpPoint]='$resetpoint',[Class]='$row[4]',[Leadership]='$leadership',[Relifes]='$row[5]' where name='$name'";
    $msresults= $db->Execute($msquery);
    }
    }


    //Reset nhan vat khong phai la DarkLord
    else
    {
    $sql_reset_script="Update Character set [clevel]='$clevel',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$pointup',[pointdutru]='$resetpoint',[resets]=$resetup, ResetNBB=$resetup,[strength]='$Strength',[dexterity]='$Dexterity',[vitality]='$Vitality',[energy]='$Energy',[Life]='$Life',[MaxLife]='$MaxLife',[Mana]='$Mana',[MaxMana]='$MaxMana',[MapNumber]='$MapNumber',[MapPosX]='$MapPosX',[MapPosY]='$MapPosY',[MapDir]='$Mapdir',[Leadership]='0',[isThuePoint]='0',[NoResetInDay]=$CountNoResetInDay,[". $fieldtopmonth ."]=". $fieldtopmonth ."+1,[Resets_Time]='$timestamp',[ResetVIP]='0',[PointThue]='0' where name='$name'";
    $sql_reset_exec = $db->Execute($sql_reset_script) or die("Lỗi Query: $sql_reset_script");


    //All Quest For Class 3
    //if ($row[4] == $class_dw_3 OR $row[4] == $class_dk_3 OR $row[4] == $class_elf_3 OR $row[4] == $class_mg_2 OR $row[4] == $class_dl_2 OR $row[4] == $class_sum_3) {
    // $sql_all_quest = $db->Execute($all_quest);
    // }

    if ($char_back_reged_check > 0) {
    $msquery = "Update Character_back set [Resets]=$resetup,[LevelUpPoint]='$resetpoint',[Class]='$row[4]',[Relifes]='$row[5]' where name='$name'";
    $msresults= $db->Execute($msquery);
    }
    }


    //Reset Point Master Skill
    //include_once('MasterLV.php');


    $tru_jewel = $db->Execute("UPDATE MEMB_INFO SET jewel_chao=jewel_chao-$chao,jewel_cre=jewel_cre-$cre,jewel_blue=jewel_blue-$blue WHERE memb___id='$login'");


    //Event TOP Reset in Time
    include_once('event_toprs_intime.php');
    //Event GiftCode Reset
    include_once('sv_giftcode_rs.php');

    top50();


    if(file_exists('config/config_sendmess.php')) {
    include_once('config/config_sendmess.php');
    if($use_sendmess === true) {
    $thehe_query = "Select thehe From MEMB_INFO where memb___id='$login'";
    $thehe_result = $db->Execute($thehe_query);
    check_queryerror($thehe_query, $thehe_result);
    $thehe_fetch = $thehe_result->fetchrow();
    $thehe = $thehe_fetch[0];

    include('config/config_thehe.php');
    $thehe_name = $thehe_choise[$thehe];
    $mess_send = '['. $thehe_name. ']Chúc mừng '. $name .' Reset lần thứ '. $resetup .' ( '. $CountNoResetInDay. ' / ngày ) thành công';

    include_once('config_license.php');
    include_once('func_getContent.php');
    $getcontent_url = $url_license . "/api_sendmess_gz.php";
    $getcontent_data = array(
    'acclic' => $acclic,
    'key' => $key,

    'mess_send' => $mess_send
    );

    $reponse = _getContent($getcontent_url, $getcontent_data, $getcontent_method, $getcontent_curl);

    $info = read_TagName($reponse, 'info');
    if ($info == "OK") {
    $mess_receive = read_TagName($reponse, 'mess_receive', 0);
    $mess_total = $mess_receive[0];

    for($i=1; $i<=$mess_total; $i++) {
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    if ($x = socket_connect($socket, '127.0.0.1', $joinserver_port))
    {
    socket_write($socket, $mess_receive[$i]);
    } else {
    socket_close($socket);
    break;
    }
    socket_close($socket);
    }
    }
    }
    }


    //Ghi vào Log nhung nhan vàt Reset
    /*
    $info_log_query = "SELECT gcoin, gcoin_km, vpoint FROM MEMB_INFO WHERE memb___id='$login'";
    $info_log_result = $db->Execute($info_log_query);
    check_queryerror($info_log_query, $info_log_result);
    $info_log = $info_log_result->fetchrow();

    $log_acc = "$login";
    $log_gcoin = $info_log[0];
    $log_gcoin_km = $info_log[1];
    $log_vpoint = $info_log[2];
    $log_price = "";
    $log_Des = "";
    $log_time = $timestamp;

    $insert_log_query = "INSERT INTO Log_TienTe (acc, gcoin, gcoin_km, vpoint, price, Des, time) VALUES ('$log_acc', $log_gcoin, $log_gcoin_km, $log_vpoint, '$log_price', '$log_Des', $log_time)";
    $insert_log_result = $db->execute($insert_log_query);
    check_queryerror($insert_log_query, $insert_log_result);
    */
    $info_log_query = "SELECT gcoin, gcoin_km, vpoint FROM MEMB_INFO WHERE memb___id='$login'";
    $info_log_result = $db->Execute($info_log_query);
    check_queryerror($info_log_query, $info_log_result);
    $info_log = $info_log_result->fetchrow();

    $log_acc = "$login";
    $log_gcoin = $info_log[0];
    $log_gcoin_km = $info_log[1];
    $log_vpoint = $info_log[2];
    $log_price = " - ";
    $log_Des = "<b>$name</b> Reset lần thứ <b>$resetup</b> khi ". $row[0] ." Level/". $resetold ." Reset, Relife $relife";
    $log_time = $timestamp;

    $insert_log_query = "INSERT INTO Log_TienTe (acc, gcoin, gcoin_km, vpoint, price, Des, time) VALUES ('$log_acc', $log_gcoin, $log_gcoin_km, $log_vpoint, '$log_price', '$log_Des', $log_time)";
    $insert_log_result = $db->execute($insert_log_query);
    check_queryerror($insert_log_query, $insert_log_result);
    //End Ghi vào Log nhung nhan vàt Reset tren 0 lan


    $reponse = "<info>OK</info>
    <resetmoeny>$resetmoeny</resetmoeny>
    <resetpoint>$pointup</resetpoint>
    <pointdutru>$resetpoint</pointdutru>
    <messenge>$name Reset lần thứ $resetup thành công!";
    if($resetpoint > 0) {
    $reponse .= " Point sau khi Reset trên 65.000 Point. Bạn vào Game cộng điểm sau đó vào phần <b>Rút Point</b> để lấy Point còn lại";
    }
    $reponse .= "<br>$messenge_giftcode";
    $reponse .= "</messenge>";

    echo $reponse;
    }
    $db->Close();
    ?>
    phai cái này không bạn
    phai cái này không bạn
    Khách viếng thăm hãy cùng thaoq12 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  4. #4
    Thành Viên thaoq12's Avatar
    Ngày tham gia
    Nov 2008
    Bài viết
    219
    Thanks
    44
    Thanked 10 Times in 9 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    ai giúp mình với .....................................
    Khách viếng thăm hãy cùng thaoq12 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  5. #5
    Moderator YouTobe's Avatar
    Ngày tham gia
    Jul 2012
    Đang ở
    https://t.me*********
    Bài viết
    976
    Thanks
    520
    Thanked 470 Times in 280 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    Xóa code trên thay bằng bên dưới

    <?php include_once("security.php");
    include_once('config.php');
    include_once('config/config_reset.php');
    include_once('config/config_hotrotanthu.php');
    include_once('config/config_gioihanrs.php');
    include_once('config/config_relife.php');
    include_once('config/config_event.php');
    include_once('function.php');


    $login = $_POST['login'];
    $name = $_POST['name'];


    $resetnow = $_POST['resetnow']; $resetnow = abs(intval($resetnow));


    $passtransfer = $_POST['passtransfer'];


    if ($passtransfer == $transfercode) {


    $string_login = $_POST['string_login'];
    checklogin($login,$string_login);


    fixrs($name);
    check_resetday();
    check_resetmonth();


    $inventory_query = "SELECT CAST(Inventory AS image) FROM Character WHERE AccountID = '$login' AND Name='$name'";


    kiemtra_doinv($login,$name);
    kiemtra_online($login);


    $inventory_result_sql = $db->Execute($inventory_query);
    $inventory_result = $inventory_result_sql->fetchrow();


    $sql_PkLevel_check = $db->Execute("SELECT PkLevel FROM Character WHERE PkLevel > 3 and Name='$name'");
    $PkLevel_check = $sql_PkLevel_check->numrows();


    $sql_char_back_reged_check = $db->Execute("SELECT Name FROM Character_back WHERE Name='$name' and AccountID = '$login'");
    $char_back_reged_check = $sql_char_back_reged_check->numrows();


    $result = $db->Execute("Select Clevel,Resets,Money,LevelUpPoint,Class,Relifes,NoR esetInDay,Resets_Time, Top50 From Character where Name='$name'");
    $row = $result->fetchrow();


    if($resetnow >0 && abs(intval($row[1])) == 0) {
    echo "Hệ thống Reset bị gián đoạn. Vui lòng Reset lại";
    exit();
    }


    $vpoint_result = $db->Execute("Select vpoint From MEMB_INFO where memb___id='$login'");
    $vpoint = $vpoint_result->fetchrow();


    $check_jewel = $db->Execute("SELECT jewel_chao,jewel_cre,jewel_blue FROM MEMB_INFO WHERE memb___id='$login'");
    $jewel = $check_jewel->fetchrow();


    $thehe_result = $db->Execute("Select thehe From MEMB_INFO where memb___id='$login'");
    $thehe_fetch = $thehe_result->fetchrow();
    $thehe = $thehe_fetch[0];


    $inventory = $inventory_result[0];
    $inventory = bin2hex($inventory);
    $inventory3 = substr($inventory,76*32);
    $inventory3 = strtoupper($inventory3);


    $total_item_inventory3 = floor(strlen($inventory3)/32);


    $no_item = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
    $count_item_inventory3 = 0;


    // Tu Season 6.1 tro xuong
    if($total_item_inventory3 <= 32) {
    for ($i=0;$i<$total_item_inventory3;$i++) {
    $check_item = substr($inventory3,$i*32, 32);
    if($check_item != $no_item) {
    $count_item_inventory3++;
    }
    }
    }
    // Tu Season 6.2 tro len
    else {
    for ($i=128;$i<$total_item_inventory3;$i++) {
    $check_item = substr($inventory3,$i*32, 32);
    if($check_item != $no_item) {
    $count_item_inventory3++;
    }
    }
    }


    if ($count_item_inventory3 > 0) { echo "Cửa hàng cá nhân có vật phẩm. Vui lòng bỏ ra khỏi cửa hàng cá nhân để tránh bị mất đồ."; exit(); }


    $CountNoResetInDay=$row[6]+1;


    //Begin Giới hạn Reset trong ngày
    if($use_gioihanrs[$thehe] == 1) {
    $ResetDay = $row[6];
    $char_in_top = $row[8];

    if($char_in_top >0 && $char_in_top<=10) $gioihanrs = $gioihanrs_top10[$thehe];
    elseif($char_in_top >10 && $char_in_top<=20) $gioihanrs = $gioihanrs_top20[$thehe];
    elseif($char_in_top >20 && $char_in_top<=30) $gioihanrs = $gioihanrs_top30[$thehe];
    elseif($char_in_top >30 && $char_in_top<=40) $gioihanrs = $gioihanrs_top40[$thehe];
    elseif($char_in_top >40 && $char_in_top<=50) $gioihanrs = $gioihanrs_top50[$thehe];
    else $gioihanrs = $gioihanrs_other[$thehe];




    if( isset($gioihanrs) && $ResetDay >= $gioihanrs) {
    echo "Bạn đã Reset hết số lần Reset trong ngày. Xin vui lòng Ủy thác và đợi Reset tiếp vào ngày mai"; exit();
    }
    }
    //End Giới hạn Reset trong ngày


    if ($PkLevel_check > 0){
    echo "Bạn đang là Sát thủ. Phải rửa tội trước khi Reset."; exit();
    }


    if ( ($row[1] >= $reset_cap_0) AND ($row[1] < $reset_cap_1) )
    {
    $level = $level_cap_1;
    $zen = $zen_cap_1;
    $time_reset_next = $time_reset_next_1;
    $chao = $chao_cap_1;
    $cre = $cre_cap_1;
    $blue = $blue_cap_1;
    }
    elseif ( ($row[1] >= $reset_cap_1) AND ($row[1] < $reset_cap_2) )
    {
    $level = $level_cap_2;
    $zen = $zen_cap_2;
    $time_reset_next = $time_reset_next_2;
    $chao = $chao_cap_2;
    $cre = $cre_cap_2;
    $blue = $blue_cap_2;
    }
    elseif ( ($row[1] >= $reset_cap_2) AND ($row[1] < $reset_cap_3) )
    {
    $level = $level_cap_3;
    $zen = $zen_cap_3;
    $time_reset_next = $time_reset_next_3;
    $chao = $chao_cap_3;
    $cre = $cre_cap_3;
    $blue = $blue_cap_3;
    }
    elseif ( ($row[1] >= $reset_cap_3) AND ($row[1] < $reset_cap_4) )
    {
    $level = $level_cap_4;
    $zen = $zen_cap_4;
    $time_reset_next = $time_reset_next_4;
    $chao = $chao_cap_4;
    $cre = $cre_cap_4;
    $blue = $blue_cap_4;
    }
    elseif ( ($row[1] >= $reset_cap_4) AND ($row[1] < $reset_cap_5) )
    {
    $level = $level_cap_5;
    $zen = $zen_cap_5;
    $time_reset_next = $time_reset_next_5;
    $chao = $chao_cap_5;
    $cre = $cre_cap_5;
    $blue = $blue_cap_5;
    }
    elseif ( ($row[1] >= $reset_cap_5) AND ($row[1] < $reset_cap_6) )
    {
    $level = $level_cap_6;
    $zen = $zen_cap_6;
    $time_reset_next = $time_reset_next_6;
    $chao = $chao_cap_6;
    $cre = $cre_cap_6;
    $blue = $blue_cap_6;
    }
    elseif ( ($row[1] >= $reset_cap_6) AND ($row[1] < $reset_cap_7) )
    {
    $level = $level_cap_7;
    $zen = $zen_cap_7;
    $time_reset_next = $time_reset_next_7;
    $chao = $chao_cap_7;
    $cre = $cre_cap_7;
    $blue = $blue_cap_7;
    }
    elseif ( ($row[1] >= $reset_cap_7) AND ($row[1] < $reset_cap_8) )
    {
    $level = $level_cap_8;
    $zen = $zen_cap_8;
    $time_reset_next = $time_reset_next_8;
    $chao = $chao_cap_8;
    $cre = $cre_cap_8;
    $blue = $blue_cap_8;
    }
    elseif ( ($row[1] >= $reset_cap_8) AND ($row[1] < $reset_cap_9) )
    {
    $level = $level_cap_9;
    $zen = $zen_cap_9;
    $time_reset_next = $time_reset_next_9;
    $chao = $chao_cap_9;
    $cre = $cre_cap_9;
    $blue = $blue_cap_9;
    }
    elseif ( ($row[1] >= $reset_cap_9) AND ($row[1] < $reset_cap_10) )
    {
    $level = $level_cap_10;
    $zen = $zen_cap_10;
    $time_reset_next = $time_reset_next_10;
    $chao = $chao_cap_10;
    $cre = $cre_cap_10;
    $blue = $blue_cap_10;
    }
    elseif ( ($row[1] >= $reset_cap_10) AND ($row[1] < $reset_cap_11) )
    {
    $level = $level_cap_11;
    $zen = $zen_cap_11;
    $time_reset_next = $time_reset_next_11;
    $chao = $chao_cap_11;
    $cre = $cre_cap_11;
    $blue = $blue_cap_11;
    }
    elseif ( ($row[1] >= $reset_cap_11) AND ($row[1] < $reset_cap_12) )
    {
    $level = $level_cap_12;
    $zen = $zen_cap_12;
    $time_reset_next = $time_reset_next_12;
    $chao = $chao_cap_12;
    $cre = $cre_cap_12;
    $blue = $blue_cap_12;
    }
    elseif ( ($row[1] >= $reset_cap_12) AND ($row[1] < $reset_cap_13) )
    {
    $level = $level_cap_13;
    $zen = $zen_cap_13;
    $time_reset_next = $time_reset_next_13;
    $chao = $chao_cap_13;
    $cre = $cre_cap_13;
    $blue = $blue_cap_13;
    }
    elseif ( ($row[1] >= $reset_cap_13) AND ($row[1] < $reset_cap_14) )
    {
    $level = $level_cap_14;
    $zen = $zen_cap_14;
    $time_reset_next = $time_reset_next_14;
    $chao = $chao_cap_14;
    $cre = $cre_cap_14;
    $blue = $blue_cap_14;
    }
    elseif ( ($row[1] >= $reset_cap_14) AND ($row[1] < $reset_cap_15) )
    {
    $level = $level_cap_15;
    $zen = $zen_cap_15;
    $time_reset_next = $time_reset_next_15;
    $chao = $chao_cap_15;
    $cre = $cre_cap_15;
    $blue = $blue_cap_15;
    }
    elseif ( ($row[1] >= $reset_cap_15) AND ($row[1] < $reset_cap_16) )
    {
    $level = $level_cap_16;
    $zen = $zen_cap_16;
    $time_reset_next = $time_reset_next_16;
    $chao = $chao_cap_16;
    $cre = $cre_cap_16;
    $blue = $blue_cap_16;
    }
    elseif ( ($row[1] >= $reset_cap_16) AND ($row[1] < $reset_cap_17) )
    {
    $level = $level_cap_17;
    $zen = $zen_cap_17;
    $time_reset_next = $time_reset_next_17;
    $chao = $chao_cap_17;
    $cre = $cre_cap_17;
    $blue = $blue_cap_17;
    }
    elseif ( ($row[1] >= $reset_cap_17) AND ($row[1] < $reset_cap_18) )
    {
    $level = $level_cap_18;
    $zen = $zen_cap_18;
    $time_reset_next = $time_reset_next_18;
    $chao = $chao_cap_18;
    $cre = $cre_cap_18;
    $blue = $blue_cap_18;
    }
    elseif ( ($row[1] >= $reset_cap_18) AND ($row[1] < $reset_cap_19) )
    {
    $level = $level_cap_19;
    $zen = $zen_cap_19;
    $time_reset_next = $time_reset_next_19;
    $chao = $chao_cap_19;
    $cre = $cre_cap_19;
    $blue = $blue_cap_19;
    }
    elseif ( ($row[1] >= $reset_cap_19) AND ($row[1] < $reset_cap_20) )
    {
    $level = $level_cap_20;
    $zen = $zen_cap_20;
    $time_reset_next = $time_reset_next_20;
    $chao = $chao_cap_20;
    $cre = $cre_cap_20;
    $blue = $blue_cap_20;
    }


    //Begin hỗ trợ tân thủ
    if ($hotrotanthu == 1) {
    $Resetnow = $row[1];
    $Relifenow = $row[5];

    if( ($capsudung >= 1) && ($cap1_reset_min<=$Resetnow && $Resetnow<=$cap1_reset_max) && ($cap1_relife_min<=$Relifenow && $Relifenow<=$cap1_relife_max) ) {
    $level = $level - $cap1_levelgiam;
    }
    elseif( ($capsudung >= 2) && ($cap2_reset_min<=$Resetnow && $Resetnow<=$cap2_reset_max) && ($cap2_relife_min<=$Relifenow && $Relifenow<=$cap2_relife_max) ) {
    $level = $level - $cap2_levelgiam;
    }
    elseif( ($capsudung >= 3) && ($cap3_reset_min<=$Resetnow && $Resetnow<=$cap3_reset_max) && ($cap3_relife_min<=$Relifenow && $Relifenow<=$cap3_relife_max) ) {
    $level = $level - $cap3_levelgiam;
    }
    elseif( ($capsudung >= 4) && ($cap4_reset_min<=$Resetnow && $Resetnow<=$cap4_reset_max) && ($cap4_relife_min<=$Relifenow && $Relifenow<=$cap4_relife_max) ) {
    $level = $level - $cap4_levelgiam;
    }
    elseif( ($capsudung >= 5) && ($cap5_reset_min<=$Resetnow && $Resetnow<=$cap5_reset_max) && ($cap5_relife_min<=$Relifenow && $Relifenow<=$cap5_relife_max) ) {
    $level = $level - $cap5_levelgiam;
    }


    }
    //End hỗ trợ tân thủ




    switch ($row[5]) {
    case 0:
    $reset_relifes = $rl_reset_relife1;
    $point_relifes = 0;
    $ml_relifes = 0;
    break;
    case 1:
    $reset_relifes = $rl_reset_relife2;
    $point_relifes = $rl_point_relife1;
    $ml_relifes = $rl_ml_relife1;
    break;
    case 2:
    $reset_relifes = $rl_reset_relife3;
    $point_relifes = $rl_point_relife2;
    $ml_relifes = $rl_ml_relife2;
    break;
    case 3:
    $reset_relifes = $rl_reset_relife4;
    $point_relifes = $rl_point_relife3;
    $ml_relifes = $rl_ml_relife3;
    break;
    case 4:
    $reset_relifes = $rl_reset_relife5;
    $point_relifes = $rl_point_relife4;
    $ml_relifes = $rl_ml_relife4;
    break;
    case 5:
    $reset_relifes = $rl_reset_relife6;
    $point_relifes = $rl_point_relife5;
    $ml_relifes = $rl_ml_relife5;
    break;
    case 6:
    $reset_relifes = $rl_reset_relife7;
    $point_relifes = $rl_point_relife6;
    $ml_relifes = $rl_ml_relife6;
    break;
    case 7;
    $reset_relifes = $rl_reset_relife8;
    $point_relifes = $rl_point_relife7;
    $ml_relifes = $rl_ml_relife7;
    break;
    case 8:
    $reset_relifes = $rl_reset_relife9;
    $point_relifes = $rl_point_relife8;
    $ml_relifes = $rl_ml_relife8;
    break;
    case 9:
    $reset_relifes = $rl_reset_relife10;
    $point_relifes = $rl_point_relife9;
    $ml_relifes = $rl_ml_relife9;
    break;
    case 10:
    $reset_relifes = $rl_reset_relife11;
    $point_relifes = $rl_point_relife10;
    $ml_relifes = $rl_ml_relife10;
    break;
    }


    if ( $row[1] >= $reset_relifes ) {
    echo "$name đang ReLife: $row[5] - Reset: $row[1]. Để Reset tiếp bạn cần phải ReLife."; exit();
    }


    $relife = $row[5];
    $resetold = $row[1]; $resetold = abs(intval($resetold));
    $resetup = $resetold + 1;




    //Cong thuc Reset
    if ( ($jewel[0] < $chao) OR ($jewel[1] < $cre) OR ($jewel[2] < $blue) )
    {
    echo "Bạn không đủ Jewel trong ngân hàng.<br>Số lần Reset hiện tại của bạn là $row[1]. Bạn cần $chao Chao , $cre Creation , $blue Blue Feather."; exit();
    }
    if ($row[0] < $level) {echo "$name cần $level level để Reset lần $resetup."; exit();}
    if ($row[2] < $zen) {echo "$name cần $zen Zen để Reset lần $resetup."; exit();}


    $time_reset_next = $row[7]+$time_reset_next*60;
    if ($time_reset_next > $timestamp) {
    $time_free = $time_reset_next - $timestamp;
    echo "$name cần $time_free giây nữa để Reset lần tiếp theo."; exit();
    }


    //Reset lần 1
    if ($row[1] == $reset_cap_0)
    {
    $resetpoint=$point_relifes+$point_cap_1;
    $resetmoeny = $row[2] - $zen_cap_1;
    $leadership = $ml_relifes+$ml_cap_1;
    }
    //Reset cấp 1
    elseif ($row[1] < $reset_cap_1)
    {
    $resetpoint=$point_relifes+$point_cap_1+$row[1]*$point_cap_1;
    $resetmoeny = $row[2] - $zen_cap_1;
    $leadership = $ml_relifes+$ml_relifes+$ml_cap_1+$row[1]*$ml_cap_1;
    }
    //Reset cấp 1 -> 2
    elseif ($row[1] >= $reset_cap_1 AND $row[1] < $reset_cap_2)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($row[1]-($reset_cap_1-1))*$point_cap_2;
    $resetmoeny = $row[2] - $zen_cap_2;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $row[1]-($reset_cap_1-1))*$ml_cap_2;
    }
    //Reset cấp 2 -> 3
    elseif ($row[1] >= $reset_cap_2 AND $row[1] < $reset_cap_3)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($row[1]-($reset_cap_2-1))*$point_cap_3;
    $resetmoeny = $row[2] - $zen_cap_3;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($row[1]-($reset_cap_2-1))*$ml_cap_3;
    }
    //Reset cấp 3 -> 4
    elseif ($row[1] >= $reset_cap_3 AND $row[1] < $reset_cap_4)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($row[1]-($reset_cap_3-1))*$point_cap_4;
    $resetmoeny = $row[2] - $zen_cap_4;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($row[1]-($reset_cap_3-1))*$ml_cap_4;
    }
    //Reset cấp 4 -> 5
    elseif ($row[1] >= $reset_cap_4 AND $row[1] < $reset_cap_5)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($row[1]-($reset_cap_4-1))*$point_cap_5;
    $resetmoeny = $row[2] - $zen_cap_5;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($row[1]-($reset_cap_4-1))*$ml_cap_5;
    }
    //Reset cấp 5 -> 6
    elseif ($row[1] >= $reset_cap_5 AND $row[1] < $reset_cap_6)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($row[1]-($reset_cap_5-1))*$point_cap_6;
    $resetmoeny = $row[2] - $zen_cap_6;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($row[1]-($reset_cap_5-1))*$ml_cap_6;
    }
    //Reset cấp 6 -> 7
    elseif ($row[1] >= $reset_cap_6 AND $row[1] < $reset_cap_7)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($row[1]-($reset_cap_6-1))*$point_cap_7;
    $resetmoeny = $row[2] - $zen_cap_7;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($row[1]-($reset_cap_6-1))*$ml_cap_7;
    }
    //Reset cấp 7 -> 8
    elseif ($row[1] >= $reset_cap_7 AND $row[1] < $reset_cap_8)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($row[1]-($reset_cap_7-1))*$point_cap_8;
    $resetmoeny = $row[2] - $zen_cap_8;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($row[1]-($reset_cap_7-1))*$ml_cap_8;
    }
    //Reset cấp 8 -> 9
    elseif ($row[1] >= $reset_cap_8 AND $row[1] < $reset_cap_9)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($row[1]-($reset_cap_8-1))*$point_cap_9;
    $resetmoeny = $row[2] - $zen_cap_9;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($row[1]-($reset_cap_8-1))*$ml_cap_9;
    }
    //Reset cấp 9 -> 10
    elseif ($row[1] >= $reset_cap_9 AND $row[1] < $reset_cap_10)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($row[1]-($reset_cap_9-1))*$point_cap_10;
    $resetmoeny = $row[2] - $zen_cap_10;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($row[1]-($reset_cap_9-1))*$ml_cap_10;
    }
    //Reset cấp 10 -> 11
    elseif ($row[1] >= $reset_cap_10 AND $row[1] < $reset_cap_11)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($row[1]-($reset_cap_10-1))*$point_cap_11;
    $resetmoeny = $row[2] - $zen_cap_11;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($row[1]-($reset_cap_10-1))*$ml_cap_11;
    }
    //Reset cấp 11 -> 12
    elseif ($row[1] >= $reset_cap_11 AND $row[1] < $reset_cap_12)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($row[1]-($reset_cap_11-1))*$point_cap_12;
    $resetmoeny = $row[2] - $zen_cap_12;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($row[1]-($reset_cap_11-1))*$ml_cap_12;
    }
    //Reset cấp 12 -> 13
    elseif ($row[1] >= $reset_cap_12 AND $row[1] < $reset_cap_13)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($row[1]-($reset_cap_12-1))*$point_cap_13;
    $resetmoeny = $row[2] - $zen_cap_13;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($row[1]-($reset_cap_12-1))*$ml_cap_13;
    }
    //Reset cấp 13 -> 14
    elseif ($row[1] >= $reset_cap_13 AND $row[1] < $reset_cap_14)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($row[1]-($reset_cap_13-1))*$point_cap_14;
    $resetmoeny = $row[2] - $zen_cap_14;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($row[1]-($reset_cap_13-1))*$ml_cap_14;
    }
    //Reset cấp 14 -> 15
    elseif ($row[1] >= $reset_cap_14 AND $row[1] < $reset_cap_15)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($row[1]-($reset_cap_14-1))*$point_cap_15;
    $resetmoeny = $row[2] - $zen_cap_15;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($row[1]-($reset_cap_14-1))*$ml_cap_15;
    }
    //Reset cấp 15 -> 16
    elseif ($row[1] >= $reset_cap_15 AND $row[1] < $reset_cap_16)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($row[1]-($reset_cap_15-1))*$point_cap_16;
    $resetmoeny = $row[2] - $zen_cap_16;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($row[1]-($reset_cap_15-1))*$ml_cap_16;
    }
    //Reset cấp 16 -> 17
    elseif ($row[1] >= $reset_cap_16 AND $row[1] < $reset_cap_17)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($row[1]-($reset_cap_16-1))*$point_cap_17;
    $resetmoeny = $row[2] - $zen_cap_17;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($row[1]-($reset_cap_16-1))*$ml_cap_17;
    }
    //Reset cấp 17 -> 18
    elseif ($row[1] >= $reset_cap_17 AND $row[1] < $reset_cap_18)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($point_cap_17*($reset_cap_17-$reset_cap_16))+($row[1]-($reset_cap_17-1))*$point_cap_18;
    $resetmoeny = $row[2] - $zen_cap_18;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($ml_cap_17*($reset_cap_17-$reset_cap_16))+($row[1]-($reset_cap_17-1))*$ml_cap_18;
    }
    //Reset cấp 18 -> 19
    elseif ($row[1] >= $reset_cap_18 AND $row[1] < $reset_cap_19)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($point_cap_17*($reset_cap_17-$reset_cap_16))+($point_cap_18*($reset_cap_18-$reset_cap_17))+($row[1]-($reset_cap_18-1))*$point_cap_19;
    $resetmoeny = $row[2] - $zen_cap_19;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($ml_cap_17*($reset_cap_17-$reset_cap_16))+($ml_cap_18*($reset_cap_18-$reset_cap_17))+($row[1]-($reset_cap_18-1))*$ml_cap_19;
    }
    //Reset cấp 19 -> 20
    elseif ($row[1] >= $reset_cap_19 AND $row[1] < $reset_cap_20)
    {
    $resetpoint=$point_relifes+($point_cap_1*$reset_ca p_1)+($point_cap_2*($reset_cap_2-$reset_cap_1))+($point_cap_3*($reset_cap_3-$reset_cap_2))+($point_cap_4*($reset_cap_4-$reset_cap_3))+($point_cap_5*($reset_cap_5-$reset_cap_4))+($point_cap_6*($reset_cap_6-$reset_cap_5))+($point_cap_7*($reset_cap_7-$reset_cap_6))+($point_cap_8*($reset_cap_8-$reset_cap_7))+($point_cap_9*($reset_cap_9-$reset_cap_8))+($point_cap_10*($reset_cap_10-$reset_cap_9))+($point_cap_11*($reset_cap_11-$reset_cap_10))+($point_cap_12*($reset_cap_12-$reset_cap_11))+($point_cap_13*($reset_cap_13-$reset_cap_12))+($point_cap_14*($reset_cap_14-$reset_cap_13))+($point_cap_15*($reset_cap_15-$reset_cap_14))+($point_cap_16*($reset_cap_16-$reset_cap_15))+($point_cap_17*($reset_cap_17-$reset_cap_16))+($point_cap_18*($reset_cap_18-$reset_cap_17))+($point_cap_19*($reset_cap_19-$reset_cap_18))+($row[1]-($reset_cap_19-1))*$point_cap_20;
    $resetmoeny = $row[2] - $zen_cap_20;
    $leadership=$ml_relifes+($ml_cap_1*$reset_cap_1)+( $ml_cap_2*($reset_cap_2-$reset_cap_1))+($ml_cap_3*($reset_cap_3-$reset_cap_2))+($ml_cap_4*($reset_cap_4-$reset_cap_3))+($ml_cap_5*($reset_cap_5-$reset_cap_4))+($ml_cap_6*($reset_cap_6-$reset_cap_5))+($ml_cap_7*($reset_cap_7-$reset_cap_6))+($ml_cap_8*($reset_cap_8-$reset_cap_7))+($ml_cap_9*($reset_cap_9-$reset_cap_8))+($ml_cap_10*($reset_cap_10-$reset_cap_9))+($ml_cap_11*($reset_cap_11-$reset_cap_10))+($ml_cap_12*($reset_cap_12-$reset_cap_11))+($ml_cap_13*($reset_cap_13-$reset_cap_12))+($ml_cap_14*($reset_cap_14-$reset_cap_13))+($ml_cap_15*($reset_cap_15-$reset_cap_14))+($ml_cap_16*($reset_cap_16-$reset_cap_15))+($ml_cap_17*($reset_cap_17-$reset_cap_16))+($ml_cap_18*($reset_cap_18-$reset_cap_17))+($ml_cap_19*($reset_cap_19-$reset_cap_18))+($row[1]-($reset_cap_19-1))*$ml_cap_20;
    }
    //Fix Menh lenh DarkLord > 32k
    if ( $leadership>32000 ) $leadership=32000;




    $ClassType = $row[4];
    switch ($ClassType){
    case 0:
    case 1:
    case 2:
    case 3:
    $Class_Default = 0;
    break;

    case 16:
    case 17:
    case 18:
    case 19:
    $Class_Default = 16;
    break;

    case 32:
    case 33:
    case 34:
    case 35:
    $Class_Default = 32;
    break;

    case 48:
    case 49:
    case 50:
    $Class_Default = 48;
    break;

    case 64:
    case 65:
    case 66:
    $Class_Default = 64;
    break;

    case 80:
    case 81:
    case 82:
    case 83:
    $Class_Default = 80;
    break;

    case 96:
    case 97:
    case 98:
    $Class_Default = 96;
    break;

    default :
    $Class_Default = 0;
    }
    $default_query = "SELECT Strength, Dexterity, Vitality, Energy, Life, MaxLife, Mana, MaxMana, MapNumber, MapPosX, MapPosY FROM DefaultClassType WHERE Class=" . $Class_Default;
    $default_result = $db->execute($default_query);
    check_queryerror($default_query, $default_result);
    $point_default = $default_result->fetchrow();
    $Strength_Default = $point_default[0];
    $Dexterity_Default = $point_default[1];
    $Vitality_Default = $point_default[2];
    $Energy_Default = $point_default[3];
    $Life_Default = $point_default[4];
    $MaxLife_Default = $point_default[5];
    $Mana_Default = $point_default[6];
    $MaxMana_Default = $point_default[7];
    $MapNumber_Default = abs(intval($point_default[8]));
    $MapPosX_Default = abs(intval($point_default[9]));
    $MapPosY_Default = abs(intval($point_default[10]));


    $Strength = $Strength_Default;
    $Dexterity = $Dexterity_Default;
    $Vitality = $Vitality_Default;
    $Energy = $Energy_Default;
    $Life = $Life_Default;
    $MaxLife = $MaxLife_Default;
    $Mana = $Mana_Default;
    $MaxMana = $MaxMana_Default;
    $MapNumber = $MapNumber_Default;
    $MapPosX = $MapPosX_Default;
    $MapPosY = $MapPosY_Default;
    $Mapdir=0;


    $Point_Default_total = $Strength + $Dexterity + $Vitality + $Energy;


    //End Cong thuc Reset


    //Tat ca cac Quest
    $all_quest="Update character set Quest=0xaaeaffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffff ffffff where name='$name'";
    if( intval($level_after_reset) >1 ) $clevel = $level_after_reset;
    else $clevel = 1;


    $point_event_qr = $db->Execute("SELECT point_event FROM Character WHERE Name='$name'");
    $point_event = $point_event_qr->fetchrow();
    $resetpoint = $resetpoint + $point_event[0];


    if( $resetpoint > 65000) {
    $pointup = 65000;
    $resetpoint = $resetpoint - 65000;
    } else {
    $pointup = $resetpoint;
    $resetpoint = 0;
    }


    switch ($month)
    {
    case '01' : $fieldtopmonth = 'TopMonth01'; break;
    case '02' : $fieldtopmonth = 'TopMonth02'; break;
    case '03' : $fieldtopmonth = 'TopMonth03'; break;
    case '04' : $fieldtopmonth = 'TopMonth04'; break;
    case '05' : $fieldtopmonth = 'TopMonth05'; break;
    case '06' : $fieldtopmonth = 'TopMonth06'; break;
    case '07' : $fieldtopmonth = 'TopMonth07'; break;
    case '08' : $fieldtopmonth = 'TopMonth08'; break;
    case '09' : $fieldtopmonth = 'TopMonth09'; break;
    case '10' : $fieldtopmonth = 'TopMonth10'; break;
    case '11' : $fieldtopmonth = 'TopMonth11'; break;
    case '12' : $fieldtopmonth = 'TopMonth12'; break;
    default : $fieldtopmonth = 'TopMonth01';
    }


    kiemtra_doinv($login,$name);
    kiemtra_online($login);


    // Ghi log nhung nhan vat Reset qua nhanh
    if($timestamp < $row[7] + 300) {
    $time_chenh = $timestamp - $row[7];
    $phut_chenh = floor($time_chenh/60);
    $giay_chenh = $time_chenh%60;
    $log_Des = "$name Reset lần thứ $resetup quá nhanh. Cách lần Reset trước $phut_chenh phút $giay_chenh giây";
    if($timestamp < $row[7] + 60) {
    $log_Des .= ". Khóa nhân vật.";
    //Block Char
    $block_query = "UPDATE Character SET ctlcode='99',ErrorSubBlock=99 WHERE name='$name'";
    $block_result = $db->Execute($block_query);
    check_queryerror($block_query, $block_result);

    // Tru 1 lan Reset
    $resetup = $resetup - 1;
    }
    //Ghi vào Log Reset nhanh
    $info_log_query = "SELECT gcoin, gcoin_km, vpoint FROM MEMB_INFO WHERE memb___id='$login'";
    $info_log_result = $db->Execute($info_log_query);
    check_queryerror($info_log_query, $info_log_result);
    $info_log = $info_log_result->fetchrow();

    $log_acc = "$login";
    $log_gcoin = $info_log[0];
    $log_gcoin_km = $info_log[1];
    $log_vpoint = $info_log[2];
    $log_price = " - ";
    $log_time = $timestamp;

    $insert_log_query = "INSERT INTO Log_TienTe (acc, gcoin, gcoin_km, vpoint, price, Des, time) VALUES ('$log_acc', $log_gcoin, $log_gcoin_km, $log_vpoint, '$log_price', '$log_Des', $log_time)";
    $insert_log_result = $db->execute($insert_log_query);
    check_queryerror($insert_log_query, $insert_log_result);
    //End Ghi vào Log Reset nhanh
    }
    // End Ghi log nhung nhan vat Reset qua nhanh




    // Reset nhan vat la Darklord
    if ($row[4] == 64 OR $row[4] == 65 OR $row[4] == 66)
    {
    $sql_reset_script="Update dbo.character set [clevel]='$clevel',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$pointup',[pointdutru]='$resetpoint',[resets]=$resetup, ResetNBB=$resetup,[strength]='$Strength',[dexterity]='$Dexterity',[vitality]='$Vitality',[energy]='1000',[Life]='$Life',[MaxLife]='$MaxLife',[Mana]='$Mana',[MaxMana]='$MaxMana',[MapNumber]='$MapNumber',[MapPosX]='$MapPosX',[MapPosY]='$MapPosY',[MapDir]='0',[Leadership]='$leadership',[isThuePoint]='0',[NoResetInDay]=$CountNoResetInDay,[". $fieldtopmonth ."]=". $fieldtopmonth ."+1,[Resets_Time]='$timestamp',[ResetVIP]='0',[PointThue]='0' where name='$name'";
    $sql_reset_exec = $db->Execute($sql_reset_script) or die("Lỗi Query: $sql_reset_script");


    //Nhan vat dang ki tai sinh
    if ($char_back_reged_check > 0) {
    $msquery = "Update Character_back set [Resets]=$resetup, [LevelUpPoint]='$resetpoint',[Class]='$row[4]',[Leadership]='$leadership',[Relifes]='$row[5]' where name='$name'";
    $msresults= $db->Execute($msquery);
    }
    }


    //Reset nhan vat khong phai la DarkLord
    else
    {
    $sql_reset_script="Update Character set [clevel]='$clevel',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$pointup',[pointdutru]='$resetpoint',[resets]=$resetup, ResetNBB=$resetup,[strength]='$Strength',[dexterity]='$Dexterity',[vitality]='$Vitality',[energy]='1000',[Life]='$Life',[MaxLife]='$MaxLife',[Mana]='$Mana',[MaxMana]='$MaxMana',[MapNumber]='$MapNumber',[MapPosX]='$MapPosX',[MapPosY]='$MapPosY',[MapDir]='$Mapdir',[Leadership]='0',[isThuePoint]='0',[NoResetInDay]=$CountNoResetInDay,[". $fieldtopmonth ."]=". $fieldtopmonth ."+1,[Resets_Time]='$timestamp',[ResetVIP]='0',[PointThue]='0' where name='$name'";
    $sql_reset_exec = $db->Execute($sql_reset_script) or die("Lỗi Query: $sql_reset_script");


    //All Quest For Class 3
    //if ($row[4] == $class_dw_3 OR $row[4] == $class_dk_3 OR $row[4] == $class_elf_3 OR $row[4] == $class_mg_2 OR $row[4] == $class_dl_2 OR $row[4] == $class_sum_3) {
    // $sql_all_quest = $db->Execute($all_quest);
    // }

    if ($char_back_reged_check > 0) {
    $msquery = "Update Character_back set [Resets]=$resetup,[LevelUpPoint]='$resetpoint',[Class]='$row[4]',[Relifes]='$row[5]' where name='$name'";
    $msresults= $db->Execute($msquery);
    }
    }


    //Reset Point Master Skill
    //include_once('MasterLV.php');


    $tru_jewel = $db->Execute("UPDATE MEMB_INFO SET jewel_chao=jewel_chao-$chao,jewel_cre=jewel_cre-$cre,jewel_blue=jewel_blue-$blue WHERE memb___id='$login'");


    //Event TOP Reset in Time
    include_once('event_toprs_intime.php');
    //Event GiftCode Reset
    include_once('sv_giftcode_rs.php');

    top50();


    if(file_exists('config/config_sendmess.php')) {
    include_once('config/config_sendmess.php');
    if($use_sendmess === true) {
    $thehe_query = "Select thehe From MEMB_INFO where memb___id='$login'";
    $thehe_result = $db->Execute($thehe_query);
    check_queryerror($thehe_query, $thehe_result);
    $thehe_fetch = $thehe_result->fetchrow();
    $thehe = $thehe_fetch[0];

    include('config/config_thehe.php');
    $thehe_name = $thehe_choise[$thehe];
    $mess_send = '['. $thehe_name. ']Chúc mừng '. $name .' Reset lần thứ '. $resetup .' ( '. $CountNoResetInDay. ' / ngày ) thành công';

    include_once('config_license.php');
    include_once('func_getContent.php');
    $getcontent_url = $url_license . "/api_sendmess_gz.php";
    $getcontent_data = array(
    'acclic' => $acclic,
    'key' => $key,

    'mess_send' => $mess_send
    );

    $reponse = _getContent($getcontent_url, $getcontent_data, $getcontent_method, $getcontent_curl);

    $info = read_TagName($reponse, 'info');
    if ($info == "OK") {
    $mess_receive = read_TagName($reponse, 'mess_receive', 0);
    $mess_total = $mess_receive[0];

    for($i=1; $i<=$mess_total; $i++) {
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    if ($x = socket_connect($socket, '127.0.0.1', $joinserver_port))
    {
    socket_write($socket, $mess_receive[$i]);
    } else {
    socket_close($socket);
    break;
    }
    socket_close($socket);
    }
    }
    }
    }


    //Ghi vào Log nhung nhan vàt Reset
    /*
    $info_log_query = "SELECT gcoin, gcoin_km, vpoint FROM MEMB_INFO WHERE memb___id='$login'";
    $info_log_result = $db->Execute($info_log_query);
    check_queryerror($info_log_query, $info_log_result);
    $info_log = $info_log_result->fetchrow();

    $log_acc = "$login";
    $log_gcoin = $info_log[0];
    $log_gcoin_km = $info_log[1];
    $log_vpoint = $info_log[2];
    $log_price = "";
    $log_Des = "";
    $log_time = $timestamp;

    $insert_log_query = "INSERT INTO Log_TienTe (acc, gcoin, gcoin_km, vpoint, price, Des, time) VALUES ('$log_acc', $log_gcoin, $log_gcoin_km, $log_vpoint, '$log_price', '$log_Des', $log_time)";
    $insert_log_result = $db->execute($insert_log_query);
    check_queryerror($insert_log_query, $insert_log_result);
    */
    $info_log_query = "SELECT gcoin, gcoin_km, vpoint FROM MEMB_INFO WHERE memb___id='$login'";
    $info_log_result = $db->Execute($info_log_query);
    check_queryerror($info_log_query, $info_log_result);
    $info_log = $info_log_result->fetchrow();

    $log_acc = "$login";
    $log_gcoin = $info_log[0];
    $log_gcoin_km = $info_log[1];
    $log_vpoint = $info_log[2];
    $log_price = " - ";
    $log_Des = "<b>$name</b> Reset lần thứ <b>$resetup</b> khi ". $row[0] ." Level/". $resetold ." Reset, Relife $relife";
    $log_time = $timestamp;

    $insert_log_query = "INSERT INTO Log_TienTe (acc, gcoin, gcoin_km, vpoint, price, Des, time) VALUES ('$log_acc', $log_gcoin, $log_gcoin_km, $log_vpoint, '$log_price', '$log_Des', $log_time)";
    $insert_log_result = $db->execute($insert_log_query);
    check_queryerror($insert_log_query, $insert_log_result);
    //End Ghi vào Log nhung nhan vàt Reset tren 0 lan


    $reponse = "<info>OK</info>
    <resetmoeny>$resetmoeny</resetmoeny>
    <resetpoint>$pointup</resetpoint>
    <pointdutru>$resetpoint</pointdutru>
    <messenge>$name Reset lần thứ $resetup thành công!";
    if($resetpoint > 0) {
    $reponse .= " Point sau khi Reset trên 65.000 Point. Bạn vào Game cộng điểm sau đó vào phần <b>Rút Point</b> để lấy Point còn lại";
    }
    $reponse .= "<br>$messenge_giftcode";
    $reponse .= "</messenge>";

    echo $reponse;
    }
    $db->Close();
    ?>
    Khách viếng thăm hãy cùng YouTobe xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  6. Các thành viên gởi lời cảm ơn đến YouTobe vì bài viết này !

    thaoq12 (02-07-16)

  7. #6
    Thành Viên thaoq12's Avatar
    Ngày tham gia
    Nov 2008
    Bài viết
    219
    Thanks
    44
    Thanked 10 Times in 9 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    bị lỗi dòng 455 rồi bạn ơi hình như bạn xóa mấy dòng rồi thì phải
    Khách viếng thăm hãy cùng thaoq12 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  8. #7
    Moderator YouTobe's Avatar
    Ngày tham gia
    Jul 2012
    Đang ở
    https://t.me*********
    Bài viết
    976
    Thanks
    520
    Thanked 470 Times in 280 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    Reset song là mất nhiệm vụ 220 ?
    Có chắc bị lỗi hay là bạn cần phải có level 220 mới sử dụng được chiêu thức đó ?
    Hay là đang Hiệp sĩ reset xong nó về Chiến binh ? ( ví dụ class DK ) ?
    Bạn nói rõ chút xem. Theo mình nghĩ là bạn vừa reset xong nên thiếu điều kiện bên trên chứ không phải bị lỗi.
    Khách viếng thăm hãy cùng YouTobe xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  9. Các thành viên gởi lời cảm ơn đến YouTobe vì bài viết này !

    thaoq12 (02-07-16)

  10. #8
    Thành Viên
    Ngày tham gia
    Feb 2014
    Bài viết
    341
    Thanks
    135
    Thanked 68 Times in 47 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    Về nguyên tắc khi reset xong phải làm lại nv 220 khi đủ level chẳng hạn như combo của dk, skill của elf.
    Nếu như dk mà rs xog vẫn còn combo thì nó bá chủ Cc.
    Còn bạn muốn reset xog mà lv 1 có skill 220 của dk với elf thì k bàn tới nữa.
    Còn dw thì reset vẫn sử dụng được mưa băng tuyết với rút độc.
    Lần sửa cuối bởi hoaitam1990, ngày 02-07-16 lúc 09:41 AM.
    Khách viếng thăm hãy cùng hoaitam1990 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  11. #9
    Thành Viên thaoq12's Avatar
    Ngày tham gia
    Nov 2008
    Bài viết
    219
    Thanks
    44
    Thanked 10 Times in 9 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    Trích dẫn Gửi bởi YouTobe [Only registered and activated users can see links. ]
    Reset song là mất nhiệm vụ 220 ?
    Có chắc bị lỗi hay là bạn cần phải có level 220 mới sử dụng được chiêu thức đó ?
    Hay là đang Hiệp sĩ reset xong nó về Chiến binh ? ( ví dụ class DK ) ?
    Bạn nói rõ chút xem. Theo mình nghĩ là bạn vừa reset xong nên thiếu điều kiện bên trên chứ không phải bị lỗi.
    mình muốn là sau khi reset không phải làm lại nv 220,
    Khách viếng thăm hãy cùng thaoq12 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  12. #10
    Vi phạm quy định bimaloha's Avatar
    Ngày tham gia
    May 2012
    Đang ở
    localhost
    Bài viết
    441
    Thanks
    26
    Thanked 388 Times in 173 Posts

    Ðề: giúp mình reset không mất nhiệm vụ 220

    Code:
    //Tat ca cac Quest
    $all_quest="Update character set Quest=0xaaeaffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffff ffffff where name='$name'";
    if( intval($level_after_reset) >1 ) $clevel = $level_after_reset;
    else $clevel = 1;
    Kiểm tra lại xem quest này là nhiệm vụ nào nhé
    Khách viếng thăm hãy cùng bimaloha xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

 

 

Các Chủ đề tương tự

  1. MU 2000 Server Hay Nhiều Event Mới 2000x Drop 80% Reset Giữ Điểm Free 100%
    Bởi kendynhock trong diễn đàn CÁC SERVER GAME PRIVATE ONLINE
    Trả lời: 0
    Bài viết cuối: 17-08-14, 11:58 PM
  2. MU 2000x Drop 80% Reset Giữ Điểm Nhiều Event Hay Miễn Phí Cho Anh Em
    Bởi kendynhock trong diễn đàn CÁC SERVER GAME PRIVATE ONLINE
    Trả lời: 0
    Bài viết cuối: 16-08-14, 12:57 PM
  3. [MU] Cần Hướng dẫn config chuẩn cho server reset bằng lệnh /reset
    Bởi MUNew trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 6
    Bài viết cuối: 01-05-14, 08:34 PM
  4. [MU] Xin PRO hướng dẫn CODE giới hạn reset theo số lần reset !
    Bởi remesouth trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 2
    Bài viết cuối: 20-03-13, 09:49 PM
  5. Hỏi số reset của member đột nhiên mất
    Bởi Newbie.Farm trong diễn đàn Hỏi Đáp/ Yêu Cầu
    Trả lời: 17
    Bài viết cuối: 24-06-11, 06:38 PM

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •  
Múi giờ GMT +7. Bây giờ là 03:42 PM.
vBulletin®, Copyright ©2000-2011, Jelsoft Enterprises Ltd.
CLBGamesVN không chịu trách nhiệm về Luật Bản Quyền của các tài liệu, bài viết v.v...được đăng tải trên diễn đàn này.
Diễn đàn phát triển dưới sự đóng góp của tất cả thành viên. BQT chỉ là những người thành lập ra sân chơi, quản lý và duy trì về mặt kỹ thuật, nội dung khi hợp lệ.