Ir para conteúdo

Featured Replies

Resolvido por Mateus Robeerto

Ir para solução
  • Respostas 6
  • Visualizações 414
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Mateus Robeerto
    Mateus Robeerto

    Claro aqui passo a passo.   Definir Variáveis:  Comece definindo as variáveis necessárias. Você precisará de uma variável para representar a duração do cooldown (em segundos) e outra variá

Postado

Caso tenha duvida de como instalar num script só mandar aqui que eu tento ajudar
 

   local exhaust = 5
    local storage = 5839

    if exhaustion.check(cid, storage) then
exhaustion.set(cid, storage, exhaust)
 

VlVKQKC.png&key=d5c17620ae9567a1f898dd7a

 

 

 

  • 532144234_Logo_NTO_BLOOD_Finish_HIM_By_Antonio_Luckas(3).png.fd58d1af125a7e82ccdd751637e9ca93.png
Postado
  • Autor

Entao mano, tentei adicionar aqui mas nao consegui... poderia explicar como instalar? é bom que ja pode solucionar a duvida de outras pessoas a respeito tambem. A proposito os principais comandos que eu gostaria de por exhausted sao:

 

Spoiler

local sellTable = {
[2498] = 40000,
[2475] = 6000,
[2491] = 5000,
[7402] = 5000,
[2462] = 4000,
[2663] = 500,
[2458] = 35,
[2459] = 30,
[2645] = 400000,
[2195] = 40000,
[2472] = 100000,
[2492] = 60000,
[2466] = 30000,
[2487] = 20000,
[2476] = 5000,
[2656] = 15000,
[2500] = 2500,
[2463] = 400,
[2465] = 200,
[2464] = 100,
[2470] = 80000,
[2488] = 15000,
[2477] = 6000,
[2647] = 500,
[2487] = 100,
[2514] = 80000,
[2520] = 40000,
[2534] = 25000,
[2536] = 8000,
[2537] = 4000,
[2519] = 5000,
[2528] = 4000,
[2515] = 200,
[2518] = 1500,
[2525] = 100,
[2390] = 150000,
[2408] = 100000,
[2400] = 90000,
[2393] = 10000,
[2407] = 6000,
[2396] = 4000,
[2392] = 3000,
[2409] = 1500,
[2383] = 800,
[2377] = 400,
[2413] = 70,
[2406] = 30,
[2376] = 25,
[2414] = 10000,
[2431] = 90000,
[2427] = 7500,
[2432] = 10000,
[2430] = 2000,
[2387] = 200,
[2381] = 200,
[2378] = 100,
[2388] = 20,
[2391] = 6000,
[2421] = 90000,
[2436] = 1000,
[2434] = 2000,
[2423] = 200,
[2417] = 60,
[2398] = 30,
}

function on_search_container(cid, uid)
local size = getContainerCap(uid)
for slot = (size - 1), 0, -1 do
    local item = getContainerItem(uid, slot)
    if item.uid > 0 then
        if sellTable[item.itemid] then
            doPlayerAddMoney(cid, sellTable[item.itemid])
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sold ".. getItemNameById(item.itemid) .." for ".. sellTable[item.itemid] .." gold.")
            doRemoveItem(item.uid, 1)
        elseif isContainer(item.uid) then
            on_search_container(cid, item.uid)
        end
    end
end
end

function onSay(cid, words, param, channel)
on_search_container(cid, getPlayerSlotItem(cid, CONST_SLOT_BACKPACK).uid)
return true
end

 

 

Spoiler

function onSay(cid, words, param)
   local exhaust = 5
    local storage = 5839

    if exhaustion.check(cid, storage) then
exhaustion.set(cid, storage, exhaust)

if doPlayerRemoveMoney(cid, 20) == TRUE then
local bp = doPlayerAddItem(cid, 1988, 1)
doSendMagicEffect(getCreaturePosition(cid),13)
doCreatureSay(cid, "Voce comprou uma backpack.", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "Voce nao tem dinheiro.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end

 

 

 

Postado
  • Solução

1: 

local cooldown = 10 -- Cooldown in seconds
local lastSearchTime = {}

local sellTable = {
    [2498] = 40000,
[2475] = 6000,
[2491] = 5000,
[7402] = 5000,
[2462] = 4000,
[2663] = 500,
[2458] = 35,
[2459] = 30,
[2645] = 400000,
[2195] = 40000,
[2472] = 100000,
[2492] = 60000,
[2466] = 30000,
[2487] = 20000,
[2476] = 5000,
[2656] = 15000,
[2500] = 2500,
[2463] = 400,
[2465] = 200,
[2464] = 100,
[2470] = 80000,
[2488] = 15000,
[2477] = 6000,
[2647] = 500,
[2487] = 100,
[2514] = 80000,
[2520] = 40000,
[2534] = 25000,
[2536] = 8000,
[2537] = 4000,
[2519] = 5000,
[2528] = 4000,
[2515] = 200,
[2518] = 1500,
[2525] = 100,
[2390] = 150000,
[2408] = 100000,
[2400] = 90000,
[2393] = 10000,
[2407] = 6000,
[2396] = 4000,
[2392] = 3000,
[2409] = 1500,
[2383] = 800,
[2377] = 400,
[2413] = 70,
[2406] = 30,
[2376] = 25,
[2414] = 10000,
[2431] = 90000,
[2427] = 7500,
[2432] = 10000,
[2430] = 2000,
[2387] = 200,
[2381] = 200,
[2378] = 100,
[2388] = 20,
[2391] = 6000,
[2421] = 90000,
[2436] = 1000,
[2434] = 2000,
[2423] = 200,
[2417] = 60,
[2398] = 30,
}

function on_search_container(cid, uid)
    local currentTime = os.time()
    local lastTime = lastSearchTime[cid] or 0
    
    if currentTime - lastTime < cooldown then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please wait before searching again.")
        return
    end
    
    lastSearchTime[cid] = currentTime
    
    local size = getContainerCap(uid)
    for slot = (size - 1), 0, -1 do
        local item = getContainerItem(uid, slot)
        if item.uid > 0 then
            if sellTable[item.itemid] then
                doPlayerAddMoney(cid, sellTable[item.itemid])
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sold ".. getItemNameById(item.itemid) .." for ".. sellTable[item.itemid] .." gold.")
                doRemoveItem(item.uid, 1)
            elseif isContainer(item.uid) then
                on_search_container(cid, item.uid)
            end
        end
    end
end

function onSay(cid, words, param, channel)
    on_search_container(cid, getPlayerSlotItem(cid, CONST_SLOT_BACKPACK).uid)
    return true
end

2:

local cooldown = 5 
local lastPurchaseTime = {}

function onSay(cid, words, param)
    local currentTime = os.time()
    local lastTime = lastPurchaseTime[cid] or 0
    
    if currentTime - lastTime < cooldown then
        doCreatureSay(cid, "Please wait before making another purchase.", TALKTYPE_ORANGE_1)
        return true
    end
    
    lastPurchaseTime[cid] = currentTime
    
    local cost = 20 
    
    if doPlayerRemoveMoney(cid, cost) == true then
        local bp = doPlayerAddItem(cid, 1988, 1)
        doSendMagicEffect(getCreaturePosition(cid), 13)
        doCreatureSay(cid, "You bought a backpack.", TALKTYPE_ORANGE_1)
    else
        doCreatureSay(cid, "You don't have enough money.", TALKTYPE_ORANGE_1)
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
    
    return true
end

Sobre cooldown e exaust, é a mesma coisa. Mas você pode usar normalmente.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo