- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
function addBotfortrain($who,$bot,$bot_name) {
$db = mysql_fetch_array(mysql_query("SELECT hp_all FROM users WHERE login='$who'"));
$all = mysql_fetch_array(mysql_query("SELECT max(id) as id FROM battles"));
$bid = $all["id"]+1;
mysql_unbuffered_query("INSERT INTO bot_temp(bot_name,hp,hp_all,battle_id,prototype,team,mana,mana_all,level) VALUES('$bot_name','".$db["hp_all"]."','".$db["hp_all"]."','$bid','$bot','2','$mana','$mana_all','0')");
mysql_unbuffered_query("DELETE FROM team2 WHERE player='$bot'");
}
/*===============================================================*/
function attack($who,$attacker,$dif) {
$db=mysql_fetch_array(mysql_query("SELECT id FROM users WHERE login='$who'"));
if(empty($ip)) {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip=getenv('HTTP_X_FORWARDED_FOR');}
else {$ip=getenv('REMOTE_ADDR');}}
if($attacker == "gorg1") {
$prototype = "Рядовой Горг";
$name = "Рядовой Горг";}
if($attacker == "gorg2") {
$prototype = "Горг-Лейтенант";
$name = "Горг-Лейтенант";}
if($attacker == "gorg3") {
$prototype = "Горг-Капитан";
$name = "Горг-Капитан";}
if($attacker == "gorg4") {
$prototype = "Горг Подполковник";
$name = "Горг Подполковник";}
$mine_id=$db["id"];
if( !mysql_fetch_array(mysql_query("SELECT id FROM zayavka WHERE creator = '".$mine_id."'")) ) {
mysql_unbuffered_query("INSERT INTO zayavka(status,type,timeout,creator)
VALUES('3','1','3','$mine_id')");
mysql_unbuffered_query("INSERT INTO team1(player,ip,battle_id,hitted,over)
VALUES('$who','$ip','$mine_id','0','0')");
mysql_unbuffered_query("INSERT INTO team2(player,ip,battle_id,hitted,over)
VALUES('$prototype','$ip','$mine_id','0','0')");
addBotfortrain($who,$prototype,$name);
say("$who","<font color=RED>Системное сообщение:</font> ТРЕВОГА!!! На город напали Горги!!!",$who);
goBattle($who);
}
}
Обратите внимание на 34 строку (мы вставляем в таблицу данные). После вставки процедура addBotfortrain удаляет их.