второе оружие, двуручное, шиты

orionet

Новичок
Репутация
0 / 32
Мож каму понадобится второе оружие, двуручное, шиты

Мечи=двуручное оружие
Ножи, Кастеты=второе оружие+1 блок
Шиты=+1 блок

Примим во внимание удары и блоки

Код:
$weapons = array('axe','fail','knife','sword','spear','shot','castet');
$shield  = array('shield','knife','castet');

$hand_r_s = mysql_query("SELECT object_type FROM inv WHERE id='".$db["hand_r"]."'");
$hand_r_d = mysql_fetch_array($hand_r_s);
$hand_r_type = $hand_r_d["object_type"];

$hand_l_s = mysql_query("SELECT object_type FROM inv WHERE id='".$db["hand_l"]."'");
$hand_l_d = mysql_fetch_array($hand_l_s);
$hand_l_type = $hand_l_d["object_type"];

$hand_r_weapon = false;
$hand_l_weapon = false;
$hand_l_weapon2= false;
$two_hands     = false;
$two_shield    = false;

        for($i=0;$i<count($weapons);$i++){
        if($hand_r_type == $weapons[$i]){
         $hand_r_weapon = true;
        }
        if($hand_l_type == $weapons[$i]){
         $hand_l_weapon = true;
        }
    }
    for($i=0;$i<count($shield);$i++){
        if($hand_l_type == $shield[$i]){
         $hand_l_weapon2 = true;
        }
    }    
    if($hand_r_weapon == true && $hand_l_weapon == true ){
     $two_hands = true;
    }
    if($hand_l_weapon2 == true ){
     $two_shield = true;
    }
?>


[img]img/line2.gif[/img]
<FORM NAME="battle" ACTION="battle.php?act=hit" METHOD="POST">
<?
/*if($db["level"]<6){

?>
<center>[img]img/magic.gif[/img]</center>


<?
  }*/
?>
<table border=0 cellpadding=0 cellspacing=0 width=375>
  <tr>

<td align=center bgcolor=#f2f0f0>[b]Атака[/b]</td>
<td align=center bgcolor=#f2f0f0>[b]Защита[/b]</td>
</tr>
<tr>
<?
if(!$two_hands){
?>
<td>
<INPUT TYPE=radio NAME="hit" VALUE="1" ID=A1>[B]<LABEL FOR=A1>удар в голову</LABEL>

<INPUT TYPE=radio NAME="hit" VALUE="2" ID=A2><LABEL FOR=A2>удар в грудь</LABEL>

<INPUT TYPE=radio NAME="hit" VALUE="3" ID=A3><LABEL FOR=A3>удар в живот</LABEL>

<INPUT TYPE=radio NAME="hit" VALUE="4" ID=A4><LABEL FOR=A4>удар в пояс</LABEL>

<INPUT TYPE=radio NAME="hit" VALUE="5" ID=A5><LABEL FOR=A5>удар по ногам</LABEL>
[/B]
</td>
<?
}else{
?>
<td>
<INPUT TYPE=radio NAME="udar" VALUE="1" ID=b1><INPUT TYPE=radio NAME="udar2" VALUE="1" ID=A1>[B]<LABEL FOR=A1>удар в голову</LABEL>

<INPUT TYPE=radio NAME="udar" VALUE="2" ID=b2><INPUT TYPE=radio NAME="udar2" VALUE="2" ID=A2><LABEL FOR=A2>удар в грудь</LABEL>

<INPUT TYPE=radio NAME="udar" VALUE="3" ID=b3><INPUT TYPE=radio NAME="udar2" VALUE="3" ID=A3><LABEL FOR=A3>удар в живот</LABEL>

<INPUT TYPE=radio NAME="udar" VALUE="4" ID=b4><INPUT TYPE=radio NAME="udar2" VALUE="4" ID=A4><LABEL FOR=A4>удар в пояс</LABEL>

<INPUT TYPE=radio NAME="udar" VALUE="5" ID=b5><INPUT TYPE=radio NAME="udar2" VALUE="5" ID=A5><LABEL FOR=A5>удар по ногам</LABEL>
[/B]
</td>
<?
}
if(!$two_shield){
?>
<td>
<INPUT TYPE=radio NAME="blok" VALUE="1" ID=D1>[B]<LABEL FOR=D1>головы и груди</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="2" ID=D2><LABEL FOR=D2>груди и живота</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="3" ID=D3><LABEL FOR=D3>живота и пояса</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="4" ID=D4><LABEL FOR=D4>пояса и ног</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="5" ID=D5><LABEL FOR=D5>ног и головы</LABEL>[/B]
</td>
<?}else{?>
<td>
<INPUT TYPE=radio NAME="blok" VALUE="1" ID=D1>[B]<LABEL FOR=D1>головы, груди и живота</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="2" ID=D2><LABEL FOR=D2>груди, живота и пояса</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="3" ID=D3><LABEL FOR=D3>живота, пояса и ног</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="4" ID=D4><LABEL FOR=D4>пояса, ног и головы</LABEL>

<INPUT TYPE=radio NAME="blok" VALUE="5" ID=D5><LABEL FOR=D5>ног, головы и груди</LABEL>[/B]
<?}?>

Примим во внимание блоки +1 в battle.php

Код:
if($act == "hit"){
$i = 0;
$p1_set = 0;
$p2_set = 0;
$p3_set = 0;

$weapons = array('axe','fail','knife','sword','spear','shot','castet');
$shield  = array('shield','knife','castet');

$hand_r_s = mysql_query("SELECT object_type FROM inv WHERE id='".$db["hand_r"]."'");
$hand_r_d = mysql_fetch_array($hand_r_s);
$hand_r_type = $hand_r_d["object_type"];

$hand_l_s = mysql_query("SELECT object_type FROM inv WHERE id='".$db["hand_l"]."'");
$hand_l_d = mysql_fetch_array($hand_l_s);
$hand_l_type = $hand_l_d["object_type"];

$hand_r_weapon = false;
$hand_l_weapon = false;
$hand_l_weapon2= false;
$two_hands     = false;
$two_shield    = false;

    for($n=0;$n<count($weapons);$n++){
         if($hand_r_type == $weapons[$n]){
         $hand_r_weapon = true;
        }
        if($hand_l_type == $weapons[$n]){
         $hand_l_weapon = true;
        }        
    }
    for($n=0;$n<count($shield);$n++){
        if($hand_l_type == $shield[$n]){
        $hand_l_weapon2 = true;
        }
    }    
    if($hand_r_weapon == true && $hand_l_weapon == true){
     $two_hands = true;
    }
    if($hand_l_weapon2 == true ){
     $two_shield = true;
    }
    
if($blok==1){$D1=1;}
if($blok==2){$D2=2;}
if($blok==3){$D3=3;}
if($blok==4){$D4=4;}
if($blok==5){$D5=5;}
    
    if(!empty($D1)){
    $i++;
        $point1 = 1;
        $p1_set = 1;
        $p2_set = 0;
        $p3_set = 0;
        if($p1_set == 0){
        $point1 = 1;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=1){
        $point2 = 1;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 2;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=2){
        $point2 = 2;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 3;
        $p1_set = 1;
        }
        if($p3_set == 0 && $point1!=3){
        $point3 = 3;
        $p2_set = 1;
        }
    }
    if(!empty($D2)){
    $i++;
        if($p1_set == 0){
        $point1 = 2;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=2){
        $point2 = 2;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 3;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=3){
        $point2 = 3;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 4;
        $p1_set = 1;
        }
        if($p3_set == 0 && $point1!=4){
        $point3 = 4;
        $p2_set = 1;
        }        
    }
    if(!empty($D3)){
    $i++;
    if($p1_set == 0){
        $point1 = 3;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=3){
        $point2 = 3;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 4;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=4){
        $point2 = 4;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 5;
        $p1_set = 1;
        }
        if($p3_set == 0 && $point1!=5){
        $point3 = 5;
        $p2_set = 1;
        }        
    }
    if(!empty($D4)){
    $i++;
        if($p1_set == 0){
        $point1 = 4;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=4){
        $point2 = 4;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 5;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=5){
        $point2 = 5;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 1;
        $p1_set = 1;
        }
        if($p3_set == 0 && $point1!=1){
        $point3 = 1;
        $p2_set = 1;
        }
    }
    if(!empty($D5)){
    $i++;
        if($p1_set == 0){
        $point1 = 5;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=5){
        $point2 = 5;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 1;
        $p1_set = 1;
        }
        if($p2_set == 0 && $point1!=1){
        $point2 = 1;
        $p2_set = 1;
        }
        if($p1_set == 0){
        $point1 = 2;
        $p1_set = 1;
        }
        if($p3_set == 0 && $point1!=2){
        $point3 = 2;
        $p2_set = 1;
        }
    }

    if($i>1){
      print "<center>[b]<font color=red>Вы выбрали слишком много($i) зон блока! Надо выбрать одну!</font>[/b]</center>";
    }
    if($i==0){
      print "<center>[b]<font color=red>Вы не выбрали блок!</font>[/b]</center>";
    }
    else if(!$two_hands && !$two_shield){
    if($i==1 && !empty($hit)){
      hit($hozyain,$opponent,$hit,0,$point1,$point2,0);
    }else if($i==1 && empty($hit) && !$two_hands && !$two_shield){
     print "<center>[b]<font color=red>Вы не выбрали удар!</font>[/b]</center>";
    }}
    else if(!$two_hands && $two_shield){
    if($i==1 && !empty($hit)){
      hit($hozyain,$opponent,$hit,0,$point1,$point2,$point3);
    }else
    if($i==1 && empty($hit) && !$two_hands && $two_shield){
     print "<center>[b]<font color=red>Вы не выбрали удар!</font>[/b]</center>";
    }}
    else if($two_hands){
      if(empty($udar) or empty($udar2)){
      print "<center>[b]<font color=red>Надо выбрать две точки удара!</font>[/b]</center>";
    }
    else{
      if (!ereg("^[0-5]+$",$udar) or !ereg("^[0-5]+$",$udar2)) {print "?!"; exit();}
      hit($hozyain,$opponent,$udar,$udar2,$point1,$point2,$point3);
    }}
}

Расчитываем 3 блок в function.php

Код:
function hit($attack,$defend,$hit1,$hit2,$block1,$block2,$block3){
$chas = date("H");
$bot = 0;

$ATTACK_QUERY = mysql_query("SELECT battle,hand_r,hand_l FROM users WHERE login='$attack'");
$ATTACK_DATA  = mysql_fetch_array($ATTACK_QUERY);

$battle_id = $ATTACK_DATA["battle"];

$weapons = array('axe','fail','knife','sword','spear','shot','castet');
$shield  = array('shield','knife','castet');

$hand_r_s = mysql_query("SELECT object_type FROM inv WHERE id='".$ATTACK_DATA["hand_r"]."'");
$hand_r_d = mysql_fetch_array($hand_r_s);
$hand_r_type = $hand_r_d["object_type"];

$hand_l_s = mysql_query("SELECT object_type FROM inv WHERE id='".$ATTACK_DATA["hand_l"]."'");
$hand_l_d = mysql_fetch_array($hand_l_s);
$hand_l_type = $hand_l_d["object_type"];

$hand_r_weapon = false;
$hand_l_weapon = false;
$hand_l_weapon2= false;
$two_hands     = false;
$two_shield    = false;

        for($n=0;$n<count($weapons);$n++){
             if($hand_r_type == $weapons[$n]){
             $hand_r_weapon = true;
             }
             if($hand_l_type == $weapons[$n]){
             $hand_l_weapon = true;
             }
        }
        for($n=0;$n<count($shield);$n++){
        if($hand_l_type == $shield[$n]){
        $hand_l_weapon2 = true;
        }
        }

        if($hand_r_weapon == true && $hand_l_weapon == true){
         $two_hands = true;
        }
        if($hand_l_weapon2 == true ){
        $two_shield = true;
        }

$BOT_SEEK = mysql_query("SELECT bot_name,prototype,team FROM bot_temp WHERE battle_id='$battle_id'");
    while($BOTD = mysql_fetch_array($BOT_SEEK)){
        if($defend == $BOTD["bot_name"]){
        $bot = 1;
        $prototype = $BOTD["prototype"];
        $bot_team = $BOTD["team"];
        }
    }


$S_H = mysql_query("SELECT def_hit1,def_hit2,def_block1,def_block2,def_block3 FROM hit_temp WHERE attack='$attack' AND defend='$defend'");

$temp_exists = 0;
while($SHD = mysql_fetch_array($S_H)){$temp_exists = 1;}



        if($temp_exists == 0){
    if($bot == 0){
        $H_T = mysql_query("INSERT INTO hit_temp(attack,defend,def_hit1,def_hit2,def_block1,def_block2,def_block3) VALUES('$defend','$attack','$hit1','$hit2','$block1','$block2','$block3')");
    }
    else{
    $H_T = mysql_query("INSERT INTO hit_temp(attack,defend,def_hit1,def_hit2,def_block1,def_block2,def_block3) VALUES('$attack','$defend','$hit1','$hit2','$block1','$block2','$block3')");
    }
          $Q = mysql_query("UPDATE users SET battle_opponent='' WHERE login='$attack'");
    $_SESSION["battle_ref"] = 0;
           print "<script>location.href='battle.php'</script>";

    $U_U = mysql_query("UPDATE users SET battle_opponent='$attack' WHERE login='$defend'");
    }else if($bot == 0){
        $S_H = mysql_query("SELECT def_hit1,def_hit2,def_block1,def_block2,def_block3 FROM hit_temp WHERE attack='$attack' AND defend='$defend'");


               $SHD = mysql_fetch_array($S_H);
               $def_hit1 = $SHD["def_hit1"];
               $def_hit2 = $SHD["def_hit2"];
               $def_block1 = $SHD["def_block1"];
               $def_block2 = $SHD["def_block2"];
               $def_block3 = $SHD["def_block3"];
              

        /*======расчет блока==========================*/
        if($hit1 == $def_block1 || $hit1 == $def_block2 || $hit1 == $def_block3){
        $def_blocked = 1;
        }
        else{
        $def_blocked = 0;
        }

        if($hit2 == $def_block1 || $hit2 == $def_block2 || $hit2 == $def_block3){
        $def_blocked2 = 1;
        }
        else{
        $def_blocked2 = 0;
        }

        if($def_hit1 == $block1 || $def_hit1 == $block2 || $def_hit1 == $block3){
        $att_blocked = 1;
        }
        else{
        $att_blocked = 0;
        }
        /*============================================*/


    if($bot == 0){
    $ATT_QUERY = mysql_query("SELECT hp FROM users WHERE login='$defend'");
    $ATT_DATA = mysql_fetch_array($ATT_QUERY);
if($ATT_DATA["hp"]>0){
     hit_dis($attack,$defend,0,$def_blocked,$hit1,0);
}
        if($two_hands){
if($ATT_DATA["hp"]>0){
         hit_dis($attack,$defend,0,$def_blocked2,$hit2,1);
}
        }
    $ATT_QUERY = mysql_query("SELECT hp FROM users WHERE login='$defend'");
    $ATT_DATA = mysql_fetch_array($ATT_QUERY);
if($ATT_DATA["hp"]>0){
     hit_dis($defend,$attack,0,$att_blocked,$def_hit1,0);
}
    }

    $SSS = mysql_query("DELETE FROM hit_temp WHERE attack='$attack' AND defend='$defend'");

    print "<script>location.href='battle.php'</script>";
    die();
    }



if($bot == 1){
//        $S_H = mysql_query("SELECT * FROM hit_temp WHERE attack='$attack' AND defend='$defend'");

               if($bot == 1){
               $def_hit1 = rand(1,5);
               $def_hit2 = rand(1,5);
               $def_block1 = rand(1,5);
               $def_block2 = rand(1,5);
               $def_block3 = rand(1,5);
               $Q = mysql_query("UPDATE users SET battle_opponent='' WHERE login='$attack'");
               }

        /*======расчет блока==========================*/
        if($hit1 == $def_block1 || $hit1 == $def_block2 || $hit1 == $def_block3){
        $def_blocked = 1;
        }
        else{
        $def_blocked = 0;
        }

        if($hit2 == $def_block1 || $hit2 == $def_block2 || $hit2 == $def_block3){
        $def_blocked2 = 1;
        }
        else{
        $def_blocked2 = 0;
        }

        if($def_hit1 == $block1 || $def_hit1 == $block2 || $def_hit1 == $block3){
        $att_blocked = 1;
        }
        else{
        $att_blocked = 0;
        }
        /*============================================*/


 if($bot == 1){
    $DEF_QUERY = mysql_query("SELECT hp FROM bot_temp WHERE bot_name='$defend' AND battle_id='$battle_id'");
    $DEF_DATA = mysql_fetch_array($DEF_QUERY);

        if($DEF_DATA["hp"]>0){
         hit_dis($attack,$defend,1,$def_blocked,$hit1,0);
        }
        if($two_hands){
           if($DEF_DATA["hp"]>0){
            hit_dis($attack,$defend,1,$def_blocked2,hit2,1);
           }
        }
    $DEF_QUERY = mysql_query("SELECT hp FROM bot_temp WHERE bot_name='$defend' AND battle_id='$battle_id'");
    $DEF_DATA = mysql_fetch_array($DEF_QUERY);
if($DEF_DATA["hp"]>0){
    hit_dis($defend,$attack,2,$att_blocked,$def_hit1,0);
}
    }

    $SSS = mysql_query("DELETE FROM hit_temp WHERE attack='$attack' AND defend='$defend'");

    print "<script>location.href='battle.php'</script>";
    die();
}
}

Добавляем в hit_temp def_block3 аналогично def_block2 или def_block1

Доделываем wiar , unwear , unwear_full

Код:
/*======================С Н Я Т Ь================================*/
function unWear($who,$itm){
$user_query=mysql_query("SELECT * FROM users WHERE login='$who'");
$db=mysql_fetch_array($user_query);

if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$razdel)) {print "?!"; exit();}
$act=htmlspecialchars($act);
$razdel=htmlspecialchars($razdel);
$inv_query=mysql_query("SELECT object_type,object_id FROM inv WHERE owner='$who' AND id=$itm");
$inv_data=mysql_fetch_array($inv_query);

$i_type=$inv_data["object_type"];
$item_id=$inv_data["object_id"];

$item_query=mysql_query("SELECT * FROM $i_type WHERE id=$item_id");
$item_data=mysql_fetch_array($item_query);

        if($i_type == "castet" || $i_type=="sword" || $i_type=="axe" || $i_type=="fail" || $i_type=="knife" || $i_type=="spear" || $i_type=="shield"){
                if($db["hand_r"] == $itm){$slot = "hand_r";}
                if($db["hand_l"] == $itm){$slot = "hand_l";}
        }
        else if($i_type=="ring"){
                if($db["ring1"]==$itm){
                $slot="ring1";
                }
                else if($db["ring2"]==$itm){
                $slot="ring2";
                }
                else if($db["ring3"]==$itm){
                $slot="ring3";
                }
        }
        else{
        $slot=$i_type;
        }

$slot_v=$db["$slot"];

if($slot_v==$itm){

$new_sila=$db["sila"]-$item_data["add_sila"];
$new_lovkost=$db["lovkost"]-$item_data["add_lovkost"];
$new_udacha=$db["udacha"]-$item_data["add_udacha"];
$new_hp=$db["hp_all"]-$item_data["add_hp"];
$new_intellekt=$db["intellekt"]-$item_data["add_intellekt"];
$new_mana=$db["mana_all"]-$item_data["add_mana"];
$new_phead=$db["bron_head"]-$item_data["protect_head"];
$new_pcorp=$db["bron_corp"]-$item_data["protect_corp"];
$new_ppoyas=$db["bron_poyas"]-$item_data["protect_poyas"];
$new_plegs=$db["bron_legs"]-$item_data["protect_legs"];
$new_mfkrit=$db["mf_krit"]-$item_data["mf_krit"];
$new_mfantikrit=$db["mf_antikrit"]-$item_data["mf_antikrit"];
$new_mfuvorot=$db["mf_uvorot"]-$item_data["mf_uvorot"];
$new_mfantiuvorot=$db["mf_antiuvorot"]-$item_data["mf_antiuvorot"];
$new_wpmin_h=$item_data["min_attack"];
$new_wpmax_h=$item_data["max_attack"];
if($slot=="hand_l"){
$new_wpmin=$db["hand_l_hitmin"]-$item_data["min_attack"];
$new_wpmax=$db["hand_l_hitmax"]-$item_data["max_attack"];
$new_mfkrit_h=$db["hand_l_krit"]-$item_data["mf_krit"];
$new_mfantikrit_h=$db["hand_l_antikrit"]-$item_data["mf_antikrit"];
$new_mfuvorot_h=$db["hand_l_uvorot"]-$item_data["mf_uvorot"];
$new_mfantiuvorot_h=$db["hand_l_antiuvorot"]-$item_data["mf_antiuvorot"];
}
else if($slot=="hand_r"){
$new_wpmin=$db["hand_r_hitmin"]-$item_data["min_attack"];
$new_wpmax=$db["hand_r_hitmax"]-$item_data["max_attack"];
$new_mfkrit_h=$db["hand_r_krit"]-$item_data["mf_krit"];
$new_mfantikrit_h=$db["hand_r_antikrit"]-$item_data["mf_antikrit"];
$new_mfuvorot_h=$db["hand_r_uvorot"]-$item_data["mf_uvorot"];
$new_mfantiuvorot_h=$db["hand_r_antiuvorot"]-$item_data["mf_antiuvorot"];
}
$new_swordvl=$db["sword_vl"]-$item_data["sword_vl"];
$new_axevl=$db["axe_vl"]-$item_data["axe_vl"];
$new_failvl=$db["hummer_vl"]-$item_data["fail_vl"];
$new_knifevl=$db["castet_vl"]-$item_data["knife_vl"];
$new_spearvl=$db["copie_vl"]-$item_data["spear_vl"];
$new_shotvl=$db["shot_vl"]-$item_data["shot_vl"];
$new_cost=$db["cost"]-$item_data["price"];
$new_mass=$db["mass"]-$item_data["mass"];
$new_arm_l=$db["no_armour"]-$item_data["add_arm_l"];
$new_arm_m=$db["light_armour"]-$item_data["add_arm_m"];
$new_arm_h=$db["heavy_armour"]-$item_data["add_arm_h"];
$new_fire=$db["fire_magic"]-$item_data["add_fire"];
$new_water=$db["water_magic"]-$item_data["add_water"];
$new_air=$db["air_magic"]-$item_data["add_air"];
$new_earth=$db["earth_magic"]-$item_data["add_earth"];
$new_cast=$db["cast"]-$item_data["add_cast"];
$new_trade=$db["trade"]-$item_data["add_trade"];
$new_cure=$db["cure"]-$item_data["add_cure"];
$new_walk=$db["walk"]-$item_data["add_walk"];
$new_velocity=$db["maxmass"]-$item_data["add_velocity"];
$new_parm=$db["bron_arm"]-$item_data["bron_arm"];
$all=$db["hp_all"]-$item_data["add_hp"];
$hp=$db["hp"];
if($all>$hp){
$hp2=$hp;
}
else{
$hp2=$all;
}
setHP($who,$hp2,$all);

$n_query=mysql_query("UPDATE inv SET wear='0' WHERE id=$itm");

if($n_query){

$new_sql ="UPDATE users SET sila='$new_sila',lovkost='$new_lovkost',udacha='$new_udacha',hp_all='$new_hp',";
$new_sql.="intellekt='$new_intellekt',mana_all='$new_mana',bron_head='$new_phead',bron_corp='$new_pcorp',";
$new_sql.="bron_poyas='$new_ppoyas',bron_legs='$new_plegs',bron_arm='$new_parm',maxmass='$new_velocity',";
$new_sql.="cost='$new_cost',$slot='0',sword_vl='$new_swordvl',axe_vl='$new_axevl',hummer_vl='$new_failvl',shot_vl='$new_shotvl',";
if($slot == "hand_r"){
$new_sql.="hand_r_krit='$new_mfkrit_h',hand_r_antikrit='$new_mfantikrit_h',hand_r_uvorot='$new_mfuvorot_h',hand_r_antiuvorot='$new_mfantiuvorot_h',hand_r_hitmin='$new_wpmin',hand_r_hitmax='$new_wpmax',";
}
else if($slot == "hand_l"){
$new_sql.="hand_l_krit='$new_mfkrit_h',hand_l_antikrit='$new_mfantikrit_h',hand_l_uvorot='$new_mfuvorot_h',hand_l_antiuvorot='$new_mfantiuvorot_h',hand_l_hitmin='$new_wpmin',hand_l_hitmax='$new_wpmax',";
}
else{
$new_sql.="mf_krit='$new_mfkrit',mf_antikrit='$new_mfantikrit',mf_uvorot='$new_mfuvorot',mf_antiuvorot='$new_mfantiuvorot',";
}
$new_sql.="castet_vl='$new_knifevl',copie_vl='$new_spearvl',mass='$new_mass',no_armour='$new_arm_l',";
$new_sql.="light_armour='$new_arm_m',heavy_armour='$new_arm_h',fire_magic='$new_fire',water_magic='$new_water',";
$new_sql.="air_magic='$new_air',earth_magic='$new_earth',cast='$new_cast',trade='$new_trade',cure='$new_cure',walk='$new_walk'";
$new_sql.=" WHERE login='$who'";
$new_query=mysql_query($new_sql);

}

$hands = 1;

        if($db["hand_r"] != 0 && $db["hand_l"] == 0 && $db["hand_l_free"] == 0){$hands = 2;}
        if($hands == 2){
                if($slot=="hand_r"){$n2q=mysql_query("UPDATE users SET hand_r_type='phisic',hand_r_free='1',hand_l_free='1' WHERE login='$who'");}
                if($slot=="hand_l"){$n2q=mysql_query("UPDATE users SET hand_l_type='phisic',hand_l_free='1',hand_r_free='1' WHERE login='$who'");}
        }
        else{
                if($slot=="hand_r"){$n2q=mysql_query("UPDATE users SET hand_r_type='phisic',hand_r_free='1' WHERE login='$who'");}
                if($slot=="hand_l"){$n2q=mysql_query("UPDATE users SET hand_l_type='phisic',hand_l_free='1' WHERE login='$who'");}
        }
}
print "<script>location.href='main.php?act=inv&razdel=obj';</script>";
die();
}
/*==========================*/
function unWear_all($who,$itm){
$user_query=mysql_query("SELECT * FROM users WHERE login='$who'");
$db=mysql_fetch_array($user_query);

if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$razdel)) {print "?!"; exit();}
$act=htmlspecialchars($act);
$razdel=htmlspecialchars($razdel);
$inv_query=mysql_query("SELECT object_type,object_id FROM inv WHERE owner='$who' AND id=$itm");
$inv_data=mysql_fetch_array($inv_query);

$i_type=$inv_data["object_type"];
$item_id=$inv_data["object_id"];

$item_query=mysql_query("SELECT * FROM $i_type WHERE id=$item_id");
$item_data=mysql_fetch_array($item_query);

        if($i_type == "castet" || $i_type=="sword" || $i_type=="axe" || $i_type=="fail" || $i_type=="knife" || $i_type=="spear" || $i_type=="shield"){
                if($db["hand_r"] == $itm){$slot = "hand_r";}
                if($db["hand_l"] == $itm){$slot = "hand_l";}
        }
        else if($i_type=="ring"){
                if($db["ring1"]==$itm){
                $slot="ring1";
                }
                else if($db["ring2"]==$itm){
                $slot="ring2";
                }
                else if($db["ring3"]==$itm){
                $slot="ring3";
                }
        }
        else{
        $slot=$i_type;
        }

$slot_v=$db["$slot"];

if($slot_v==$itm){

$new_sila=$db["sila"]-$item_data["add_sila"];
$new_lovkost=$db["lovkost"]-$item_data["add_lovkost"];
$new_udacha=$db["udacha"]-$item_data["add_udacha"];
$new_hp=$db["hp_all"]-$item_data["add_hp"];
$new_intellekt=$db["intellekt"]-$item_data["add_intellekt"];
$new_mana=$db["mana_all"]-$item_data["add_mana"];
$new_phead=$db["bron_head"]-$item_data["protect_head"];
$new_pcorp=$db["bron_corp"]-$item_data["protect_corp"];
$new_ppoyas=$db["bron_poyas"]-$item_data["protect_poyas"];
$new_plegs=$db["bron_legs"]-$item_data["protect_legs"];
$new_mfkrit=$db["mf_krit"]-$item_data["mf_krit"];
$new_mfantikrit=$db["mf_antikrit"]-$item_data["mf_antikrit"];
$new_mfuvorot=$db["mf_uvorot"]-$item_data["mf_uvorot"];
$new_mfantiuvorot=$db["mf_antiuvorot"]-$item_data["mf_antiuvorot"];
$new_wpmin_h=$item_data["min_attack"];
$new_wpmax_h=$item_data["max_attack"];
if($slot=="hand_l"){
$new_wpmin=$db["hand_l_hitmin"]-$item_data["min_attack"];
$new_wpmax=$db["hand_l_hitmax"]-$item_data["max_attack"];
$new_mfkrit_h=$db["hand_l_krit"]-$item_data["mf_krit"];
$new_mfantikrit_h=$db["hand_l_antikrit"]-$item_data["mf_antikrit"];
$new_mfuvorot_h=$db["hand_l_uvorot"]-$item_data["mf_uvorot"];
$new_mfantiuvorot_h=$db["hand_l_antiuvorot"]-$item_data["mf_antiuvorot"];
}
else if($slot=="hand_r"){
$new_wpmin=$db["hand_r_hitmin"]-$item_data["min_attack"];
$new_wpmax=$db["hand_r_hitmax"]-$item_data["max_attack"];
$new_mfkrit_h=$db["hand_r_krit"]-$item_data["mf_krit"];
$new_mfantikrit_h=$db["hand_r_antikrit"]-$item_data["mf_antikrit"];
$new_mfuvorot_h=$db["hand_r_uvorot"]-$item_data["mf_uvorot"];
$new_mfantiuvorot_h=$db["hand_r_antiuvorot"]-$item_data["mf_antiuvorot"];
}
$new_swordvl=$db["sword_vl"]-$item_data["sword_vl"];
$new_axevl=$db["axe_vl"]-$item_data["axe_vl"];
$new_failvl=$db["hummer_vl"]-$item_data["fail_vl"];
$new_knifevl=$db["castet_vl"]-$item_data["knife_vl"];
$new_spearvl=$db["copie_vl"]-$item_data["spear_vl"];
$new_shotvl=$db["shot_vl"]-$item_data["shot_vl"];
$new_cost=$db["cost"]-$item_data["price"];
$new_mass=$db["mass"]-$item_data["mass"];
$new_arm_l=$db["no_armour"]-$item_data["add_arm_l"];
$new_arm_m=$db["light_armour"]-$item_data["add_arm_m"];
$new_arm_h=$db["heavy_armour"]-$item_data["add_arm_h"];
$new_fire=$db["fire_magic"]-$item_data["add_fire"];
$new_water=$db["water_magic"]-$item_data["add_water"];
$new_air=$db["air_magic"]-$item_data["add_air"];
$new_earth=$db["earth_magic"]-$item_data["add_earth"];
$new_cast=$db["cast"]-$item_data["add_cast"];
$new_trade=$db["trade"]-$item_data["add_trade"];
$new_cure=$db["cure"]-$item_data["add_cure"];
$new_walk=$db["walk"]-$item_data["add_walk"];
$new_velocity=$db["maxmass"]-$item_data["add_velocity"];
$new_parm=$db["bron_arm"]-$item_data["bron_arm"];
$all=$db["hp_all"]-$item_data["add_hp"];
$hp=$db["hp"];
if($all>$hp){
$hp2=$hp;
}
else{
$hp2=$all;
}
setHP($who,$hp2,$all);

$n_query=mysql_query("UPDATE inv SET wear='0' WHERE id=$itm");

if($n_query){

$new_sql ="UPDATE users SET sila='$new_sila',lovkost='$new_lovkost',udacha='$new_udacha',hp_all='$new_hp',";
$new_sql.="intellekt='$new_intellekt',mana_all='$new_mana',bron_head='$new_phead',bron_corp='$new_pcorp',";
$new_sql.="bron_poyas='$new_ppoyas',bron_legs='$new_plegs',bron_arm='$new_parm',maxmass='$new_velocity',";
$new_sql.="cost='$new_cost',$slot='0',sword_vl='$new_swordvl',axe_vl='$new_axevl',hummer_vl='$new_failvl',shot_vl='$new_shotvl',";
if($slot == "hand_r"){
$new_sql.="hand_r_krit='$new_mfkrit_h',hand_r_antikrit='$new_mfantikrit_h',hand_r_uvorot='$new_mfuvorot_h',hand_r_antiuvorot='$new_mfantiuvorot_h',hand_r_hitmin='$new_wpmin',hand_r_hitmax='$new_wpmax',";
}
else if($slot == "hand_l"){
$new_sql.="hand_l_krit='$new_mfkrit_h',hand_l_antikrit='$new_mfantikrit_h',hand_l_uvorot='$new_mfuvorot_h',hand_l_antiuvorot='$new_mfantiuvorot_h',hand_l_hitmin='$new_wpmin',hand_l_hitmax='$new_wpmax',";
}
else{
$new_sql.="mf_krit='$new_mfkrit',mf_antikrit='$new_mfantikrit',mf_uvorot='$new_mfuvorot',mf_antiuvorot='$new_mfantiuvorot',";
}
$new_sql.="castet_vl='$new_knifevl',copie_vl='$new_spearvl',mass='$new_mass',no_armour='$new_arm_l',";
$new_sql.="light_armour='$new_arm_m',heavy_armour='$new_arm_h',fire_magic='$new_fire',water_magic='$new_water',";
$new_sql.="air_magic='$new_air',earth_magic='$new_earth',cast='$new_cast',trade='$new_trade',cure='$new_cure',walk='$new_walk'";
$new_sql.=" WHERE login='$who'";
$new_query=mysql_query($new_sql);

}

$hands = 1;

        if($db["hand_r"] != 0 && $db["hand_l"] == 0 && $db["hand_l_free"] == 0){$hands = 2;}
        if($hands == 2){
                if($slot=="hand_r"){$n2q=mysql_query("UPDATE users SET hand_r_type='phisic',hand_r_free='1',hand_l_free='1' WHERE login='$who'");}
                if($slot=="hand_l"){$n2q=mysql_query("UPDATE users SET hand_l_type='phisic',hand_l_free='1',hand_r_free='1' WHERE login='$who'");}
        }
        else{
                if($slot=="hand_r"){$n2q=mysql_query("UPDATE users SET hand_r_type='phisic',hand_r_free='1' WHERE login='$who'");}
                if($slot=="hand_l"){$n2q=mysql_query("UPDATE users SET hand_l_type='phisic',hand_l_free='1' WHERE login='$who'");}
        }
}

}
/*===========================О Д Е Т Ь=========================*/
function wear($who,$itm){
$user_query = mysql_query("SELECT * FROM users WHERE login='$who'");
$db = mysql_fetch_array($user_query);

if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$razdel)) {print "?!"; exit();}
$act=htmlspecialchars($act);
$razdel=htmlspecialchars($razdel);
$inv_query = mysql_query("SELECT object_type,object_id FROM inv WHERE owner='$who' AND id=$itm");
$inv_data = mysql_fetch_array($inv_query);

$i_type = $inv_data["object_type"];/*тип предмета*/
$item_id = $inv_data["object_id"];

$item_query = mysql_query("SELECT * FROM $i_type WHERE id=$item_id");
$item_data = mysql_fetch_array($item_query);            

$sila=$db["sila"];
$lovkost=$db["lovkost"];
$udacha=$db["udacha"];
$power=$db["power"];
$intellekt=$db["intellekt"];
$vospriyatie=$db["vospriyatie"];
$level=$db["level"];
$align=$db["orden"];
$sex=$db["sex"];

$wearable = 0;
$hands = 1;

$min_sila=$item_data["min_sila"];
$min_lovkost=$item_data["min_lovkost"];
$min_udacha=$item_data["min_udacha"];
$min_power=$item_data["min_power"];
$min_intellekt=$item_data["min_intellekt"];
$min_vospriyatie=$item_data["min_vospriyatie"];
$min_level=$item_data["min_level"];
$req_align = $item_data["orden"];
$req_sex = $item_data["sex"];


$slot_v = $db["$slot"];

if($sila>=$min_sila && $lovkost>=$min_lovkost && $udacha>=$min_udacha && $power>=$min_power && $intellekt>=$min_intellekt && $vospriyatie>=$min_vospriyatie && $level>=$min_level && $slot_v==0){
        $wearable=1;
        }
if($item_data["type"]=="two_hand"){
if($sila>=$min_sila && $lovkost>=$min_lovkost && $udacha>=$min_udacha && $power>=$min_power && $intellekt>=$min_intellekt && $vospriyatie>=$min_vospriyatie && $level>=$min_level && $slot_v==0){
                $wearable = 1;
                $hands = 2;
                if($db["hand_l_free"] == 0){
                unwear($who,$db["hand_l"]);
                wear($who,$itm);
                die();
                }
                }
                else{$wearable = 0;
                }
        }        
if($i_type == "castet" || $i_type == "sword" || $i_type == "axe" || $i_type == "fail" || $i_type == "spear" || $i_type == "knife" || $item_data["type"]=="sek_hand" || $item_data["type"]=="two_hand"){                
if($db["hand_r_free"] == 1){$slot = "hand_r";}
else
if($item_data["type"]=="sek_hand" && $db["hand_l_free"] == 1){$slot = "hand_l";}
else{
unwear($who,$db["hand_r"]);
wear($who,$itm);
die();
}
                if($hands == 2){
                        if($db["hand_r_free"] == 1){
                        $slot = "hand_r";
                        }
                        else if($db["hand_l_free"] == 0){
                        unwear($who,$db["hand_l"]);
                        wear($who,$itm);
                        die();
                        }
                        else if($db["hand_r_free"] == 0){
                        unwear($who,$db["hand_r"]);
                        wear($who,$itm);
                        die();
                        }
                        else if($db["hand_r_free"] == 0 && $db["hand_l_free"] == 0){
                        unwear($who,$db["hand_r"]);
                        unwear($who,$db["hand_l"]);
                        wear($who,$itm);
                        die();
                        }
                }
        $w_type = $i_type;/*тип оружия*/
        }
        else if($i_type == "shield"){
                if($db["hand_l_free"] == 1){$slot = "hand_l";}
                else if($db["hand_l_free"] == 0){
                        if($db["hand_l"]!=0){
                        unwear($who,$db["hand_l"]);
                        wear($who,$itm);
                        die();
                        }
                        else{
                        unwear($who,$db["hand_r"]);
                        wear($who,$itm);
                        die();
                        }
                }
        $w_type = $i_type;/*тип щита*/
        }
        else if($i_type == "ring"){
                if($db["ring1"] == 0){
                $slot = "ring1";
                }
                else if($db["ring2"] == 0){
                $slot="ring2";
                }
                else if($db["ring3"] == 0){
                $slot = "ring3";
                }
                if($db["ring1"] != 0 and $db["ring2"] != 0 and $db["ring3"] != 0){
                unwear($who,$db["ring1"]);
                wear($who,$itm);
                }
        }
        else{
        $slot = $i_type;
        }
$user_query = mysql_query("SELECT * FROM users WHERE login='$who'");
$db = mysql_fetch_array($user_query);
        
if($i_type=="helmet"){if($db["helmet"]!=0){unwear($who,$db["helmet"]);}}
if($i_type=="amulet"){if($db["amulet"]!=0){unwear($who,$db["amulet"]);}}
if($i_type=="sergi"){if($db["sergi"]!=0){unwear($who,$db["sergi"]);}}
if($i_type=="armour"){if($db["armour"]!=0){unwear($who,$db["armour"]);}}
if($i_type=="poyas"){if($db["poyas"]!=0){unwear($who,$db["poyas"]);}}
if($i_type=="ring1"){if($db["ring1"]!=0){unwear($who,$db["ring1"]);}}
if($i_type=="ring2"){if($db["ring2"]!=0){unwear($who,$db["ring2"]);}}
if($i_type=="ring3"){if($db["ring3"]!=0){unwear($who,$db["ring3"]);}}
if($i_type=="naruchi"){if($db["naruchi"]!=0){unwear($who,$db["naruchi"]);}}
if($i_type=="perchi"){if($db["perchi"]!=0){unwear($who,$db["perchi"]);}}
if($i_type=="boots"){if($db["boots"]!=0){unwear($who,$db["boots"]);}}
if($i_type=="leg"){if($db["leg"]!=0){unwear($who,$db["leg"]);}}

$user_query = mysql_query("SELECT * FROM users WHERE login='$who'");
$db = mysql_fetch_array($user_query);

if($req_align!=0 && $align!=$req_align){
print "Ваша склонность не позволяет одеть эту вещь.";
}
else if($wearable == 1){

$new_sila=$db["sila"]+$item_data["add_sila"];
$new_lovkost=$db["lovkost"]+$item_data["add_lovkost"];
$new_udacha=$db["udacha"]+$item_data["add_udacha"];
$new_intellekt=$db["intellekt"]+$item_data["add_intellekt"];
$new_mana=$db["mana_all"]+$item_data["add_mana"];
$new_phead=$db["bron_head"]+$item_data["protect_head"];
$new_pcorp=$db["bron_corp"]+$item_data["protect_corp"];
$new_ppoyas=$db["bron_poyas"]+$item_data["protect_poyas"];
$new_plegs=$db["bron_legs"]+$item_data["protect_legs"];
$new_mfkrit=$db["mf_krit"]+$item_data["mf_krit"];
$new_mfantikrit=$db["mf_antikrit"]+$item_data["mf_antikrit"];
$new_mfuvorot=$db["mf_uvorot"]+$item_data["mf_uvorot"];
$new_mfantiuvorot=$db["mf_antiuvorot"]+$item_data["mf_antiuvorot"];
$new_wpmin_h=$item_data["min_attack"];
$new_wpmax_h=$item_data["max_attack"];
if($slot=="hand_l"){
$new_wpmin=$db["hand_l_hitmin"]+$item_data["min_attack"];
$new_wpmax=$db["hand_l_hitmax"]+$item_data["max_attack"];
$new_mfkrit_h=$db["hand_l_krit"]+$item_data["mf_krit"];
$new_mfantikrit_h=$db["hand_l_antikrit"]+$item_data["mf_antikrit"];
$new_mfuvorot_h=$db["hand_l_uvorot"]+$item_data["mf_uvorot"];
$new_mfantiuvorot_h=$db["hand_l_antiuvorot"]+$item_data["mf_antiuvorot"];
}
else if($slot=="hand_r"){
$new_wpmin=$db["hand_r_hitmin"]+$item_data["min_attack"];
$new_wpmax=$db["hand_r_hitmax"]+$item_data["max_attack"];
$new_mfkrit_h=$db["hand_r_krit"]+$item_data["mf_krit"];
$new_mfantikrit_h=$db["hand_r_antikrit"]+$item_data["mf_antikrit"];
$new_mfuvorot_h=$db["hand_r_uvorot"]+$item_data["mf_uvorot"];
$new_mfantiuvorot_h=$db["hand_r_antiuvorot"]+$item_data["mf_antiuvorot"];
}
$new_swordvl=$db["sword_vl"]+$item_data["sword_vl"];
$new_axevl=$db["axe_vl"]+$item_data["axe_vl"];
$new_failvl=$db["hummer_vl"]+$item_data["fail_vl"];
$new_knifevl=$db["castet_vl"]+$item_data["knife_vl"];
$new_spearvl=$db["copie_vl"]+$item_data["spear_vl"];
$new_shotvl=$db["shot_vl"]+$item_data["shot_vl"];
$new_cost=$db["cost"]+$item_data["price"];
$new_mass=$db["mass"]+$item_data["mass"];
$new_arm_l=$db["no_armour"]+$item_data["add_arm_l"];
$new_arm_m=$db["light_armour"]+$item_data["add_arm_m"];
$new_arm_h=$db["heavy_armour"]+$item_data["add_arm_h"];
$new_fire=$db["fire_magic"]+$item_data["add_fire"];
$new_water=$db["water_magic"]+$item_data["add_water"];
$new_air=$db["air_magic"]+$item_data["add_air"];
$new_earth=$db["earth_magic"]+$item_data["add_earth"];
$new_cast=$db["cast"]+$item_data["add_cast"];
$new_trade=$db["trade"]+$item_data["add_trade"];
$new_cure=$db["cure"]+$item_data["add_cure"];
$new_walk=$db["walk"]+$item_data["add_walk"];
$new_hp=$db["hp_all"]+$item_data["add_hp"];
$new_velocity=$db["maxmass"]+$item_data["add_velocity"];
$new_parm=$db["bron_arm"]+$item_data["bron_arm"];
$now_hp = $db["hp"];
setHP($who,$now_hp,$new_hp);

$new_sql ="UPDATE users SET sila='$new_sila',lovkost='$new_lovkost',udacha='$new_udacha',hp_all='$new_hp',";
$new_sql.="intellekt='$new_intellekt',mana_all='$new_mana',bron_head='$new_phead',bron_corp='$new_pcorp',";
$new_sql.="bron_poyas='$new_ppoyas',bron_legs='$new_plegs',bron_arm='$new_parm',maxmass='$new_velocity',";
$new_sql.="cost='$new_cost',$slot='$itm',sword_vl='$new_swordvl',axe_vl='$new_axevl',hummer_vl='$new_failvl',shot_vl='$new_shotvl',";
if($slot == "hand_r"){
$new_sql.="hand_r_krit='$new_mfkrit_h',hand_r_antikrit='$new_mfantikrit_h',hand_r_uvorot='$new_mfuvorot_h',hand_r_antiuvorot='$new_mfantiuvorot_h',hand_r_hitmin='$new_wpmin',hand_r_hitmax='$new_wpmax',";
}
else if($slot == "hand_l"){
$new_sql.="hand_l_krit='$new_mfkrit_h',hand_l_antikrit='$new_mfantikrit_h',hand_l_uvorot='$new_mfuvorot_h',hand_l_antiuvorot='$new_mfantiuvorot_h',hand_l_hitmin='$new_wpmin',hand_l_hitmax='$new_wpmax',";
}
else{
$new_sql.="mf_krit='$new_mfkrit',mf_antikrit='$new_mfantikrit',mf_uvorot='$new_mfuvorot',mf_antiuvorot='$new_mfantiuvorot',";
}
$new_sql.="castet_vl='$new_knifevl',copie_vl='$new_spearvl',mass='$new_mass',no_armour='$new_arm_l',";
$new_sql.="light_armour='$new_arm_m',heavy_armour='$new_arm_h',fire_magic='$new_fire',water_magic='$new_water',";
$new_sql.="air_magic='$new_air',earth_magic='$new_earth',cast='$new_cast',trade='$new_trade',cure='$new_cure',walk='$new_walk'";
$new_sql.=" WHERE login='$who'";

$new_query=mysql_query($new_sql);
$n_query=mysql_query("UPDATE inv SET wear='1' WHERE id=$itm");

        if($hands == 2){
                if($slot=="hand_r"){$n2q=mysql_query("UPDATE users SET hand_r_type='$w_type',hand_r_free='0',hand_l_free='0' WHERE login='$who'");}
                if($slot=="hand_l"){$n2q=mysql_query("UPDATE users SET hand_l_type='$w_type',hand_l_free='0',hand_r_free='0' WHERE login='$who'");}
        }
        else{
                if($slot=="hand_r"){$n2q=mysql_query("UPDATE users SET hand_r_type='$w_type',hand_r_free='0' WHERE login='$who'");}
                if($slot=="hand_l"){$n2q=mysql_query("UPDATE users SET hand_l_type='$w_type',hand_l_free='0' WHERE login='$who'");}
        }
}


}

Теперь в отделе Ножи-Кастеты выбираем любой нож , в его таблице где type = knife меняем на type = sek_hand

Тестируем. Отписываемся. Поправляем.
 
Сверху