Verrine
Member
- Joined
- Mar 2, 2016
- Messages
- 117
- Reaction score
- 7
Hi i posted here https://otland.net/threads/tfs-1-1-teleporter-spot-configurable-price-and-storage.230096/page-2 but i doesnt get any respond from anyone. Ive copied it to TFS 1.2 it looks like working script but when i step in unique id nothing happens in Tibia but in console there is 1 error like there:
the code in LUA:
i dont know whats going on im not pro in TFS scripting but i dont see any errors in lua scrip, how can i repair it?
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/tp_pad.lua:onStepIn
data/movements/scripts/tp_pad.lua:33: attempt to index field '?' (a nil value)
stack traceback:
[C]: in function '__index'
data/movements/scripts/tp_pad.lua:33: in function <data/movements/scripts/tp_pad.lua:7>
the code in LUA:
Code:
tp_pads = {
[8301] = {price = 1, name = "Thais", storage = 99586},
[8302] = {price = 1, name = "PoH", storage = 99587}
}
function onStepIn(player, item, position, fromPosition)
if not tp_pads[item.uid] then return true end
if not isInRange(position, {x = fromPosition.x - 1, y = fromPosition.y - 1, z = fromPosition.z}, {x = fromPosition.x + 1, y = fromPosition.y + 1, z = fromPosition.z}) then
-- player got there from another pad
return true
end
if not player:isPlayer() then
return true
end
if tp_pads[item.uid].storage then
if player:getStorageValue(tp_pads[item.uid].storage) < 1 then
player:setStorageValue(tp_pads[item.uid].storage, 1)
player:say("Spot unlocked.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
end
end
if player:isPzLocked() then
player:teleportTo(fromPosition)
player:say("The pad is not responding.", TALKTYPE_ORANGE_1, true, player, player:getPosition())
else
local padWindow = ModalWindow(1860, "Teleport", "Select destination:")
for i = 8301, 8305 do
if i ~= item.uid then
if tp_pads[i].price then
if tp_pads[i].storage then
if player:getStorageValue(tp_pads[i].storage) > 0 then
padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
end
else
padWindow:addChoice(i - 8300, tp_pads[i].name .. (tp_pads[i].price > 0 and " [" .. tp_pads[i].price .. " gold]" or ""))
end
else
if tp_pads[i].storage then
if player:getStorageValue(tp_pads[i].storage) > 0 then
padWindow:addChoice(i - 8300, tp_pads[i].name)
end
else
padWindow:addChoice(i - 8300, tp_pads[i].name)
end
end
end
end
padWindow:addButton(1, "Select")
padWindow:addButton(2, "Cancel")
padWindow:setDefaultEnterButton(1)
padWindow:setDefaultEscapeButton(2)
padWindow:sendToPlayer(player)
end
return true
end
i dont know whats going on im not pro in TFS scripting but i dont see any errors in lua scrip, how can i repair it?