• 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 [ACTION] Needed exhausted for script

middley

Member
Joined
Oct 2, 2019
Messages
50
Reaction score
6
Good morning everyone, I need help adding exhaustion to my fishing script.
So that the fishing rod can be used every second.

Script :
LUA:
local config = {
    [1] = {item = {2146, 1}, chance = 5000, fishing = 0, quest = {enable = false, storage = nil}},        -- nieb klejnot 1
    [2] = {item = {2149, 1}, chance = 3000, fishing = 0, quest = {enable = false, storage = nil}},    -- ziel klejnot 3
    [3] = {item = {2147, 1}, chance = 4000, fishing = 0, quest = {enable = false, storage = nil}},        -- czerw klejnot 2
    [4] = {item = {2150, 1}, chance = 2000, fishing = 0, quest = {enable = false, storage = nil}},        -- fiol klejnot 4
    [5] = {item = {2667, 1}, chance = 20000, fishing = 0, quest = {enable = false, storage = nil}},        -- ryba smiec
    [6] = {item = {2669, 1}, chance = 10000, fishing = 0, quest = {enable = false, storage = nil}},    -- ryba smiec 2
    [7] = {item = {1951, 1}, chance = 1000, fishing = 0, quest = {enable = false, storage = nil}},        -- scroll fishing
    [8] = {item = {1949, 1}, chance = 500, fishing = 0, quest = {enable = false, storage = nil}},        -- exp scroll

    [9] = {item = {6096, 1}, chance = 500, fishing = 0, quest = {enable = true, storage = 14900}},        -- pirate hat 0,05%
    [10] = {item = {5917, 1}, chance = 3500, fishing = 0, quest = {enable = true, storage = 14900}},    -- bandana 0,35%
    [11] = {item = {5918, 1}, chance = 1000, fishing = 0, quest = {enable = true, storage = 14900}},    -- pirate knee breeches 0,1%
    [12] = {item = {5462, 1}, chance = 1000, fishing = 0, quest = {enable = true, storage = 14900}},    -- pirate boots 0,1%
    [13] = {item = {2009, 1}, chance = 450, fishing = 0, quest = {enable = true, storage = 14900}},        -- green flask 0,045%

    [14] = {item = {ITEM_WORM, 1}, chance = 50000, fishing = 0, quest = {enable = false, storage = nil}}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local playerFishing = getPlayerSkill(cid, SKILL_FISHING)

    local now
    for i = 1, #config do
        if (config[i].chance > math.random(1, 100000)) then
            now = config[i]
            break
        end
    end

if not now then
        doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
        setPlayerStorageValue(cid, 2702, kk)
        doPlayerRemoveItem(cid, ITEM_WORM, 1)
        return true
end

    if(itemEx.itemid >= 4608 and itemEx.itemid <= 4625 or itemEx.itemid == 493)  then
        if(math.random(1, (100 + (playerFishing / 10))) <= playerFishing) then
            if getPlayerItemCount(cid, ITEM_WORM) > 0 then
                if(playerFishing >= now.fishing) then
                    if(now.quest.enable) then
                        if(getPlayerStorageValue(cid, now.quest.storage) < 0) then
                            doPlayerAddItem(cid, now.item[1], now.item[2])
                            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Udalo ci sie zlowic : "..getItemNameById(now.item[1]).."!")
                        else
                            doPlayerAddItem(cid, ITEM_FISH, 1)
                            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Udalo ci sie zlowic rybe!")
                        end
                    else
                        doPlayerAddItem(cid, now.item[1], now.item[2])
                        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Udalo ci sie zlowic : "..getItemNameById(now.item[1]).."!")
                    end
                else
                    doPlayerAddItem(cid, ITEM_FISH, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Udalo ci sie zlowic rybe!")
                end
            end
                doPlayerAddSkillTry(cid, SKILL_FISHING, 0)
        end
        doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
        doPlayerRemoveItem(cid, ITEM_WORM, 1)
    end
    return true
end

thanks for any help
 
above onUse
LUA:
local exhaust = {}
under onUse
LUA:
local currentTime = os.mtime()
if exhaust[cid] and exhaust[cid] > currentTime then
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    return true
end
exhaust[cid] = currentTime + 1000
 
Back
Top