local config, new = {
minTownId = 1,
maxTownId = 5
}, 0
function onThink(interval, lastExecution)
for _, pid in ipairs(getPlayersOnline()) do
local town = getPlayerTown(pid)
new = town < config.maxTownId and town + 1 or config.minTownId
doPlayerSetTown(pid, new)
doTeleportThing(pid, getTownTemplePosition(new))
doRemoveCondition(cid, CONDITION_INFIGHT)
end
db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
return true
end