<?php
// телепорт в свой замок
if ($clanc && $clanc==$clan) {// только если есть враги
$tc=substr($ctele,0,4);
loadloc($tc."main");
loadloc($tc."tron");
loadloc($tc."sklad");
if ($l_i[$tc."gate"]) foreach(array_keys($l_i[$tc."gate"]) as $k) if(substr($k,0,2)=="u." && $k!=$login) {
$tchar=explode("|",$l_i[$tc."gate"][$k]["char"]);
if (strpos($tchar[0],"*")===false) $tclan=""; else $tclan=substr($tchar[0],strpos($tchar[0],"*")+1,strrpos($tchar[0],"*")-strpos($tchar[0],"*")-1);
if ($tclan!=$clan && strpos($d[0],":".$k.":")===false) {addnpc($login,$loc,$ctele); return;}
}
if ($l_i[$tc."main"]) foreach(array_keys($l_i[$tc."main"]) as $k) if(substr($k,0,2)=="u." && $k!=$login) {
$tchar=explode("|",$l_i[$tc."main"][$k]["char"]);
if (strpos($tchar[0],"*")===false) $tclan=""; else $tclan=substr($tchar[0],strpos($tchar[0],"*")+1,strrpos($tchar[0],"*")-strpos($tchar[0],"*")-1);
if ($tclan!=$clan && strpos($d[0],":".$k.":")===false) {addnpc($login,$loc,$ctele); return;}
}
if ($l_i[$tc."tron"]) foreach(array_keys($l_i[$tc."tron"]) as $k) if(substr($k,0,2)=="u." && $k!=$login) {
$tchar=explode("|",$l_i[$tc."tron"][$k]["char"]);
if (strpos($tchar[0],"*")===false) $tclan=""; else $tclan=substr($tchar[0],strpos($tchar[0],"*")+1,strrpos($tchar[0],"*")-strpos($tchar[0],"*")-1);
if ($tclan!=$clan && strpos($d[0],":".$k.":")===false) {addnpc($login,$loc,$ctele); return;}
}
if ($l_i[$tc."sklad"]) foreach(array_keys($l_i[$tc."sklad"]) as $k) if(substr($k,0,2)=="u." && $k!=$login) {
$tchar=explode("|",$l_i[$tc."sklad"][$k]["char"]);
if (strpos($tchar[0],"*")===false) $tclan=""; else $tclan=substr($tchar[0],strpos($tchar[0],"*")+1,strrpos($tchar[0],"*")-strpos($tchar[0],"*")-1);
if ($tclan!=$clan && strpos($d[0],":".$k.":")===false) {addnpc($login,$loc,$ctele); return;}
}
}