<?php
// охрана замка
global $lcen;
if (gettype($lcen)!="array") {
$lcen=array();
$gate=substr($i,0,4)."gate";
loadloc($gate);
$d=explode("|",$l_tt[$gate]["d"]);
if (strpos($d[0],"*")!==false) {
$clanc=substr($d[0],strpos($d[0],"*")+1,strrpos($d[0],"*")-strpos($d[0],"*")-1);
foreach($l_i[$i] as $k=>$v) if (substr($k,0,2)=="u." && strpos($l_i[$i][$k]["char"],"*".$clanc."*")===false && strpos($d[0],":".$k.":")===false) {$tct=explode("|",$l_i[$i][$k]["char"]); if (!$tct[8]) $lcen[]=$k;}
}
}
if (count($lcen)>0) $char[7]=$lcen[rand(0,count($lcen)-1)];