hello, I need my npc to travel only premium account, but it is part of the postman quest, and I can not solve the problem, I use tfs 0.4, what happens is that free players can travel to cormaya and the carpet to edron , but as I said above, they have a function for the postman quest, can anyone help me?
I want the quest to continue, but only travel players premium account
the cities are kazordoon to cormaya ( npc 2), and the carpet that goes to edron (npc 1)
Npc Carpet
NPC Kazordoon- to cormaya
I want the quest to continue, but only travel players premium account
the cities are kazordoon to cormaya ( npc 2), and the carpet that goes to edron (npc 1)
Npc Carpet
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local needstorage = 90000
local storage = 100168
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 greetCallback(cid)
Topic[cid] = 0
return true
end
local edron_cost = 60
function creatureSayCallback(cid, type, msg)
if (not npcHandler:isFocused(cid)) then return false end
if (msgcontains(msg, 'no') and Topic[cid] >= 1) then
npcHandler:say("You shouldn\'t miss the experience.",cid)
Topic[cid] = 0
end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a ride to {Darashia} on Darama for 60 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost =60, destination = {x=33270, y=32441, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'You shouldn\'t miss the experience.'})
if (msgcontains(msg, "edron") and getPlayerStorageValue(cid,storage) == 1) then
npcHandler:say("Do you seek a ride to Edron for "..edron_cost.." gold coins?",cid)
Topic[cid] = 2
elseif (Topic[cid] == 2) then
if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,edron_cost) and Topic[cid] == 2) then
doTeleportThing(cid,{x=33193, y=31784, z=3})
doSendMagicEffect({x=33193, y=31784, z=3},CONST_ME_TELEPORT)
setPlayerStorageValue(cid,storage, 2)
setPlayerStorageValue(cid,100171,4)
else
npcHandler:say("You dont have enough of gold.",cid)
end
end
if (msgcontains(msg, "edron")) and (getPlayerStorageValue(cid,storage) == -1 or getPlayerStorageValue(cid,storage) >= 2) then
npcHandler:say("Do you seek a ride to Edron for "..edron_cost.." gold coins?",cid)
Topic[cid] = 3
elseif (Topic[cid] == 3) then
if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,edron_cost) and Topic[cid] == 3) then
doTeleportThing(cid,{x=33193, y=31784, z=3})
doSendMagicEffect({x=33193, y=31784, z=3},CONST_ME_TELEPORT)
else
npcHandler:say("You dont have enough of gold.",cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
NPC Kazordoon- to cormaya
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local storage = 100168
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
local travelNode = keywordHandler:addKeyword({'Cormaya'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a ride to {Cormaya} for 160 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 160, destination = {x=33312, y=31990, z=15} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Yes, I\'m the captain of this ship.'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Yes, I\'m the captain of this ship.'})
function greetCallback(cid)
Topic[cid] = 0
return true
end
local cormaya_cost = 160
function creatureSayCallback(cid, type, msg)
if (not npcHandler:isFocused(cid)) then return false end
if (msgcontains(msg, 'no') and Topic[cid] >= 1) then
npcHandler:say("You shouldn\'t miss the experience.",cid)
Topic[cid] = 0
end
if (msgcontains(msg, "cormaya") and getPlayerStorageValue(cid,storage) == 3) then
npcHandler:say("Do you seek a ride to Cormaya for "..cormaya_cost.." gold coins?",cid)
Topic[cid] = 1
elseif (Topic[cid] == 1) then
if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,cormaya_cost) and Topic[cid] == 1) then
doTeleportThing(cid,{x=33311, y=31989, z=15})
doSendMagicEffect({x=33311, y=31989, z=15},CONST_ME_TELEPORT)
setPlayerStorageValue(cid,storage, 4)
setPlayerStorageValue(cid,100171,6)
else
npcHandler:say("You dont have enough of gold.",cid)
end
end
if (msgcontains(msg, "cormaya")) and (getPlayerStorageValue(cid,storage) == -1 or getPlayerStorageValue(cid,storage) >= 4) then
npcHandler:say("Do you seek a ride to Cormaya for "..cormaya_cost.." gold coins?",cid)
Topic[cid] = 2
elseif (Topic[cid] == 2) then
if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,cormaya_cost) and Topic[cid] == 2) then
doTeleportThing(cid,{x=33311, y=31989, z=15})
doSendMagicEffect({x=33311, y=31989, z=15},CONST_ME_TELEPORT)
else
npcHandler:say("You dont have enough of gold.",cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())