fyalhed
Member
- Joined
- Nov 18, 2017
- Messages
- 156
- Reaction score
- 20
i tried to make this npc to sell assassin star to who have the storage for assassins
the check is working, but when player is a assassin and try to buy
npc says: "Sorry, I'm not offering anything."
why?
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
function creatureSayCallback(cid, type, msg)
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
if getPlayerStorageValue(cid, 40001) == 1 then
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'assassin star'}, 7368, 500, 'assassin star')
shopModule:addBuyableItem({'throwing star'}, 2399, 150, 'assassin star')
else
selfSay("You aren't a assassin!", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
the check is working, but when player is a assassin and try to buy
npc says: "Sorry, I'm not offering anything."
why?