Aqui o outro NPC, fácil de configurar e sem erros nenhum(euacho) kkk
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
local itemRemove = 105 -- Item que irár "perder"/trocar ou sei la o que kkk
local itemADD = 107 -- item que irá ganhar
function Remover(cid)
if doPlayerRemoveItem(cid,itemRemove, 1) then
doPlayerAddItem(cid, itemADD, 1)
selfSay("Parabéns, você ganhou o novo item", cid)
talkState[talkUser] = 0
else
doPlayerPopupFYI(cid, "Você não pode concluir, pois está faltando o item.")
return false
end
end
if getPlayerStorageValue(cid, 6000) == 0 then
selfSay("você não tem acesso, fale com outro NPC e volte depois!!")
talkState[talkUser] = 0
elseif (msgcontains(msg, 'servics') or msgcontains(msg, 'SERVICOS')) then
selfSay("você quer receber o novo item?")
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if Remover(cid) then
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Adeus!!", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
OBS: mude apenas o itemRemove e o itemADD, assim fica fácil de se manusear o script.
é simples, porém é o que sei fazer kk