Darqneez
ShaC-Ohhhh
Hello, I've made script for npc which sells and buys goods from players, but npc only buys goods he cant sell anything. Please fix it, here's npc script:
and here's server error:
I'll rep for help 
Code:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addSellableItem({'black pearl'}, 2144, 300, 'black pearl')
shopModule:addSellableItem({'white pearl'}, 2143, 200, 'white pearl')
shopModule:addSellableItem({'talon'}, 2151, 400, 'talon')
shopModule:addSellableItem({'small topaz'}, 9970, 200, 'small topaz')
shopModule:addSellableItem({'small sapphire'}, 2146, 250, 'small sapphire')
shopModule:addSellableItem({'small ruby'}, 2147, 250, 'small suby')
shopModule:addSellableItem({'small emerald'}, 2149, 250, 'small smerald')
shopModule:addSellableItem({'small diamond'}, 2145, 300, 'small siamond')
shopModule:addSellableItem({'small amethyst'}, 2150, 200, 'small amethyst')
shopModule:addSellableItem({'scarab coin'}, 2159, 1000, 'scarab coin')
shopModule:addSellableItem({'gold ingot'}, 9971, 5000, 'gold ingot')
shopModule:addSellableItem({'platinum amulet'}, 2171, 2500, 'platinum amulet')
shopModule:addSellableItem({'amulet of loss'}, 2173, 45000, 'amulet of loss')
shopModule:addSellableItem({'demonbone amulet'}, 2136, 32000, 'demonbone amulet')
shopModule:addSellableItem({'magma amulet'}, 7890, 1500, 'magma amulet')
shopModule:addSellableItem({'glacier amulet'}, 7888, 1500, 'glacier amulet')
shopModule:addSellableItem({'lightning pendant'}, 7889, 1500, 'lightning pendant')
shopModule:addSellableItem({'terra amulet'}, 7887, 1500, 'terra amulet')
shopModule:addSellableItem({'ring of the sky'}, 2123, 30000, 'ring of the sky')
shopModule:addSellableItem({'death ring'}, 6300, 1000, 'death ring')
shopModule:addBuyableItem({'stealth ring'}, 2165, 5000, 'stealth ring')
shopModule:addBuyableItem({'time ring'}, 2169, 2000, 'time ring')
shopModule:addBuyableItem({'wedding ring'}, 2121, 50000, 'wedding ring')
npcHandler:addModule(FocusModule:new())
Code:
[21/08/2010 12:49:31] [Error - Npc interface]
[21/08/2010 12:49:31] (Unknown script file)
[21/08/2010 12:49:31] Description:
[21/08/2010 12:49:32] data/npc/lib/npcsystem/modules.lua:1151: bad argument #2 to 'error' (number expected, got string)
[21/08/2010 12:49:32] stack traceback:
[21/08/2010 12:49:32] [C]: in function 'error'
[21/08/2010 12:49:32] data/npc/lib/npcsystem/modules.lua:1151: in function 'callbackOnBuy'
[21/08/2010 12:49:32] data/npc/lib/npcsystem/npchandler.lua:263: in function 'processModuleCallback'
[21/08/2010 12:49:32] data/npc/lib/npcsystem/npchandler.lua:440: in function 'onBuy'
[21/08/2010 12:49:32] data/npc/lib/npcsystem/modules.lua:1292: in function <data/npc/lib/npcsystem/modules.lua:1291>