• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

npc requrst

Nerevr back

Member
Joined
Nov 7, 2014
Messages
269
Reaction score
7
hello guys i want to request scripts for npc

need normal npc work like

if player pay 10 cc give storage forever
player pay one time to get storage

tfs 0.4
 
Last edited:
Solution
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
function travel(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
   if getPlayerStorageValue(cid, 63888) == 1 then
            npcHandler:say("You can pass the ship you bought access before, have fun.", cid)
        elseif doPlayerRemoveMoney(cid, 100000) == TRUE  then...
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
function travel(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
   if getPlayerStorageValue(cid, 63888) == 1 then
            npcHandler:say("You can pass the ship you bought access before, have fun.", cid)
        elseif doPlayerRemoveMoney(cid, 100000) == TRUE  then
          setPlayerStorageValue(cid,63888,1)
            npcHandler:say("Now you can pass the ship!", cid)
        else
            npcHandler:say("You don't have enough money.", cid)
        end
    keywordHandler:moveUp(1)
    return true
end
local node5 = keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to travel the island for 100000 gold coins?'})
     node5:addChildKeyword({'yes'}, travel)
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'You should think it over once more.'})
npcHandler:addModule(FocusModule:new())
 
Solution
Back
Top