Postado Julho 8, 2020 5 anos Solução @leozincorsair Para source 0.4 Para source 0.3.6 vou passar como esta no meu Data/Npc/Lib/npcsystem/npchandler.lua Procure por: -- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback. logo abaixo vai ter as funções de compra e venda gerais de todo o sistema ai eu adicionei um cooldown nas duas código completo V Spoiler function NpcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks) local config = { cooldown = 3, --- tempo entre um uso e outro } if os.time() - getPlayerStorageValue(cid, 11246) >= config.cooldown then setPlayerStorageValue(cid, 11246, os.time()) 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 else doPlayerSendCancel(cid, "Espere "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 11246))).." segundo para comprar novamente.") end end -- Handles onSell events. If you wish to handle this yourself, use the CALLBACK_ONSELL callback. function NpcHandler:onSell(cid, itemid, subType, amount, ignoreCap, inBackpacks) local config = { cooldown = 3, --- tempo entre um uso e outro } if os.time() - getPlayerStorageValue(cid, 11246) >= config.cooldown then setPlayerStorageValue(cid, 11246, os.time()) local callback = self:getCallback(CALLBACK_ONSELL) if(callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks)) then if(self:processModuleCallback(CALLBACK_ONSELL, cid, itemid, subType, amount, ignoreCap, inBackpacks)) then -- end end else doPlayerSendCancel(cid, "Espere "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 11246))).." segundo para vender novamente.") end end Projeto ATS (Naruto)Informações AbaixoFacebookYoutubeDiscord Tutoriais / ConteúdosClique Aqui
Postado Julho 8, 2020 5 anos Autor 20 minutos atrás, LeoTK disse: @leozincorsair Para source 0.4 Para source 0.3.6 vou passar como esta no meu Data/Npc/Lib/npcsystem/npchandler.lua Procure por: -- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback. logo abaixo vai ter as funções de compra e venda gerais de todo o sistema ai eu adicionei um cooldown nas duas código completo V Mostrar conteúdo oculto function NpcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks) local config = { cooldown = 3, --- tempo entre um uso e outro } if os.time() - getPlayerStorageValue(cid, 11246) >= config.cooldown then setPlayerStorageValue(cid, 11246, os.time()) 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 else doPlayerSendCancel(cid, "Espere "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 11246))).." segundo para comprar novamente.") end end -- Handles onSell events. If you wish to handle this yourself, use the CALLBACK_ONSELL callback. function NpcHandler:onSell(cid, itemid, subType, amount, ignoreCap, inBackpacks) local config = { cooldown = 3, --- tempo entre um uso e outro } if os.time() - getPlayerStorageValue(cid, 11246) >= config.cooldown then setPlayerStorageValue(cid, 11246, os.time()) local callback = self:getCallback(CALLBACK_ONSELL) if(callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks)) then if(self:processModuleCallback(CALLBACK_ONSELL, cid, itemid, subType, amount, ignoreCap, inBackpacks)) then -- end end else doPlayerSendCancel(cid, "Espere "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 11246))).." segundo para vender novamente.") end end Me ajudou muito man, obrigado !!! o meu so tinha exausted na onbuy.
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.