Ir para conteúdo

Featured Replies

Postado

Olá pessoal, eu tenho um npc chamado dederin no meu ot 8.6, porem ele nao exige premium, eu queria que ele exigisse premium dos players, e que removesse 1 gold a cada viagem que ele fizesse para as cidades, atualmente para ele viajar, eu preciso apresentar um ticket para outro npc (boater) para ele me conceder a permissão de viajar. Não quero que ele me conceda isso, só quero que o npc DEDERIN verifique se o player e vip, e se for cobrar 1 gold para cada viagem, vou postar o script do npc.

 

local STORAGE = 4150 -- Storage necessária para viajar
local smallcity = {x=107, y=200, z=7}
local namekisland = {x=461, y=447, z=5}
local bigcity = {x=117, y=102, z=7}
local icecity = {x=315, y=179, z=7}
local frozencity = {x=477, y=643, z=7}
local westisland = {x=83, y=39, z=7}
local eastisland = {x=111, y=39, z=7}
local brokencity = {x=99, y=343, z=7}
local assassintower = {x=254, y=393, z=7}
 
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:lower())   end
function onThink()                  npcHandler:onThink()                  end
local talkState = {}
 
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, "travel") then
		selfSay("Eu posso te levar para {Small City}, {Namek Island}, {Big City}, {Ice City}, {Frozen City}, {West Island}, {East Island}, {Broken City}, {Assassin Tower} e {Castle War}.", cid)
	end
	if msgcontains(msg, "small city") then
		selfSay("Voce realmente quer viajar para {Small City}?", cid)
		talkState[talkUser] = 1
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, smallcity)
			doSendMagicEffect(smallcity, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "namek island") then
		selfSay("Voce realmente quer viajar para {Namek Island}?", cid)
		talkState[talkUser] = 2
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, namekisland)
			doSendMagicEffect(namekisland, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
 
	if msgcontains(msg, "big city") then
		selfSay("Voce realmente quer viajar para {Big City}?", cid)
		talkState[talkUser] = 3
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 3 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, bigcity)
			doSendMagicEffect(bigcity, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "ice city") then
		selfSay("Voce realmente quer viajar para {Ice City}?", cid)
		talkState[talkUser] = 4
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 4 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, icecity)
			doSendMagicEffect(icecity, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "frozen city") then
		selfSay("Voce realmente quer viajar para {Frozen City}?", cid)
		talkState[talkUser] = 5
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 5 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, frozencity)
			doSendMagicEffect(frozencity, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "west island") then
		selfSay("Voce realmente quer viajar para {West Island}?", cid)
		talkState[talkUser] = 6
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 6 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, westisland)
			doSendMagicEffect(westisland, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "east island") then
		selfSay("Voce realmente quer viajar para {East Island}?", cid)
		talkState[talkUser] = 7
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 7 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, eastisland)
			doSendMagicEffect(eastisland, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "broken city") then
		selfSay("Voce realmente quer viajar para {Broken City}?", cid)
		talkState[talkUser] = 8
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 8 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, brokencity)
			doSendMagicEffect(brokencity, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
	if msgcontains(msg, "assassin tower") then
		selfSay("Voce realmente quer viajar para {Assassin Tower}?", cid)
		talkState[talkUser] = 9
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 9 then
		if getPlayerStorageValue(cid,4150) == 1 then
		if not isPlayerPzLocked(cid) then
			doSendMagicEffect(getThingPos(cid), 10)
			npcHandler:releaseFocus(cid)
			doTeleportThing(cid, assassintower)
			doSendMagicEffect(assassintower, 10)
		else
			selfSay("Voce deve estar sem pz locked!", cid)
		end
		elseif getPlayerStorageValue(cid,4150) ~= 1 then
			selfSay("Desculpe, voce nao possui passagem!", cid)
		end
	talkState[talkUser] = 0
	end
	
   return true
end
 
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Postado

Em primeiro lugar, retire o Freepremium do config.lua

 

Caso não resolva, além da primeira tentativa, altera seu script do npc boat por

local keywordHandler = KeywordHandler:new()
        local npcHandler = NpcHandler:new(keywordHandler)
        NpcSystem.parseParameters(npcHandler)
        
        
        
        -- OTServ event handling functions start
        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
        -- OTServ event handling functions end

keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Captain Seagull from the Royal Tibia Line."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the captain of this sailing-ship."})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am the captain of this sailing-ship."})
keywordHandler:addKeyword({'ship'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'line'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'company'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'route'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The Royal Tibia Line connects all seaside towns of Tibia."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We can transport everything you want."})
keywordHandler:addKeyword({'passanger'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "We would like to welcome you on board."})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Thais, Carlin, Venore or Edron?"})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Thais, Carlin, Venore or Edron?"})
keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Thais, Carlin, Venore or Edron?"})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Thais, Carlin, Venore or Edron?"})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Thais, Carlin, Venore or Edron?"})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Where do you want to go? To Thais, Carlin, Venore or Edron?"})
keywordHandler:addKeyword({'ice'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'senja'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'folda'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'vega'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve the routes to the Ice Islands."})
keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve this route."})
keywordHandler:addKeyword({'tiquanda'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve this route."})
keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but we don't serve this route."})
keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."})
keywordHandler:addKeyword({'darama'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."})
keywordHandler:addKeyword({'ghost'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Many people who sailed to Darashia never returned because they were attacked by a ghostship! I'll never sail there!"})
        
        
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
	local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Thais for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32310, y=32210, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

        local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32387, y=31820, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
                
	local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Edron for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=33173, y=31764, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
			
			local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Venore for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32954, y=32022, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
	local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Port Hope for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32527, y=32784, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

	local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Svargrond for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32341, y=31108, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

	local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Liberty Bay for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32285, y=32892, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
			
	local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Yalahar for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32816, y=31272, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
	local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=33289, y=32480, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
	local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Ankrahmun free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=33092, y=32883, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

        keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Where do you want to go? To Thais, Carlin, Venore, Yalahar or Edron?'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
		keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
       

        npcHandler:addModule(FocusModule:new())

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.1k

Informação Importante

Confirmação de Termo