Tenta isto:
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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'sim')) and getPlayerVocation(cid, 2) then -- AQUI
doPlayerSetTown(cid, 5)
npcHandler:say("Seja bem vindo a Edoras.", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'nao')) then
npcHandler:say('Adeus Forasteiro..', cid)
talkState[talkUser] = 0
end
return true
end
function msgcontains(message, keyword)
if(type(keyword) == "table") then
return table.isStrIn(keyword, message)
end
local a, b = message:lower():find(keyword:lower())
if(a ~= nil and b ~= nil) then
return true
end
return false
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Onde está o "AQUI", está o numero 2 como número da vocação, alí você muda para a vocação que quiser.






info
Grupo: Visconde
Registrado: 24/11/12
Posts: 474
Reputação: +98
Gênero: Masculino
Galera queria que apenas tal vocation id possa se batizar nessa cidade, e os que nao for dessa vocation id o npc diga a mensagem.. "Apenas humanos podem morar nessa cidade."
Script NPC:
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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if(msgcontains(msg, 'sim')) then doPlayerSetTown(cid, 5) npcHandler:say("Seja bem vindo a Edoras.", cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'nao')) then npcHandler:say('Adeus Forasteiro..', cid) talkState[talkUser] = 0 end return true end function msgcontains(message, keyword) if(type(keyword) == "table") then return table.isStrIn(keyword, message) end local a, b = message:lower():find(keyword:lower()) if(a ~= nil and b ~= nil) then return true end return false end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())