oh ok, you are partially right when it kick excess guild members
but it isn't the way you claimed that it count from other guild members
upon close inspection, @astralprojection script has 2 problems which is
1. if the player has multiple characters from the same account join the same guild, it count multiple times instead of 1, it doesn't extend the isloggedin into $@guildmembercid check
2. it checks as long as the guild member enter ANY CASTLE map, not that particular castle map
try this one
https://gist.github.com/AnnieRuru/339e268a8be5370fa7ae1aa2f856ca28