function onThink(cid, interval)
local time = 1
if last_interval == nil then last_interval = os.clock() end
if getPlayerStorageValue(cid, 12346) == 1 then
if isPlayer(cid) == true then
local mpheal = getPlayerMaxMana(cid) * (15.0 / 100) -- 15.0 percent mana
if (os.clock() - last_interval) > time then
if getPlayerMana(cid) < getPlayerMaxMana(cid) then
if mpheal >= 1 then
doPlayerAddMana(cid, mpheal)
end
end
last_interval= os.clock()
end
end
end
end
return true
end
creaturescripts
LUA:function onThink(cid, interval) local time = 1 if last_interval == nil then last_interval = os.clock() end if getPlayerStorageValue(cid, 12346) == 1 then if isPlayer(cid) == true then local mpheal = getPlayerMaxMana(cid) * (15.0 / 100) -- 15.0 percent mana if (os.clock() - last_interval) > time then if getPlayerMana(cid) < getPlayerMaxMana(cid) then if mpheal >= 1 then doPlayerAddMana(cid, mpheal) end end last_interval= os.clock() end end end end return true end
creaturescripts
LUA:function onThink(cid, interval) local time = 1 if last_interval == nil then last_interval = os.clock() end if getPlayerStorageValue(cid, 12346) == 1 then if isPlayer(cid) == true then local mpheal = getPlayerMaxMana(cid) * (15.0 / 100) -- 15.0 percent mana if (os.clock() - last_interval) > time then if getPlayerMana(cid) < getPlayerMaxMana(cid) then if mpheal >= 1 then doPlayerAddMana(cid, mpheal) end end last_interval= os.clock() end end end end return true end
movements, in the script Equip
LUA:setPlayerStorageValue(cid, 12346, 1)
DeEquip
LUA:setPlayerStorageValue(cid, 12346, -1)
function onThink(cid, interval)
local time = 1
local item_id = ?
local slot = ?
if last_interval == nil then last_interval = os.clock() end
if getPlayerStorageValue(cid, 12346) == 1 and getPlayerSlotItem(cid, slot).itemid == item_id then
if isPlayer(cid) == true then
local mpheal = getPlayerMaxMana(cid) * (15.0 / 100) -- 15.0 percent mana
if (os.clock() - last_interval) > time then
if getPlayerMana(cid) < getPlayerMaxMana(cid) then
if mpheal >= 1 then
doPlayerAddMana(cid, mpheal)
end
end
last_interval= os.clock()
end
end
end
end
return true
end
LUA:function onThink(cid, interval) local time = 1 local item_id = ? local slot = ? if last_interval == nil then last_interval = os.clock() end if getPlayerStorageValue(cid, 12346) == 1 and getPlayerSlotItem(cid, slot).itemid == item_id then if isPlayer(cid) == true then local mpheal = getPlayerMaxMana(cid) * (15.0 / 100) -- 15.0 percent mana if (os.clock() - last_interval) > time then if getPlayerMana(cid) < getPlayerMaxMana(cid) then if mpheal >= 1 then doPlayerAddMana(cid, mpheal) end end last_interval= os.clock() end end end end return true end
Slot can be:
CONST_SLOT_HEAD
CONST_SLOT_NECKLACE
CONST_SLOT_BACKPACK
CONST_SLOT_ARMOR
CONST_SLOT_RIGHT
CONST_SLOT_LEFT
CONST_SLOT_LEGS
CONST_SLOT_FEET
CONST_SLOT_RING
CONST_SLOT_AMMO
function onThink(cid, interval)
local time = 1
local item_id = 11258
local slot = CONST_SLOT_NECKLACE
function getPlayerResets(name)
return db.getResult("SELECT resets FROM players WHERE name="..db.escapeString(name)..""):getDataInt("resets")
end
if last_interval == nil then last_interval = os.clock() end
if getPlayerStorageValue(cid, 11599) == 1 and getPlayerSlotItem(cid, slot).itemid == item_id then
if isPlayer(cid) == true then
local mpheal = (65000 * getPlayerResets(getPlayerName(cid)))
if (os.clock() - last_interval) > time then
if getPlayerMana(cid) < getPlayerMaxMana(cid) or getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
if mpheal >= 1 then
doPlayerAddMana(cid, mpheal)
doCreatureAddHealth(cid, mpheal)
end
end
last_interval= os.clock()
end
end
end
return true
end