• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [NPC][TFS 1.x] Adding trade items after quest

Jarofir

New Member
Joined
Aug 3, 2010
Messages
16
Reaction score
1
Location
Gdynia
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.

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:
Back
Top