• 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!

getTileItemById

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
in tfs 4.0 i cannot use getTileItemById for what i can replace this function?

PHP:
local teleport = {
    [3103] = {action = 1, {x = 32861, y = 31061, z = 9}, {x = 32859, y = 31056, z = 9}},
    [3104] = {action = 0, {x = 32856, y = 31055, z = 9}},
    [3105] = {action = 1, {x = 32888, y = 31045, z = 9}, {x = 32894, y = 31044, z = 9}},
    [3106] = {action = 0, {x = 32894, y = 31046, z = 9}},
}

function onStepIn(cid, item, position, lastPosition)
    if(teleport[item.uid].action == 1) then
        if(getTileItemById(teleport[item.uid][3], 8303).uid > 0) then
            doRemoveItem(getTileItemById(teleport[item.uid][3], 8303).uid, 1)
            doTeleportThing(cid, teleport[item.uid][2])
            doSendMagicEffect(teleport[item.uid][2], CONST_ME_TELEPORT)
        else
            doTeleportThing(cid, lastPosition)
            doSendMagicEffect(lastPosition, CONST_ME_ENERGY)
            doCreatureSayWithRadius(cid, "You may not enter without a sacrifice of a energy soil.", TALKTYPE_ORANGE_1, 1, 1)
        end
    end
    return true
end

ERROR
PHP:
[Error - MoveEvents Interface]
data/movements/scripts/yalahar/demonTeleport.lua:onStepIn
Description:
attempt to index a nil value
stack traceback:
        [C]: in function 'getTileItemById'
        data/movements/scripts/yalahar/demonTeleport.lua:10: in function <data/m
ovements/scripts/yalahar/demonTeleport.lua:8>
 
Code:
if(getTileItemById(teleport[item.uid][2], 8303).uid > 0) then
  doRemoveItem(getTileItemById(teleport[item.uid][2], 8303).uid, 1)
  doTeleportThing(cid, teleport[item.uid][1])

Can you use code tags next time instead of php tags?
[ code] [ /code]
And it's better to write the correct server version, TFS 4.0 doesn't exist.
 
Back
Top