• 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 Delay on buying container

kaiquefb

New Member
Joined
Feb 18, 2010
Messages
62
Reaction score
0
Hello friends.

I have a problem, can someone help me?
I need to put delay when the player will buy Some items (Runes, Parcel, Potions).

I need you to click when to buy have a delay of about 3 seconds', to then be able to buy again.

I have a code that a friend of mine now, most have no idea where to place or if it is WHAT I'm looking for.

follows the code.
Container* container = item->getContainer();
if (container && container->getItemHoldingCount() + 1 > 5000) {
return false;
}
 
-- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
function NpcHandler: onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
local callback = self:getCallback(CALLBACK_ONBUY)
if callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks) then
if self: processModuleCallback(CALLBACK_ONBUY, cid, itemid, subType, amount, ignoreCap, inBackpacks) then

--
end
end
end

Can you help me edit?
 
Code:
    -- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
    function NpcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
        local player = Player(cid)
        if player:getStorageValue(1000) > os.time() then
            return false
        end

        player:setStorageValue(1000, os.time() + 3)
        local callback = self:getCallback(CALLBACK_ONBUY)
        if callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks) then
            if self:processModuleCallback(CALLBACK_ONBUY, cid, itemid, subType, amount, ignoreCap, inBackpacks) then
                --
            end
        end
    end
 
Back
Top