When the map is changed to edron etc and the new players logs in they comes to thais and everybode else is in edron, can someone please help me so everyone who logs in get teleported to the right city
PHP:
local config, new, temple = {
min = 1,
max = 5
}, 0
local function changeMap()
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(pid, 4000) ~= 1 then
doTeleportThing(pid, temple)
doPlayerSetTown(pid, new)
doTeleportThing(pid, getTownTemplePosition(new))
doRemoveCondition(pid, CONDITION_INFIGHT)
end
end
temple = nil
doBroadcastMessage('The map has been changed to ' .. getTownName(new) .. '.')
db.executeQuery('UPDATE players SET town_id='.. new)
end
function onThink(interval, lastExecution)
new = new < config.max and new + 1 or config.min
temple = getTownTemplePosition(new)
doBroadcastMessage('Changing map within 1 minute to ' .. getTownName(new) .. '.')
addEvent(changeMap, 60000)
return true
end