<?
defined('PROTECTOR') or die('Починка оружия :-D');
$reg = mysql_query("SELECT * FROM `weapon` WHERE `usr`='$log' and `image`='yes'") or die(mysql_error());
While($weap=mysql_fetch_array($req)){
$mob=$weap[mob]+1;
mysql_query("UPDATE `weapon` SET `mob` =  '$mob' WHERE`id`= '$weap[id]'") or die(mysql_error());

if($weap[mob]>=99){
$proch=$weap[proch]-1;
if($weap[zakal]==1){$k=20;}else{$k=10;}
$sila=round($weap[sila]-($weap[sila]/$k));
$lovk=round($weap[lovk]-($weap[lovk]/$k));
$prot=round($weap[prot]-($weap[prot]/$k));
$krit=round($weap[krit]-($weap[krit]/$k));
$ukrit=round($weap[ukrit]-($weap[ukrit]/$k));
$hp=round($weap[hp]-($weap[hp]/$k));
$mp=round($weap[mp]-($weap[mp]/$k));
/////
$usila=round($udata[sila]-($weap[sila]/$k));
$ulovk=round($udata[lovk]-($weap[lovk]/$k));
$uprot=round($udata[prot]-($weap[prot]/$k));
$ukrit=round($udata[krit]-($weap[krit]/$k));
$uukrit=round($udata[ukrit]-($weap[ukrit]/$k));
$uhp=round($udata[hp]-($weap[hp]/$k));
$ump=round($udata[mp]-($weap[mp]/$k));
/////
mysql_query("UPDATE `weapon` SET 
`mob` =  '$weap[mob]'-'100',
`proch` =  '$proch',
`sila` =  '$sila',
`lovk` =  '$lovk',
`prot` =  '$prot',
`krit` =  '$krit',
`ukrit` =  '$ukrit',
`hp` =  '$hp',
`mp` =  '$mp'
 WHERE`id`= '$weap[id]'");

mysql_query("UPDATE `users` SET 
`sila` =  '$usila',
`lovk` =  '$ulovk',
`prot` =  '$uprot',
`krit` =  '$'ukrit',
`ukrit` =  '$uukrit',
`hp` =  '$uhp',
`mp` =  '$ump'
 WHERE`id`= '$weap[id]'");
}
}
?>