pioncz
New Member
- Joined
- Dec 3, 2008
- Messages
- 149
- Reaction score
- 1
This is my lua script on my npc. I want to make npc who trade only with premium players and some storage id. Everythings alright withoud shopmodule. When i talk to npc, i see trade box with boots of haste, but i cant buy any of them. I have money, no errors appears on console or in game. Please help.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
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
-- Storage IDs --
local quest = 20053
local premium = 'You need premium account for this.'
local noitems = 'You dont have items.'
local bring = 'First do quest.'
function trejd(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
shopModule:reset()
if isPremium(cid) then
local sss = getPlayerStorageValue(cid,quest)
if sss == 1 then
shopModule:addBuyableItem({'boots of haste'}, 2195, 1000, 'boots of haste')
else
selfSay(bring)
end
else
selfSay(premium)
end
return true
end
-- ASSASSIN END --
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can sell boh for you, but first you must have done boh quest. Ask for {trade} when you have done it."})
keywordHandler:addKeyword({'trade'}, trejd, {npcHandler = npcHandler, onlyFocus = true})
local node1 = keywordHandler:addKeyword({'trades'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true})
node1:addChildKeyword({'yes'}, trejd, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())