• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Players don't get teleported to the new city (map change on war server)

Celsish

New Member
Joined
Apr 6, 2009
Messages
74
Reaction score
0
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
 
Lua:
local min, max = 1, 5

local function changeMap(new, temple)
	for _, pid in ipairs(getPlayersOnline()) do
		if getCreatureStorage(pid, 4000) ~= 1 then
			doTeleportThing(pid, temple)
			doPlayerSetTown(pid, new)
			doRemoveCondition(pid, CONDITION_INFIGHT)
		end
	end
	doBroadcastMessage('The map has been changed to ' .. getTownName(new) .. '.')
	db.executeQuery('UPDATE players SET town_id='.. new.. ', posx=0, posy=0, posz=0 WHERE group_id=1')
end

function onThink(interval, lastExecution)
	local s = math.max(min, getStorage(123))
	local new = s < max and s + 1 or min
	doSetStorage(123, new)
	doBroadcastMessage('Changing map within 1 minute to ' .. getTownName(new) .. '.')
	addEvent(changeMap, 60000, new, getTownTemplePosition(new))
	return true
end
 
Back
Top