• 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!

Lua onEquip keep doing effect (hearts)

Yup, that's a good start, but i see there's a "exhaustion" which doesn't exist in tfs 1.0 i believe :eek: (or i might be wrong).

--edit
or no, i've found there is an function named exhaustion, i think i might do it now :), if not im gonna call for help then ;p
 
It will be fine, i just don't know in what format does exhaustion saves, is it seconds or something else. Below is function for that.

PHP:
exhaustion =
{
        check = function (cid, storage)
                return getPlayerStorageValue(cid, storage) >= os.time(t)
        end,
        get = function (cid, storage)
                local exhaust = getPlayerStorageValue(cid, storage)
                if(exhaust > 0) then
                        local left = exhaust - os.time(t)
                        if(left >= 0) then
                                return left
                        end
                end
                return false
        end,
        set = function (cid, storage, time)
                setPlayerStorageValue(cid, storage, os.time(t) + time)
        end,
        make = function (cid, storage, time)
                local exhaust = exhaustion.get(cid, storage)
                if(not exhaust) then
                        exhaustion.set(cid, storage, time)
                        return true
                end
                return false
        end
}

That's what i found in LUA manual, but i'm not sure if this is it.

To produce a date table, we use the format string "*t". For instance, the following code

temp = os.date("*t", 906000490)

produces the table
{year = 1998, month = 9, day = 16, yday = 259, wday = 4,
hour = 23, min = 48, sec = 10, isdst = false}
 
bump
this is what i've got so far, but not working ;s

PHP:
function onEquip(cid, item, slot)

    local exhaustionStoragesweetheart = 48231
    local exhaustionDelay = 3

    if exhaustion.check(cid, exhaustionStoragesweetheart) then
        return true
    end

    if slot.itemid == item then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
        exhaustion.set(cid, exhaustionStoragesweetheart, exhaustionDelay)
    end

    return true
end
 
Back
Top