Файл: l2ps_v5/files/regeneration.php
Строк: 40
<?php
$t=mysql_query("SELECT * FROM `time` where `time`<'".time()."' ");
$tm=mysql_num_rows($t);
if($tm==1){
////////////////////Яд////////////////
$y=mysql_query("SELECT * FROM `yad` ");
$yad1=mysql_num_rows($y);
if($yad1>0){
while($yad=mysql_fetch_array($y)){
$m=mysql_query("SELECT * FROM `okrestnosti` where `id`='$yad[idmob]' ");
$mob=mysql_fetch_array($m);
$mob2=$mob[mob2]-$yad[sila];
mysql_query("UPDATE `okrestnosti` SET `mob2`='$mob2' WHERE `id`='$mob[id]' ");
if($mob[mob2]<=0){mysql_query("DELETE FROM `yad` WHERE `idmob`='$mob[id]' ");}
}}
$yq=mysql_query("SELECT * FROM `yadusers` where `time`>'".time()."' ");
$ya=mysql_fetch_array($yq);
$usersss=mysql_query("SELECT * FROM `users` WHERE `udata0`='$ya[iduser]' ");
while($us=mysql_fetch_array($usersss)){
$udata16=$us[udata16]-$ya[sila];
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$us[udata0]' ");}
////////////////////Хп и Мп//////////////
$usersss=mysql_query("SELECT * FROM `users` WHERE `udata56`>('".time()."'-'1200') ");
while($us=mysql_fetch_array($usersss)){
if($us[udata9]<20){
$h=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='hp' LIMIT 1");
$hp=mysql_fetch_array($h);
$hp[kol]=$hp[kol]*2;
$hp=round($us[udata16]+15+$hp[kol]);
if($hp>$us[udata17]){
$hp=$us[udata17];
}
$m=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='mp' LIMIT 1");
$mp=mysql_fetch_array($m);
$mp[kol]=$mp[kol]*2;
$mp=round($us[udata29]+10+$mp[kol]);
if($mp>$us[udata30]){
$mp=$us[udata30];
}
$c=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='cp' LIMIT 1");
$cp=mysql_fetch_array($c);
$cp[kol]=$cp[kol]*2;
$cp=round($us[udata42]+5+$cp[kol]);
if($cp>$us[udata43]){
$cp=$us[udata43];
}
}
if($us[udata9]<40 and $us[udata9]>20){
$h=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='hp' LIMIT 1");
$hp=mysql_fetch_array($h);
$hp[kol]=$hp[kol]*5;
$hp=round($us[udata16]+25+$hp[kol]);
if($hp>$us[udata17]){
$hp=$us[udata17];
}
$m=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='mp' LIMIT 1");
$mp=mysql_fetch_array($m);
$mp[kol]=$mp[kol]*4;
$mp=round($us[udata29]+25+$mp[kol]);
if($mp>$us[udata30]){
$mp=$us[udata30];
}
$c=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='cp' LIMIT 1");
$cp=mysql_fetch_array($c);
$cp[kol]=$cp[kol]*4;
$cp=round($us[udata42]+15+$cp[kol]);
if($cp>$us[udata43]){
$cp=$us[udata43];
}
}
if($us[udata9]<=85 and $us[udata9]>40){
$h=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='hp' LIMIT 1");
$hp=mysql_fetch_array($h);
$hp[kol]=$hp[kol]*10;
$hp=round($us[udata16]+50+$hp[kol]);
if($hp>$us[udata17]){
$hp=$us[udata17];
}
$m=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='mp' LIMIT 1");
$mp=mysql_fetch_array($m);
$mp[kol]=$mp[kol]*5;
$mp=round($us[udata29]+25+$mp[kol]);
if($mp>$us[udata30]){
$mp=$us[udata30];
}
$c=mysql_query("SELECT * FROM `addhpmp` where `login`='$log' and `tip`='cp' LIMIT 1");
$cp=mysql_fetch_array($c);
$cp[kol]=$cp[kol]*5;
$cp=round($us[udata42]+25+$cp[kol]);
if($cp>$us[udata43]){
$cp=$us[udata43];
}
}
$timen=time();
$yq=mysql_query("SELECT * FROM `yadusers` where `iduser`='$us[udata0]' ");
$ya=mysql_num_rows($yq);
$dead=mysql_query("SELECT * FROM `dead` where `login`='$us[udata0]' ");
$dead=mysql_num_rows($dead);
if($ya==0 and $dead==0){
mysql_query("UPDATE `users` SET `udata16`='$hp' WHERE `udata0`='$us[udata0]'");}
mysql_query("UPDATE `users` SET `udata29`='$mp' WHERE `udata0`='$us[udata0]'");
mysql_query("UPDATE `users` SET `udata42`='$cp' WHERE `udata0`='$us[udata0]'");
mysql_query("UPDATE `users` SET `udata58`='$timen' WHERE `udata0`='$us[udata0]'");
}
$time1=time()+10;
mysql_query("UPDATE `time` SET `time`='$time1'");
}
?>