Good Evening:
This script used to change the map each time interval runs but has a bug: when players connect newly created, players not in the moment city because appear in the first city.
Also, if I bring these people to the moment city, and then I make a kick, they do not appear in the first moment city, but they remained in the city of the moment before; this means that the script does not work for players created new ones, because the system does not teleports the people where all players are playing. Finally, I use a TFS SVN_04 and msyql.
Please help men! (if you can fix this script please)
This script used to change the map each time interval runs but has a bug: when players connect newly created, players not in the moment city because appear in the first city.
Also, if I bring these people to the moment city, and then I make a kick, they do not appear in the first moment city, but they remained in the city of the moment before; this means that the script does not work for players created new ones, because the system does not teleports the people where all players are playing. Finally, I use a TFS SVN_04 and msyql.
Please help men! (if you can fix this script please)
Code:
local config, new = {
minTownId = 1,
maxTownId = 6
}, 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))
doRemoveConditions(pid)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
doBroadcastMessage("Map has been changed! Next map change will be in 30 minutes!", MESSAGE_STATUS_WARNING)
end
db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
return true
end