Файл: lib/regen.php
Строк: 21
<?php
$q = mysql_num_rows(mysql_query("SELECT * FROM `l2_regen` WHERE `user`='$uid'"));
if($q == 0){
mysql_query("INSERT INTO `l2_regen` SET `user`='$uid',`time`='".time()."'");
}
$be=mysql_fetch_array(mysql_query("SELECT * FROM `l2_regen` WHERE `user` = '$uid' LIMIT 1"));
$k_point=intval((time()-$be['time'])/3);
if($k_point>=1){
$newhp=$user['hp']+(($user['hpall']/100)*5);
$newmp=$user['mp']+(($user['mpall']/100)*3);
$newcp=$user['cp']+(($user['cpall']/100)*2);
if($newhp>$user['hpall']){
$newhp=$user['hpall'];
}
if($newmp>$user['mpall']){
$newmp=$user['mpall'];
}
if($newcp>$user['cpall']){
$newcp=$user['cpall'];
}
$date = time();
mysql_query("UPDATE `l2_user` SET `hp` = '$newhp',`mp`='$newmp',`cp`='$newcp' WHERE `id` = '$uid' LIMIT 1");
mysql_query("UPDATE `l2_regen` SET `time` = '$date' WHERE `user` = '$uid' LIMIT 1");}