• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 0.X item give mana per second if we have storage

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

Thanks
 
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

But where i can set id of item? I want blockade regeneration by STORAGE and ID ITEM
 
movements, in the script Equip
LUA:
setPlayerStorageValue(cid, 12346, 1)

DeEquip
LUA:
setPlayerStorageValue(cid, 12346, -1)
 
movements, in the script Equip
LUA:
setPlayerStorageValue(cid, 12346, 1)

DeEquip
LUA:
setPlayerStorageValue(cid, 12346, -1)

But my item can get all players and i want enabel regeneration if they have XX storage but WITH ITEM (yea i know my english suck)
 
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
 
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

Not work for me ;/

Code:
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
 
Back
Top