Majster12
Member
- Joined
- Feb 20, 2009
- Messages
- 134
- Solutions
- 1
- Reaction score
- 16
Use of this amulet gives random 1000 Hit Points or 1000 Mana Points. It has 1h cooldown. Note: You have to be online and have equipped the amulet. Also it recharges if you leave at home
I'ts even possible to remove storage when you leave item at home?
Also no errors in console but don't work as it should.
Code:
local config = {
time = 1,
storage = 200011
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(config.storage) >= os.time() then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You need to wait 1 more hour before using it.")
return true
end
player:setStorageValue(config.storage, os.time() + config.time * 3600)
if getPlayerSlotItem(cid, CONST_SLOT_AMULET).itemid == 25423 then
local chance = math.random(1, 2)
if chance == 1 then
doCreatureAddHealth(cid, 1000)
item:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
else
doCreatureAddMana(cid, 1000)
item:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
return true
end
end