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

TFS 1.X+ Fire stairs nil error

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, i try make fire stairs if we have fire boots we got teleport to X pos but if we dont have we can't stand on stairs, i have script but working only if we have boots we got teleport, if we dont have boots stairs working like normal stairs ;/

Code:
function onStepIn(cid, item, position, fromPosition)
local player = Player(cid)
local condition = Condition(CONDITION_FIRE)
local slotItem = player:getSlotItem(CONST_SLOT_FEET)
local firepos = Position(1175, 904, 7)
condition:setParameter(CONDITION_PARAM_TICKS, 5000)
    if slotItem:getId() == 9932 then
        player:teleportTo(firepos)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Ooo, it work!")
    else
        player:addCondition(condition)
        player:teleportTo(fromPosition, true)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Bruh bruh")
    end
    return true
end
 
Solution
Hi, i try make fire stairs if we have fire boots we got teleport to X pos but if we dont have we can't stand on stairs, i have script but working only if we have boots we got teleport, if we dont have boots stairs working like normal stairs ;/

Code:
function onStepIn(cid, item, position, fromPosition)
local player = Player(cid)
local condition = Condition(CONDITION_FIRE)
local slotItem = player:getSlotItem(CONST_SLOT_FEET)
local firepos = Position(1175, 904, 7)
condition:setParameter(CONDITION_PARAM_TICKS, 5000)
    if slotItem:getId() == 9932 then
        player:teleportTo(firepos)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Ooo, it work!")
    else
        player:addCondition(condition)...
Hi, i try make fire stairs if we have fire boots we got teleport to X pos but if we dont have we can't stand on stairs, i have script but working only if we have boots we got teleport, if we dont have boots stairs working like normal stairs ;/

Code:
function onStepIn(cid, item, position, fromPosition)
local player = Player(cid)
local condition = Condition(CONDITION_FIRE)
local slotItem = player:getSlotItem(CONST_SLOT_FEET)
local firepos = Position(1175, 904, 7)
condition:setParameter(CONDITION_PARAM_TICKS, 5000)
    if slotItem:getId() == 9932 then
        player:teleportTo(firepos)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Ooo, it work!")
    else
        player:addCondition(condition)
        player:teleportTo(fromPosition, true)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Bruh bruh")
    end
    return true
end
Should check the console for errors.
I can almost guarantee you are a getting a nil value error.

Try this.
Lua:
local firepos = Position(1175, 904, 7)

local condition = Condition(CONDITION_FIRE)
condition:setParameter(CONDITION_PARAM_TICKS, 5000)

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end
    
    local slotItem = player:getSlotItem(CONST_SLOT_FEET)    
    if not slotItem or slotItem:getId() ~= 9932 then
        player:addCondition(condition)
        player:teleportTo(fromPosition, true)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Bruh bruh")
        return true
    end
    
    player:teleportTo(firepos)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Ooo, it work!")
    return true
end
 
Solution
Should check the console for errors.
I can almost guarantee you are a getting a nil value error.

Try this.
Lua:
local firepos = Position(1175, 904, 7)

local condition = Condition(CONDITION_FIRE)
condition:setParameter(CONDITION_PARAM_TICKS, 5000)

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not player then
        return true
    end
   
    local slotItem = player:getSlotItem(CONST_SLOT_FEET)   
    if not slotItem or slotItem:getId() ~= 9932 then
        player:addCondition(condition)
        player:teleportTo(fromPosition, true)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Bruh bruh")
        return true
    end
   
    player:teleportTo(firepos)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Ooo, it work!")
    return true
end
Thanks work, btw i say in topic name what i have xd "nil error"
 
Back
Top