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

Npc All Bless for put in Area Vip!

Not tested but should work, its for tfs 1.0 and will not work with 0.3.6 or 0.4, but since you diden't write any info im guessing you are using 1.0.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local talkState = {}
   
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local price = 50000
    if(msgcontains(msg, "blessings")) then
        npcHandler:say("Would you like to buy all blessings for the price of " .. price .. "?", cid)
        talkState[talkUser] = 1
    if(msgcontains(msg, "yes")) then
        local p = Player(cid)
        if(p:getMoney() >= price) then
            for i = 1,5 do
                if(not p:hasBlessing(i)) then
                    p:addBlessings(i)
                else
                    npcHandler:say("You have already recived my blessings!", cid)
                end
            end
        else
            npcHandler:say("You can not afford my blessings!", cid)
        end
        talkState[talkUser] = 0
    end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
And if you are using 0.3 - 0.4, please use search, this has been made a million times already.
 
Back
Top