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:
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