My problem is that I want to make NPC trade with players only with specifik storage value (after finishing some quest) but my code is not working.
No matter if the quest is done or not I still can buy this item. But the msgs "you have done quest" and "you are premium" pops up corectly. Any ideas?
Edit: I can see that the problem is that if anybody with quest started trade with npc, he will always have this item in his shop. How can i change that?
Lua:
local function greetCallback(cid)
if isPremium(cid) then
npcHandler:say("you are premium", cid) -- only check
if getPlayerStorageValue(cid,questStorage) >= 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "you have done quest") -- only check
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'brass helmet'}, 2460, 120, 1, 'brass helmet')
end
return true
else
npcHandler:say(getCreatureName(cid) .. ", I will speak only with premium players....", cid)
return false
end
end
No matter if the quest is done or not I still can buy this item. But the msgs "you have done quest" and "you are premium" pops up corectly. Any ideas?
Edit: I can see that the problem is that if anybody with quest started trade with npc, he will always have this item in his shop. How can i change that?
Last edited: