<?php
defined('PROTECTOR') OR die('Ошибка: нет доступа');
$date = time();
/*
$dueli = mysql_num_rows(mysql_query("SELECT * FROM `userduel` WHERE `usr` = '$log' LIMIT 1"));
if($dueli==0){
*/
$be=mysql_fetch_array(mysql_query("SELECT * FROM `regenerator` WHERE `usr` = '$log' LIMIT 1"));
if($set['vip']=='on'){
$k_point=intval((time()-$be['last'])/5);
}else{
$k_point=intval((time()-$be['last'])/10);
}
$k_point2=intval((time()-$be['last'])/10);
if($k_point>=1){
/*
if($in_battle==0 AND $inpk==0 AND $inar==0){
*/
$newhp=$udata['hp']+(2*$k_point);
$newmp=$udata['mp']+(2*$k_point2);
if($newhp>$udata['hpall']){
$newhp=$udata['hpall'];
}
if($newmp>$udata['mpall']){
$newmp=$udata['mpall'];
}
mysql_query("UPDATE `users` SET `hp` = '$newhp',`mp` = '$newmp' WHERE `usr` = '$log' LIMIT 1");
mysql_query("UPDATE `regenerator` SET `last` = '$date' WHERE `usr` = '$log' LIMIT 1");
}

if($udata['hp']<0){
mysql_query("UPDATE `users` SET `hp` = '0' WHERE `usr` = '$log' LIMIT 1");
}

/*
}
}
*/
?>