when people buy items they also get 1 more then what they bought for example. if you buy 1 AOL then u get 2 AOL's in your BP. if you buy 5 Aol's then you get 6 in your BP. i dont get any errors in my console window. any idea what the problem could be?
this is what one of my NPC files look like
this is what one of my NPC files look like
Code:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'spellbook'}, 2175, 150)
shopModule:addBuyableItem({'magic lightwand'}, 2163, 400)
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1)
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1)
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1)
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1)
shopModule:addBuyableItem({'great health'}, 7591, 190, 1)
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1)
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1)
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1)
shopModule:addBuyableItem({'100x hmm'}, 2311, 1200, 100)--
shopModule:addBuyableItem({'100x gfb'}, 2304, 4500, 100)--
shopModule:addBuyableItem({'100x expl'}, 2313, 3040, 100)--
shopModule:addBuyableItem({'100x uh'}, 2273, 10000, 100)--
shopModule:addBuyableItem({'100x sd'}, 2268, 12000, 100)--
shopModule:addSellableItem({'normal potion flask'}, 7636, 5)
shopModule:addSellableItem({'strong potion flask'}, 7634, 10)
shopModule:addSellableItem({'great potion flask'}, 7635, 15)
shopModule:addBuyableItem({'instense healing'}, 2265, 95, 1)
shopModule:addBuyableItem({'ultimate healing'}, 2273, 175, 1)
shopModule:addBuyableItem({'magic wall'}, 2293, 350, 3)
shopModule:addBuyableItem({'destroy field'}, 2261, 45, 3)
shopModule:addBuyableItem({'light magic missile'}, 2287, 40, 10)
shopModule:addBuyableItem({'heavy magic missile'}, 2311, 120, 10)
shopModule:addBuyableItem({'great fireball'}, 2304, 180, 4)
shopModule:addBuyableItem({'explosion'}, 2313, 250, 6)
shopModule:addBuyableItem({'sudden death'}, 2268, 350, 3)
shopModule:addBuyableItem({'death arrow'}, 2263, 300, 3)
shopModule:addBuyableItem({'paralyze'}, 2278, 700, 1)
shopModule:addBuyableItem({'animate dead'}, 2316, 375, 1)
shopModule:addBuyableItem({'convince creature'}, 2290, 80, 1)
shopModule:addBuyableItem({'chameleon'}, 2291, 210, 1)
shopModule:addBuyableItem({'desintegrate'}, 2310, 80, 3)
shopModule:addBuyableItem({'wand of vortex'}, 2190, 500)
shopModule:addBuyableItem({'wand of dragonbreath'}, 2191, 1000)
shopModule:addBuyableItem({'wand of decay'}, 2188, 5000)
shopModule:addBuyableItem({'wand of draconia'}, 8921, 7500)
shopModule:addBuyableItem({'wand of cosmic energy'}, 2189, 10000)
shopModule:addBuyableItem({'wand of inferno'}, 2187, 15000)
shopModule:addBuyableItem({'wand of starstorm'}, 8920, 18000)
shopModule:addBuyableItem({'wand of voodoo'}, 8922, 22000)
shopModule:addBuyableItem({'snakebite rod'}, 2182, 500)
shopModule:addBuyableItem({'moonlight rod'}, 2186, 1000)
shopModule:addBuyableItem({'necrotic rod'}, 2185, 5000)
shopModule:addBuyableItem({'northwind rod'}, 8911, 7500)
shopModule:addBuyableItem({'terra rod'}, 2181, 10000)
shopModule:addBuyableItem({'hailstorm rod'}, 2183, 15000)
shopModule:addBuyableItem({'springsprout rod'}, 8912, 18000)
shopModule:addBuyableItem({'underworld rod'}, 8910, 22000)
shopModule:addSellableItem({'wand of vortex'}, 2190, 250)
shopModule:addSellableItem({'wand of dragonbreath'}, 2191, 500)
shopModule:addSellableItem({'wand of decay'}, 2188, 2500)
shopModule:addSellableItem({'wand of draconia'}, 8921, 3750)
shopModule:addSellableItem({'wand of cosmic energy'}, 2189, 5000)
shopModule:addSellableItem({'wand of inferno'},2187, 7500)
shopModule:addSellableItem({'wand of starstorm'}, 8920, 9000)
shopModule:addSellableItem({'wand of voodoo'}, 8922, 11000)
shopModule:addSellableItem({'snakebite rod'}, 2182, 250)
shopModule:addSellableItem({'moonlight rod'}, 2186, 500)
shopModule:addSellableItem({'necrotic rod'}, 2185, 2500)
shopModule:addSellableItem({'northwind rod'}, 8911, 3750)
shopModule:addSellableItem({'terra rod'}, 2181, 5000)
shopModule:addSellableItem({'hailstorm rod'}, 2183, 7500)
shopModule:addSellableItem({'springsprout rod'}, 8912, 9000)
shopModule:addSellableItem({'underworld rod'}, 8910, 11000)
local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
if(isSorcerer(cid) or isDruid(cid)) then
if(getPlayerStorageValue(cid, 30002) <= 0) then
selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
talkState[talkUser] = 1
else
selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
end
else
selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
end
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
selfSay('Here you are young adept, take care yourself.', cid)
setPlayerStorageValue(cid, 30002, 1)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
selfSay('Ok then.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())