Postado Setembro 12, 2021 3 anos Good morning tibiaking community, could you help me with a npc I need to sell the items x items not for money,and add how many loads the item will have when selling it, it only appears with one. excuse me, my english is terrible. I add the npc local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 shopWindow = {} local keys = { {id = 7869, buy = 500, name = "knight sword training ", actionid = 1443}, {id = 7880, buy = 200, name = "knight club training ", actionid = 1443}, {id = 7875, buy = 500, name = "knight axe training ", actionid = 1443}, {id = 7864, buy = 500, name = "Paladin training ", actionid = 1443}, {id = 7773, buy = 500, name = "Druid training ", actionid = 1443}, {id = 7754, buy = 500, name = "Sorcerer training ", actionid = 1443}, } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if doPlayerRemoveMoney(cid, shopWindow[item].Price) then local thing = doPlayerAddItem(cid, shopWindow[item].ID, 1) doItemSetAttribute(thing, 'aid', shopWindow[item].Actionid) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a "..shopWindow[item].KeyName.." for "..shopWindow[item].Price.." gold.") else selfSay("You don't have enough money.", cid) end return true end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end if msgcontains(msg, 'trade') then for var, item in pairs(keys) do shopWindow[item.id] = {ID = item.id, Price = item.buy, KeyName = item.name, Actionid = item.actionid} end openShopWindow(cid, keys, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Setembro 12, 2021 3 anos Este tópico foi movido para a seção de Suporte Otserv. Have no idea! freelance? go to my discord: sun#8860
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.