vexler222
Active Member
- Joined
- Apr 22, 2012
- Messages
- 714
- Solutions
- 15
- Reaction score
- 47
Hi, i make amulet, she give me mana per second if i have X storage, and it work 100% but if player dont have amulet in necle slot but he have storage, i got many errors like null value, cuz he dont have X amulet in slot
Nvm i fix it
Code:
function onThink(cid, interval)
local time = 1
local player = Player(cid)
if last_interval == nil then last_interval = os.clock() end
if player:getStorageValue(12346) == 1 and player:getSlotItem(CONST_SLOT_NECKLACE).itemid == 12683 then
local mp = player:getMaxMana() * (1.0 / 100)
if (os.clock() - last_interval) > time then
if player:getMana() < player:getMaxMana() then
if mp >= 1 then
player:addMana(mp)
end
end
last_interval = os.clock()
end
end
return true
end
Post automatically merged:
Nvm i fix it
Last edited: