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

Solved whacking driller of fate time problem

arti1194

New Member
Joined
Jun 6, 2009
Messages
96
Reaction score
3
Hi everyone. I have this script from
HTML:
https://otland.net/threads/tool-gear-sgog-ssoe-wdof.72798/
everything working fine but time jammed is in minute I want time in second.
TFS 0.4 rev. 3777

Code:
local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local value = getPlayerStorageValue(cid, 10)
    if(value ~= -1 and os.clock()-value < 60)then
        doPlayerSay(cid, "The tool jammed. Please wait " .. 60-math.floor(os.clock()-value) .. " seconds before using it again.", TALKTYPE_MONSTER)
        return TRUE
    end
    if(math.random(1, 10) == 1)then
        setPlayerStorageValue(cid, 10, os.clock())
        doPlayerSay(cid, "The tool jammed. Please wait 60 seconds before using it again.", TALKTYPE_MONSTER)
        return TRUE
    end
    -- Shovel
    if isInArray(holes, itemEx.itemid) == TRUE then
        doTransformItem(itemEx.uid, itemEx.itemid + 1)
        doDecayItem(itemEx.uid)
        return FALSE
    -- Rope
    elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
        return FALSE
    end

    local groundTile = getThingfromPos(toPosition)
    if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
        doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
    elseif isInArray(holeId, itemEx.itemid) == TRUE then
        local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
        if hole.itemid > 0 then
            doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
        else
            doPlayerSendCancel(cid, "Sorry, not possible.")
        end
        return FALSE
    -- Pick
    elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
        doTransformItem(itemEx.uid, 392)
        doDecayItem(itemEx.uid)
        return TRUE
    elseif itemEx.uid == 60001 then
        doTeleportThing(cid, {x=329, y=772, z=10})
        doSendMagicEffect({x=329, y=772, z=10},10)
        return TRUE
    -- Machete
    elseif itemEx.itemid == 2782 then
        doTransformItem(itemEx.uid, 2781)
        doDecayItem(itemEx.uid)
        return TRUE
    elseif itemEx.itemid == 1499 then
        doRemoveItem(itemEx.uid)
        return TRUE
    -- Scythe
    elseif itemEx.itemid == 2739 then
        doTransformItem(itemEx.uid, 2737)
        doCreateItem(2694, 1, toPosition)
        doDecayItem(itemEx.uid)
        return TRUE
    end
    return destroyItem(cid, itemEx, toPosition)
end


THX
 
Code:
if(value ~= -1 and os.clock()-value < 60/1000)then
One time work One time "The tool jammed. Please wait 60 seconds before using it again." 60 not decreasing
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     local value = getPlayerStorageValue(cid, 10)
     if(value ~= -1 and os.clock()-value < 2)then
         doPlayerSay(cid, "The tool jammed. Please wait " .. 2-math.floor(os.clock()-value) .. " seconds before using it again.", TALKTYPE_MONSTER)
         return TRUE
     end
     if(math.random(1, 10) == 1)then
         setPlayerStorageValue(cid, 10, os.clock())
         doPlayerSay(cid, "The tool jammed. Please wait 2 seconds before using it again.", TALKTYPE_MONSTER)
         return TRUE
     end
 
Few time cut grass but when jammed then: "The tool jammed. Please wait 2 seconds before using it again." and not working again.
 
Few time cut grass but when jammed then: "The tool jammed. Please wait 2 seconds before using it again." and not working again.
What do you mean it doesn't work again?
Can you upload a short video or .gif to show the issue?
 
Instead of this.
Code:
if(value ~= -1 and os.clock()-value < 2)then
Try this.
Code:
local current_time = os.clock()
if value ~= -1 and value + 2 < current_time then

Not working:


When I try this:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local value = getPlayerStorageValue(cid, 10)
    if(value ~= -1 and os.clock()-value < 1)then
        doPlayerSay(cid, "The tool jammed. Please wait " .. 1-math.floor(os.clock()-value) .. " seconds before using it again.", TALKTYPE_MONSTER)
        return TRUE
    end
    if(math.random(1, 10) == 1)then
        setPlayerStorageValue(cid, 10, os.clock())
        doPlayerSay(cid, "The tool jammed. Please wait 1 seconds before using it again.", TALKTYPE_MONSTER)
        return TRUE
    end

Then Whacking driler of fate jammed for 1 minute but text which show on screen is always: "The tool jammed. Please wait 1 seconds before using it again."
 
Last edited:
Back
Top