I would like modify this script for when login,go random towns,not by time.
Im using TFS 0.3.6
Thanks,
Stewie.
LUA:
local config, new = {
minTownId = 1,
maxTownId = 7
}, 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(pid, CONDITION_INFIGHT)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
end
db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
doBroadcastMessage("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
return true
end
Im using TFS 0.3.6
Thanks,
Stewie.