Boa noite, queria que esse npc so aceita o player utilizar ele se o player for vip
local destinos = {
{nome = "Gelo", coordenadas = {x=1048, y=762, z=7}},
{nome = "Exotic", coordenadas = {x=964, y=1344, z=7}},
{nome = "Haunted", coordenadas = {x=1734, y=1218, z=8}},
{nome = "Fogo", coordenadas = {x=816, y=1482, z=7}},
{nome = "Hunter", coordenadas = {x=1595, y=1703, z=7}},
{nome = "Psych", coordenadas = {x=914, y=1216, z=7}},
{nome = "Sunshine", coordenadas = {x=1449, y=1826, z=7}},
-- Adicione mais destinos conforme necessário
}
local talkState = {}
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 onCreatureSay(cid, type, msg)
if getDistanceToCreature(cid) > 3 then
return true
end
msg = string.lower(msg)
if msgcontains(msg, "hi") then
local dialogOptions = {"Fechar"}
for _, destino in ipairs(destinos) do
table.insert(dialogOptions, destino.nome)
end
sendNpcDialog(cid, getNpcCid(), "Ola " .. getCreatureName(cid) .. ", para onde deseja ir?", dialogOptions)
talkState[1] = "choose_destination"
end
if talkState[1] == "choose_destination" then
for index, destino in ipairs(destinos) do
if msgcontains(msg, destino.nome:lower()) then
sendNpcDialog(cid, getNpcCid(), "Gostaria de ir para " .. destino.nome .. "?", {"Fechar", "Sim"})
talkState[2] = "confirm_destination"
talkState["destination_index"] = index
end
end
end
if talkState[2] == "confirm_destination" and msgcontains(msg, "sim") then
local index = talkState["destination_index"]
local destino = destinos[index]
sendNpcDialog(cid, getNpcCid(), "Até mais!", {"Fechar"})
doTeleportThing(cid, destino.coordenadas)
end
return true
end