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

addEvent setStorageValue won't work when player logs out

namco

Alienbutserious
Joined
Sep 5, 2010
Messages
148
Solutions
2
Reaction score
38
I need some help, please.

When the player logs out, the Storage won't turn back to its normal state because the addEvent won't trigger.

What should I do?

Lua:
showWayshrine = MoveEvent()

local function cooldown(playerId)
    
    local player = Player(playerId)
    
    if not player then
        return
    end
    
    player:setStorageValue(1000, 0)
    
end

function showWayshrine.onStepIn(creature, item, position, fromPosition)
    
    local player = Player(creature:getId())
    local wayshrinePosition = Position(966, 958, 7)

    if not creature:isPlayer() then
        return true
    end

    if player:getStorageValue(1000) == 1 then
        return true
    end

    wayshrinePosition:sendMagicEffect(56)
    wayshrinePosition:sendMagicEffect(57)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Right-click the stone pillar to use the wayshrine.")
    addEvent(cooldown, 10000, player:getId())
    return true

end

showWayshrine:aid(1000)
showWayshrine:register()
 
@Infernum thanks! It worked.

creaturescripts/scripts/logout.lua

Code:
function onLogout(player)
    local playerId = player:getId()
    if nextUseStaminaTime[playerId] then
        nextUseStaminaTime[playerId] = nil
    end
    player:setStorageValue(1000, 0)
    return true
end
 
Back
Top