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

How work set/get storagevalue?

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, someone can tell me how work player:setstoragevaule / player:getstoragevalue? I try add something like a access to new npc but after i use item still can't use the doors :/

item access:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    if player:getStorageValue(22222) < 1 then
    player:setStorageValue(22222, 1)
    player:say('$$$', TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
    Item(item.uid):remove(1)
else
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Posiadasz juz pozwolenie handlowe.")
    return true
end
end

doors
Code:
local handel_room = Position(1004, 990, 6)

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    if item.uniqueid == 2501 and player:getStorageValue(22222) >= 1
     then
        player:teleportTo(handel_room)
        fromPosition:sendMagicEffect(CONST_ME_BATS)
    else
        local position = player:getPosition()
        if position.y < fromPosition.y then
            fromPosition.y = fromPosition.y - 1
        else
            fromPosition.y = fromPosition.y + 1
        end
            fromPosition:sendMagicEffect(CONST_ME_POFF)
            player:sendCancelMessage('Nie posiadasz pozwolenia handlowego.')
    end

    return true
end
 
Solution
Hi, someone can tell me how work player:setstoragevaule / player:getstoragevalue? I try add something like a access to new npc but after i use item still can't use the doors :/

item access:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    if player:getStorageValue(22222) < 1 then
    player:setStorageValue(22222, 1)
    player:say('$$$', TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
    Item(item.uid):remove(1)
else
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Posiadasz juz pozwolenie handlowe.")
    return true
end
end

doors
Code:
local handel_room = Position(1004, 990, 6)

function onUse(cid, item, fromPosition, itemEx...
Hi, someone can tell me how work player:setstoragevaule / player:getstoragevalue? I try add something like a access to new npc but after i use item still can't use the doors :/

item access:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    if player:getStorageValue(22222) < 1 then
    player:setStorageValue(22222, 1)
    player:say('$$$', TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
    Item(item.uid):remove(1)
else
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Posiadasz juz pozwolenie handlowe.")
    return true
end
end

doors
Code:
local handel_room = Position(1004, 990, 6)

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    if item.uniqueid == 2501 and player:getStorageValue(22222) >= 1
     then
        player:teleportTo(handel_room)
        fromPosition:sendMagicEffect(CONST_ME_BATS)
    else
        local position = player:getPosition()
        if position.y < fromPosition.y then
            fromPosition.y = fromPosition.y - 1
        else
            fromPosition.y = fromPosition.y + 1
        end
            fromPosition:sendMagicEffect(CONST_ME_POFF)
            player:sendCancelMessage('Nie posiadasz pozwolenia handlowego.')
    end

    return true
end
google.com -> write -> "otland storages how to"... 5 sec work and first search result...
[Lua] Understanding Storages (https://otland.net/threads/lua-understanding-storages.189075/)
 
Solution
Back
Top