battles/magic/al_neut_power.php
2018-01-28 18:40:49 +02:00

30 lines
1.9 KiB
PHP
Raw 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
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' and `type` = '21' LIMIT 1;"));
$int=101;
if ($user['battle'] > 0) {echo "Не в бою...";}
elseif ($effect['time']) {echo "На персонаже уже есть заклятие Сила нейтралитета"; }
elseif ($user['room'] != $us['room']) { echo "Персонаж в другой комнате!"; }
elseif (!$us['online']) {echo "Персонаж не в игре!";}
elseif (rand(1,100) < $int) {
addch("<img src=i/magic/al_neut_power.gif>Персонаж &quot;{$user['login']}&quot; наложил заклятие \"Сила нейтралитета\" на &quot;{$_POST['target']}&quot;, сроком 2 часа.");
$param_name=array("sila","lovk","inta","vinos");
$param_name=$param_name[array_rand($param_name)];
$param_value=rand(20,30);
$us = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`{$param_name}`,`type`) values ('".(int)$us['id']."','Сила нейтралитета',".(time()+7200).",{$param_value},21);");
mysql_query("UPDATE `users` SET `{$param_name}`={$param_name}+{$param_value} WHERE `id`='{$us['id']}';");
echo "<font color=red><b>На персонажа \"{$_POST['target']}\" наложено заклятие \"Сила нейтралитета\" </b></font>";
$bet=1;
$outok=1;
} else {
echo "Свиток рассыпался в ваших руках...";
$bet=1;
}
?>