• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua NPC Seller error

_Aion_

Nothing Else
Joined
Jan 19, 2010
Messages
401
Solutions
4
Reaction score
10
Location
Jequie,Bahia,Brazil
Hello.
Someone can know fix a old problem for "trade system" bug, if item buyable are "copy" from another?
EX: I have AOL on my server, i opened itemeditor and copy "skin" from AOL, generating new AOL with another ID but same skin from old...
i have this issue, many itens from my server are new and npc cant sell

how fix?

I'm using TFS 0.3.7 for 8.60
Here one script that give this issue.
LUA:
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
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 shopWindow = {}
local t = {
          --LOW
      [12636] = {price = 10},
      [12637] = {price = 10},
      [12638] = {price = 10},
      [12639] = {price = 10},
      [12640] = {price = 10},
      [12697] = {price = 10},
      [12748] = {price = 15},
      [12749] = {price = 15},
      [12750] = {price = 15},
      [12751] = {price = 15},
             --HIGH
      [12641] = {price = 20},
      [12642] = {price = 20},
      [12643] = {price = 20},
      [12644] = {price = 20},
      [12645] = {price = 20},
      [12698] = {price = 20},
      [12752] = {price = 30},
      [12753] = {price = 30},
      [12754] = {price = 30},
      [12755] = {price = 30},
     
              --OUTROS
      [12695] = {price = 1},
      [164] = {price = 10},
      [113] = {price = 5},
      [127] = {price = 2},
      [116] = {price = 10},
     
     
            }
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
        if  t[item] and doPlayerRemoveItem(cid, 12696, t[item].price)  then
                doPlayerAddItem(cid, item)
                doPlayerRemoveItem(cid, 12696, t[item].price)
                selfSay("Aqui o seu item", cid)
                else
                selfSay("Você não tem "..t[item].price.." 4Fun Diamond's", cid)
          end
        return true
end
if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
                        for var, ret in pairs(t) do
                                        table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)})
                                end
                        openShopWindow(cid, shopWindow, onBuy, onSell)
                end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top