É amigo não retorna error e o NPC não fala cmg...
Posso estar fazendo algo errado; Segue o Cod !
O codigo abaixo ta diferente do que tu passou pois tentei com o seu tb e não foi \=
for _, var in pairs(ItemEqp) do
if player:getPlayerItemCount(cid, getPlayerSlotItem(cid, var).itemid) >= 1 then
Player:RemoveItem(cid, getPlayerSlotItem(cid, var).itemid, getPlayerItemCount(cid, getPlayerSlotItem(cid, var).itemid))
end
end
local function creatureSayCallback(cid, type, msg)
local ItemEqp = {
[1] = CONST_SLOT_LEFT,
[2] = CONST_SLOT_RIGHT,
[3] = CONST_SLOT_RING,
[4] = CONST_SLOT_HEAD,
[5] = CONST_SLOT_NECKLACE,
[6] = CONST_SLOT_BACKPACK
}
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if npcHandler.topic[cid] == 0 then
if msgcontains(msg, "yes") then
npcHandler:say("IN WHICH TOWN DO YOU WANT TO LIVE: {CARLIN}, {THAIS}, OR {VENORE}?", cid)
npcHandler.topic[cid] = 1
end
elseif npcHandler.topic[cid] == 1 then
local cityTable = config.towns[msg:lower()]
if cityTable then
town[cid] = cityTable
npcHandler:say("IN ".. string.upper(msg) .."! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
npcHandler.topic[cid] = 2
else
npcHandler:say("IN WHICH TOWN DO YOU WANT TO LIVE: {CARLIN}, {THAIS}, OR {VENORE}?", cid)
end
elseif npcHandler.topic[cid] == 2 then
local vocationTable = config.vocations[msg:lower()]
if vocationTable then
npcHandler:say(vocationTable.text, cid)
npcHandler.topic[cid] = 3
vocation[cid] = vocationTable.vocationId
else
npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
end
elseif npcHandler.topic[cid] == 3 then
if msgcontains(msg, "yes") then
npcHandler:say("SO BE IT!", cid)
for _, var in pairs(ItemEqp) do
if player:getPlayerItemCount(cid, getPlayerSlotItem(cid, var).itemid) >= 1 then
Player:RemoveItem(cid, getPlayerSlotItem(cid, var).itemid, getPlayerItemCount(cid, getPlayerSlotItem(cid, var).itemid))
end
end
player:setVocation(Vocation(vocation[cid]))
player:setTown(Town(town[cid]))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:teleportTo(Town(town[cid]):getTemplePosition())
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received a backpack with starting items for reaching the mainlands.")
local targetVocation = config.vocations[Vocation(vocation[cid]):getName():lower()]
for i = 1, #targetVocation[1] do
player:addItem(targetVocation[1][i][1], targetVocation[1][i][2])
end
local backpack = player:addItem(1988)
for i = 1, #targetVocation[2] do
backpack:addItem(targetVocation[2][i][1], targetVocation[2][i][2])
end
else
npcHandler:say("THEN WHAT? {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
npcHandler.topic[cid] = 2
end
end
return true
end
local function onAddFocus(cid)
town[cid] = 0
vocation[cid] = 0
end
local function onReleaseFocus(cid)
town[cid] = nil
vocation[cid] = nil
end