Npc.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local pos = {x= 1, y= 2, z= 3} -- posição pra onde sera teleportado
local itemid = {2382, 12252, 12253, 12254, 12255, 12256, 12257, 12258, 2160} --items que precisa pra pode passa
if(msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid, 21321312312) == 1
doTeleportThing(cid, pos)
selfSay('Voce foi teleportado.', cid)
elseif getPlayerItemCount(cid, itemid) >= 1 then
doPlayerSetStorageValue(cid, 21321312312, 1)
doTeleportThing(cid, pos)
selfSay('Voce foi teleportado.', cid)
else
selfSay('Voce nao tem os items nessessarios.', cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Npc.xml
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nome do npc" script="Nome do Script.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>
<parameters>
<parameter key="message_greet" value="Oi |PLAYERNAME|, Voce que ser teleportado diga {yes}."/>
</parameters>
</npc>
testa ai qualquer erro fala que eu resolvo.