Nothxbye
Banned User
- Joined
- Jan 22, 2012
- Messages
- 1,124
- Reaction score
- 174
Today i tried to do map changer script but i've got werid error. Check this
error
Any ideas how to fix it? im 100% sure that i have ids from 1 to 10 in map editor.
Code:
function onThink(interval, lastExecution, thinkInterval)
local maps = {
[1] = {mapName = "Fibula", redTemple = {x = 366, y = 504, z = 7}, blueTemple = {x = 439, y = 569, z = 7}, redTownId = 1, blueTownId = 6},
[2] = {mapName = "Hellgate", redTemple = {x = 32684, y = 31672, z = 9}, blueTemple = {x = 32646, y = 31655, z = 9}, redTownId = 2, blueTownId = 7},
[3] = {mapName = "Cyclopolis", redTemple = {x = 33306, y = 31706, z = 12}, blueTemple = {x = 33314, y = 31674, z = 11}, redTownId = 3, blueTownId = 8},
[4] = {mapName = "Third Respawn", redTemple = {x = 33072, y = 32576, z = 7}, blueTemple = {x = 33119, y = 32573, z = 6}, redTownId = 4, blueTownId = 9},
[5] = {mapName = "Dwarf Bridge", redTemple = {x = 32621, y = 31934, z = 7}, blueTemple = {x = 32862, y = 32125, z = 6}, redTownId = 5, blueTownId = 10},
}
local map = maps[getGlobalStorageValue(100)]
if getGlobalStorageValue(100) <= 0 then
setGlobalStorageValue(100, 1)
elseif getGlobalStorageValue(100) >= math.max(1, #maps) then
setGlobalStorageValue(100, 1)
elseif getGlobalStorageValue(100) >= 1 then
setGlobalStorageValue(100, getGlobalStorageValue(100)+1)
end
if map then
for _, cid in ipairs(getOnlinePlayers()) do
player = getCreatureByName(cid)
if (getPlayerStorageValue(player, 1002) == 1) then
doPlayerSetTown(player, map.redTownId)
doTeleportThing(player, map.redTemple)
doSendMagicEffect(getPlayerPosition(player), 10)
elseif (getPlayerStorageValue(player, 1003) == 1) then
doPlayerSetTown(player, map.blueTownId)
doTeleportThing(player, map.blueTemple)
doSendMagicEffect(getPlayerPosition(player), 10)
end
doRemoveConditions(player)
doPlayerSendTextMessage(player, 20, "Map has been changed to " .. map.mapName .. "! Next map in 30 minutes!")
end
end
return 1
end
error
Code:
luaDoPlayerSetTown(). Not found townid
Any ideas how to fix it? im 100% sure that i have ids from 1 to 10 in map editor.