battles/magic/no_attack.php

21 lines
1.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$effect = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '{$us['id']}' AND `time` > '".time()."' AND `type` = '227' LIMIT 1"));
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `dontattack` FROM `abils_vip` WHERE `uid` = "'.$user['id'].'" LIMIT 1'));
if($_POST['target'] != $user['login']) {
echo 'Вы можете использовать только на себя';
} elseif($vip['dontattack'] <= 0) {
echo 'Магия была исчерпана ...';
} elseif($user['battle'] > 0) {
echo "Не в бою...";
} elseif(isset($effect['id'])) {
echo "На Вас, уже есть Защита от нападений";
} else {
if($user['invis'] == 1) { $user['login'] = 'невидимка'; }
addch("<img src=i/magic/attack_defence.gif>Персонаж &quot;{$user['login']}&quot; наложил заклятие \"Защита от нападений\" на &quot;{$user['login']}&quot;, сроком 2 часа.");
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`) values ('".$user['id']."', 'Защита от нападений', '".(time()+60*60*2)."', '227')");
echo "<font color=red><b>На персонажа \"{$user['login']}\" наложено заклятие \"Защита от нападений\" </b></font>";
$vip['dontattack'] -= 1;
mysql_query('UPDATE `abils_vip` SET `dontattack` = "'.$vip['dontattack'].'" WHERE `id` = "'.$vip['id'].'" LIMIT 1');
}