• 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.4 Some edits in script

Marko999x

ArchezOt soon
Premium User
Joined
Dec 14, 2017
Messages
3,976
Solutions
104
Reaction score
3,108
Location
Germany
Hello otland I have just found a script for tfs 0.4 but I need help with 2 stuff...

1. is it possible to add there a exhaust for using?

2. it seems like the % system does not work as it should? I just did put 1 there but im always possible to get a scarb coins for some reasons

here the script ( tfs 0.4 )

LUA:
local t = {
    chance = 1 -- 25%
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == 10700 then
        if t.chance <= math.random(1, 10) then
            doPlayerAddItem(cid, 2159, math.random(1, 10))
          --  doRemoveItem(itemEx.uid, 1)
            doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
        else
            doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
    end
  
    return true
end
 
Solution
LUA:
local t = {
    chance = 1, -- 10%
    exhaust_storage = 4539,
    exhaust_time = 2 -- seconds
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getCreatureStorage(cid, t.exhaust_storage) < os.time() then
        if itemEx.itemid == 10700 then
            doCreatureSetStorage(cid, t.exhaust_storage, os.time() + t.exhaust_time)
            if math.random(1, 10) <= t.chance then
                doPlayerAddItem(cid, 2159, math.random(1, 10))
                --  doRemoveItem(itemEx.uid, 1)
                doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
            else
                doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
            end
        else
            doPlayerSendTextMessage(cid...
LUA:
local t = {
    chance = 1, -- 10%
    exhaust_storage = 4539,
    exhaust_time = 2 -- seconds
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getCreatureStorage(cid, t.exhaust_storage) < os.time() then
        if itemEx.itemid == 10700 then
            doCreatureSetStorage(cid, t.exhaust_storage, os.time() + t.exhaust_time)
            if math.random(1, 10) <= t.chance then
                doPlayerAddItem(cid, 2159, math.random(1, 10))
                --  doRemoveItem(itemEx.uid, 1)
                doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
            else
                doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
        end
    else
        doPlayerSendCancel(cid, "You can't mine this yet, wait another "..getCreatureStorage(cid, t.exhaust_storage) - os.time().." seconds")
    end

    return true
end
 
Last edited:
Solution
LUA:
local t = {
    chance = 1 -- 10%
    exhaust_storage = 4539
    exhaust_time = 2 -- seconds
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getCreatureStorage(cid, t.exhaust_storage) < os.time() then
        if itemEx.itemid == 10700 then
            doCreatureSetStorage(cid, t.exhaust_storage, os.time() + t.exhaust_time)
            if math.random(1, 10) <= t.chance then
                doPlayerAddItem(cid, 2159, math.random(1, 10))
                --  doRemoveItem(itemEx.uid, 1)
                doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
            else
                doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
        end
    else
        doPlayerSendCancel(cid, "You can't mine this yet, wait another "..getCreatureStorage(cid, t.exhaust_storage) - os.time().." seconds")
    end

    return true
end


Yo I get this error

6f4a61ae4b22c301b8d6422cc07617bd.png

Screenshot - 6f4a61ae4b22c301b8d6422cc07617bd - Gyazo
 
Back
Top