Connection ErrorBad RequestSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
Botojan, I can only offer a couple of comments; I'm not sure how critical they are in your specific case.
if newowner == PLAYER_1 == nil then
I wouldn't recommend using such a complex syntax. There's a high chance of making a mistake.
""Bobruisk"", ""TownCaptured""
I'm not entirely sure if double-double quotes like that will be processed correctly.
for i = 1, 14 do total = total + GetHeroCreatures( heroname, i ) * costs; end;
The link to the Haven castle is within the loop from 1 to 14 – these are the IDs of the creatures in that castle. Look for the IDs you need in the documentation.