• 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 0.3.7 NPC give storage for item

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
438
Solutions
1
Reaction score
47
Hello.
I need NPC who give storage for item. TFS 0.3.7.
Please help me .
 
found? if dont, follow one to try:

Lua:
local cfg = {
    need_item = {5785, 10, 2160, 10},
    storage = 40531,
}

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)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local msg = msg:lower()

    if msgcontains(msg, 'kefla') then
        if getPlayerStorageValue(cid, cfg.storage) < 1 then
            if doPlayerRemoveItem(cid, cfg.need_item[1], cfg.need_item[2]) and doPlayerRemoveItem(cid, cfg.need_item[3], cfg.need_item[4])then
                selfSay('You just swap '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..' for.', cid)
                setPlayerStorageValue(cid, cfg.storage, 1)
            else
                selfSay('You need '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..'.', cid)
            end
        else
            selfSay('You already did this exchange!', cid)
        end
    end
   return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top