• 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!

TFS 0.X bug npc sell itens with storage

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
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?
 
Solution
Remove this
Lua:
       local shopModule = ShopModule:new()
        npcHandler:addModule(shopModule)
        shopModule:addBuyableItem({'assassin star'}, 7368, 500, 'assassin star')
        shopModule:addBuyableItem({'throwing star'}, 2399, 150, 'assassin star')
and try this instead
Lua:
        if doPlayerRemoveMoney(cid, 50000) then
           doPlayerAddItem(cid, 7368,100)
Remove this
Lua:
       local shopModule = ShopModule:new()
        npcHandler:addModule(shopModule)
        shopModule:addBuyableItem({'assassin star'}, 7368, 500, 'assassin star')
        shopModule:addBuyableItem({'throwing star'}, 2399, 150, 'assassin star')
and try this instead
Lua:
        if doPlayerRemoveMoney(cid, 50000) then
           doPlayerAddItem(cid, 7368,100)
 
Solution
Back
Top