} $sql = "SELECT count(*) FROM kdbattles WHERE (kingdom = '{$acc['kingdom']}' AND (status = '0' OR status = '1')) OR (target = '{$acc['kingdom']}' AND status = '1')"; $result = $db->query($sql); $numrows = $db->result($result, 0); if ($numrows != 0) { $output .= 'You have to finish all the incoming, outgoing and new kingdom battles first.<br>'; $no = 1; } $sql = "SELECT count(*) FROM kdbattles WHERE (target = '{$kingdom}' OR kingdom = '{$kingdom}') AND status = '1'"; $result = $db->query($sql); $numrows = $db->result($result, 0); if ($numrows != 0) { $output .= 'You can\'t join a kingdom that is attacking another kingdom or that is under attack.<br>They have to finish their kingdom battles first.<br>'; $no = 1; } if (gCheckNether($acc["id"])) { $output .= 'You can\'t leave a kingdom while you possess a Nether Demon, because that creature is magically bound to this kingdom.<br>'; $no = 1; } $sql = "SELECT * FROM summons WHERE type = '3' AND account = '{$acc['id']}'"; $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows != 0) { $output .= ' There are still creatures defending a building of your kingdom or one of your allies.<br> You have to remove them first.<br> '; $no = 1; } if ($acc["attacked"]) { $output .= 'You can\'t switch kingdoms while you are under attack.<br>';
$result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows != 1) { echo 'Invalid aid.<br>'; $no = 1; } else { $target = $db->fetch_array($result); if ($acc["leadertype"] != 2) { echo 'You are not a king.<br>'; $no = 1; } if ($acc["id"] == $aid) { echo 'You can not remove yourself.<br>'; $no = 1; } if (gCheckNether($aid) && $target["status"] != 2) { echo 'You can\'t kick someone out of your kingdom while he possesses a Nether Demon, because that creature is magically bound to this kingdom.<br>'; $no = 1; } $sql = "SELECT * FROM summons WHERE (type = '3' OR type = '2') AND account = '{$aid}'"; $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows != 0) { echo ' There are still one or more of this player\'s creatures defending a building of your kingdom or one of your allies or there are creatures participating in a kingdom battle.<br> The mage will have to remove them first.<br> '; $no = 1; } $sql = "SELECT count(*) FROM kdbattles WHERE (kingdom = '{$acc['kingdom']}' AND (status = '0' OR status = '1')) OR (target = '{$acc['kingdom']}' AND status = '1')"; $result = $db->query($sql);