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

I need help with NPC.

mylfu

New Member
Joined
Apr 30, 2008
Messages
10
Reaction score
0
Hello, i need NPC which sets storage value based on message, for example i say:
hi
storage 5
yes

and npc sets me storage value to 5 for certain key.

i have tfs 0.3.6pl1
 
?? :p ! U can use talkaction /storage

/storage name, key <-- check his value of key
/storage name, key, value <-- set new value for key
 
I want to let my players set them storages (but only for one key, like 12345) by themselves, they will set kind of difficulty level, and other script will be based on this value.
 
LUA:
local key = 1717

function creatureSayCallback(cid, type, msg)
    
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    if msgcontains(msg, 'storage') then
        local rst = msg:sub(msg:find(' ') + 1, msg:len())
        local sts = tonumber(rst)

        if not sts then
            selfSay('no number msg...', cid)
            return true
        end
        
        doPlayerSetStorageValue(cid, key, sts)
        selfSay('storage set to ' .. sts, cid)
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

note: its not the complete script.
 
Back
Top