Postado Janeiro 28, 2019 6 anos Olá.. Preciso de um NPC que libera o trade depois de ganhar certa storage... Alguém poderia fazer para mim, por favor? Editado Janeiro 28, 2019 6 anos por movie (veja o histórico de edições) Baiak Thunder New TFS Downgrade [TFS 1.5 - 8.60] Gesior Ferobra Downgrade Evento Monster Hunt [TFS 1.X] Evento SafeZone [TFS 1.X] Online Bonus System [TFS 1.X] Dodge & Critical [TFS 1.X] Nova moeda, funcionando com NPCs [TFS 1.X] Square System [TFS 1.X] Loot Channel [TFS 1.X] Gerenciador de Quests [All TFS] NPCs comprando vial/flasks por storage [TFS 1.X] AntiBot [TFS 1.X] Como compilar TFS 0.X
Postado Janeiro 28, 2019 6 anos local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local choose = {} local cancel = {} local available = {} local stor = 20979 -- storage que precisa local trade = { {id=7368, buy=100, sell=0, name='Assassin Star'}, --- itens que vai vender } local function setNewTradeTable(table) local items = {} for _, v in ipairs(table) do items[v.id] = {itemId = v.id, buyPrice = v.buy, sellPrice = v.sell, subType = 0, realName = v.name} end return items end local function setNewLineTable(oldTable, newTable) for k, v in pairs(oldTable) do table.insert(newTable, k, v) end return true end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local strtrade = 154171 if(msgcontains(msg, 'Trade') or msgcontains(msg, 'trade')) and getPlayerStorageValue(cid, strtrade) == 1 then selfSay('Its my offer!', cid) tradeRank = trade local items = setNewTradeTable(tradeRank) local function onBuy(cid, item, subType, amount, ignoreCap, inBackpacks) if items[item].buyPrice then doPlayerAddItem(cid, items[item].itemId, amount) doPlayerRemoveMoney(cid, items[item].buyPrice * amount) return true end return true end local function onSell(cid, item, subType, amount, ignoreCap, inBackpacks) if items[item].sellPrice then doPlayerAddMoney(cid, items[item].sellPrice * amount) doPlayerRemoveItem(cid, items[item].itemId, amount) return true end return true end openShopWindow(cid, tradeRank, onBuy, onSell) end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
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.