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

Lua Lua error.

therrax

Member
Joined
Jul 12, 2012
Messages
259
Solutions
1
Reaction score
8
TFS 1.0 client 10.41
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/citizen.lua:onStepIn
data/movements/scripts/citizen.lua:19: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        data/movements/scripts/citizen.lua:19: in function <data/movements/scripts/citizen.lua:18>
How i can fix that?
 
OP
OP
therrax

therrax

Member
Joined
Jul 12, 2012
Messages
259
Solutions
1
Reaction score
8
@Limos I fix first, but now
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/closingdoor.lua:onStepOut
data/movements/scripts/closingdoor.lua:2: attempt to call method 'getTile' (a nil value)
stack traceback:
        [C]: in function 'getTile'
        data/movements/scripts/closingdoor.lua:2: in function <data/movements/scripts/closingdoor.lua:1>
script
Code:
function onStepOut(cid, item, position, fromPosition)
    local tile = position:getTile()
    if tile:getCreatureCount() > 0 then
        return true
    end

    local newPosition = {x = position.x + 1, y = position.y, z = position.z}
    local query = Tile(newPosition):queryAdd(cid)
    if query ~= RETURNVALUE_NOERROR or query == RETURNVALUE_NOTENOUGHROOM then
        newPosition.x = newPosition.x - 1
        newPosition.y = newPosition.y + 1
        query = Tile(newPosition):queryAdd(cid)
    end
    if query == RETURNVALUE_NOERROR and query ~= RETURNVALUE_NOTENOUGHROOM then
        doRelocate(position, newPosition)
    end

    local i, tileItem, tileCount = 1, true, tile:getThingCount()
    while tileItem and i < tileCount do
        tileItem = tile:getThing(i)
        if tileItem and tileItem:getUniqueId() ~= item.uid and tileItem:getType():isMovable() then
            tileItem:remove()
        else
            i = i + 1
        end
    end

    Item(item.uid):transform(item.itemid - 1)
    return true
end
 
OP
OP
therrax

therrax

Member
Joined
Jul 12, 2012
Messages
259
Solutions
1
Reaction score
8
@Limos thank you;) I have one problem else:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/skull.lua:onUse
data/actions/scripts/skull.lua:12: attempt to call field 'executeQuery' (a nil value)
stack traceback:
        [C]: in function 'executeQuery'
        data/actions/scripts/skull.lua:12: in function <data/actions/scripts/skull.lua:1>
SCRIPT
Code:
function onUse(cid, item, frompos, item2, topos)
     
        local nonremskulls =  -- These are the skulls it cant remove. If player has any of these, the rune wont work.
{
        white = SKULL_WHITE
}

        if isInArray(nonremskulls, getPlayerSkullType(cid)) then
                doPlayerSendCancel(cid,"You can't remove this type of skull.")
                doSendMagicEffect(getPlayerPosition(cid),2)
        else
                db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
                doCreatureSetSkullType(cid,0)
                doPlayerSendTextMessage(cid,27,"Your frags & your skull have been removed, thanks for donating!")
                doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
                                doSendAnimatedText(getPlayerPosition(cid), "Removed!", 180)
                doRemoveItem(item.uid, 1)
                                doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))

        return TRUE
        end
end
 
OP
OP
therrax

therrax

Member
Joined
Jul 12, 2012
Messages
259
Solutions
1
Reaction score
8
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/tiles.lua:onStepIn
data/movements/scripts/tiles.lua:23: attempt to call method 'getTile' (a nil value)
stack traceback:
        [C]: in function 'getTile'
        data/movements/scripts/tiles.lua:23: in function <data/movements/scripts/tiles.lua:4>

awww one more! :/
Code:
local increasing = {[416] = 417, [426] = 425, [446] = 447, [3216] = 3217, [3202] = 3215, [11062] = 11063}
local decreasing = {[417] = 416, [425] = 426, [447] = 446, [3217] = 3216, [3215] = 3202, [11063] = 11062}

function onStepIn(cid, item, position, fromPosition)
    if not increasing[item.itemid] then
        return false
    end
    local player = Player(cid)
    if not player or player:isInGhostMode() then
        return false
    end
    Item(item.uid):transform(increasing[item.itemid])

    if item.actionid >= 1000 then
        if player:getLevel() < item.actionid - 1000 then
            player:teleportTo(fromPosition, false)
            position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
        end
        return true
    end

    if position:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
        local lookPos = player:getPosition()
        lookPos:getNextPosition(player:getDirection())
        local depotItem = lookPos:getTile():getItemByType(ITEM_TYPE_DEPOT)
        if depotItem ~= nil then
            local depotItems = player:getDepotChest(getDepotId(depotItem:getUniqueId()), true):getItemHoldingCount()
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Your depot contains " .. depotItems .. " item" .. (depotItems > 1 and "s." or "."))
            return true
        end
    end

    if item.actionid ~= 0 and player:getStorageValue(item.actionid) <= 0 then
        player:teleportTo(fromPosition, false)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
        return true
    end

    return true
end

function onStepOut(cid, item, position, fromPosition)
    if not decreasing[item.itemid] then
        return false
    end
    local player = Player(cid)
    if not player or player:isInGhostMode() then
        return false
    end
    Item(item.uid):transform(decreasing[item.itemid])

    return true
end
 

Ninja

Global Moderator
Staff member
Global Moderator
Joined
Apr 6, 2010
Messages
5,953
Solutions
34
Reaction score
1,586
Location
Sweden
Update your global/compat.lua

Code:
function Position.getTile(self)
    return Tile(self)
end
 

esigma94

Well-Known Member
Joined
Nov 1, 2009
Messages
108
Solutions
17
Reaction score
86
doc savage skull GIF by Warner Archive
 
Top