• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Feyrist Entrance Error

d0gw4r

New Member
Joined
Jun 6, 2019
Messages
55
Solutions
1
Reaction score
4
Location
Brazil
Hi folks,

When I try to use one small ruby on a fire shrine nothing happens and the following error appears:

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/others/firefeyristentrada.lua:onUse
data/actions/scripts/others/firefeyristentrada.lua:3: attempt to index global 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/actions/scripts/others/firefeyristentrada.lua:3: in function <data/actions/scripts/others/firefeyristentrada.lua:1>


36812
 
Solution
LUA:
function onUse(creature, item, position, fromPosition, pos, target, toPosition)

if player:getStorageValue(Storage.Exaust.Time) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are exhausted.')
    return true
    end

    local player = creature:getPlayer()
    local tilepos1 = {x=32910, y=32339, z=15}
    local tilepos2 = {x=32911, y=32339, z=15}
    local tilepos3 = {x=32910, y=32338, z=15}
    local tilepos4 = {x=32911, y=32338, z=15}
    if not player then
        return
    end
    if player:getItemCount(2147) >= 1 and pos.x == tilepos1.x or pos.x == tilepos2.x and pos.y == tilepos1.y or pos.y == tilepos3.y and pos.z == tilepos1.z   then
        player:removeItem(2147, 1)...
Hi folks,

When I try to use one small ruby on a fire shrine nothing happens and the following error appears:

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/others/firefeyristentrada.lua:onUse
data/actions/scripts/others/firefeyristentrada.lua:3: attempt to index global 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/actions/scripts/others/firefeyristentrada.lua:3: in function <data/actions/scripts/others/firefeyristentrada.lua:1>


View attachment 36812
Send the script, maybe you did not instantiate the variable player.
 
Send the script, maybe you did not instantiate the variable player.

LUA:
function onUse(creature, item, position, fromPosition, pos, target, toPosition)

if player:getStorageValue(Storage.Exaust.Time) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are exhausted.')
    return true
    end

    local player = creature:getPlayer()
    local tilepos1 = {x=32910, y=32339, z=15}
    local tilepos2 = {x=32911, y=32339, z=15}
    local tilepos3 = {x=32910, y=32338, z=15}
    local tilepos4 = {x=32911, y=32338, z=15}
    if not player then
        return
    end
    if player:getItemCount(2147) >= 1 and pos.x == tilepos1.x or pos.x == tilepos2.x and pos.y == tilepos1.y or pos.y == tilepos3.y and pos.z == tilepos1.z   then
        player:removeItem(2147, 1)
        player:teleportTo(Position(33586,32263, 7))
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        return true    
    end
    player:setStorageValue(Storage.Exaust.Time, os.time())
    return true
end
 
LUA:
function onUse(creature, item, position, fromPosition, pos, target, toPosition)

if player:getStorageValue(Storage.Exaust.Time) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are exhausted.')
    return true
    end

    local player = creature:getPlayer()
    local tilepos1 = {x=32910, y=32339, z=15}
    local tilepos2 = {x=32911, y=32339, z=15}
    local tilepos3 = {x=32910, y=32338, z=15}
    local tilepos4 = {x=32911, y=32338, z=15}
    if not player then
        return
    end
    if player:getItemCount(2147) >= 1 and pos.x == tilepos1.x or pos.x == tilepos2.x and pos.y == tilepos1.y or pos.y == tilepos3.y and pos.z == tilepos1.z   then
        player:removeItem(2147, 1)
        player:teleportTo(Position(33586,32263, 7))
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        return true  
    end
    player:setStorageValue(Storage.Exaust.Time, os.time())
    return true
end
Try now:
LUA:
function onUse(creature, item, position, fromPosition, pos, target, toPosition)
    local player = Player(creature)
    if not player then
        return false
    end
    if player:getStorageValue(Storage.Exaust.Time) >= os.time() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are exhausted.')
        return false
    end

    local tilepos1 = {x=32910, y=32339, z=15}
    local tilepos2 = {x=32911, y=32339, z=15}
    local tilepos3 = {x=32910, y=32338, z=15}
    local tilepos4 = {x=32911, y=32338, z=15}

    if player:getItemCount(2147) >= 1 and pos.x == tilepos1.x or pos.x == tilepos2.x and pos.y == tilepos1.y or pos.y == tilepos3.y and pos.z == tilepos1.z   then
        player:removeItem(2147, 1)
        player:teleportTo(Position(33586,32263, 7))
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    end
    player:setStorageValue(Storage.Exaust.Time, os.time())
    return true
end
 
Solution
LUA:
function onUse(creature, item, position, fromPosition, pos, target, toPosition)

if player:getStorageValue(Storage.Exaust.Time) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are exhausted.')
    return true
    end

    local player = creature:getPlayer()
    local tilepos1 = {x=32910, y=32339, z=15}
    local tilepos2 = {x=32911, y=32339, z=15}
    local tilepos3 = {x=32910, y=32338, z=15}
    local tilepos4 = {x=32911, y=32338, z=15}
    if not player then
        return
    end
    if player:getItemCount(2147) >= 1 and pos.x == tilepos1.x or pos.x == tilepos2.x and pos.y == tilepos1.y or pos.y == tilepos3.y and pos.z == tilepos1.z   then
        player:removeItem(2147, 1)
        player:teleportTo(Position(33586,32263, 7))
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        return true   
    end
    player:setStorageValue(Storage.Exaust.Time, os.time())
    return true
end
What u did wrong:
U declare the variable player in line 8 and use it in line 3 and 4, before it exist.
U have a return true in line 20 if it happens, u will not define the cooldown to player in line 22.
Glad it worked out.
 
Back
Top