ScoTTMc deu reputação a
Yan Oliveira em Npc não funciona da maneira certa
Substitui o script.lua do npc por esse:
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
local choose = {}
local cancel = {}
local available = {}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
local storage_reborn = 30023
-------- FUNÇÃO PARA VER SE PLAYER É REBORN OU NÃO E CONTINUAR CASO FOR AO ESCOLHER A VOCAÇÃO --------
function setRebornVocation(cid, storage, vocation)
if (getPlayerStorageValue(cid, storage) > 0) and (getPlayerVocation(cid) == vocation) then
setPlayerStorageValue(cid, storage, 1)
doPlayerSetVocation(cid, vocation)
return true
elseif (getPlayerStorageValue(cid, storage) < 1) and (getPlayerVocation(cid) == vocation) then
setPlayerStorageValue(cid, storage, -1)
doPlayerSetVocation(cid, vocation)
return true
end
end
-------------------------------- CÓDIGO ---------------------------------
if(msgcontains(msg, "vocacao")) then
selfSay("Qual dessas vocacoes voce quer se tornar? Shenron(VIP), Vegetto(VIP), Tapion(FREE), Kame(VIP), King Vegeta(VIP), Kagome(VIP), Zaiko(VIP), Chilled(Free), C8(VIP), Bills(VIP), Whiss(VIP), Super Broly(VIP), Champa(VIP), Paikuhan(VIP), Botamo(Free), Jiren(VIP), Yamcha(Free), Zamasu(VIP), Goku Black(VIP).", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, "shenron") or msgcontains(msg, "SHENRON") and talk_state == 1 then
doPlayerSetVocation(cid, 376)
setRebornVocation(cid, storage_reborn, 376)
selfSay("Parabens, voce virou um Shenron", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "vegetto") or msgcontains(msg, "VEGETTO") and talk_state == 1 then
doPlayerSetVocation(cid, 388)
setRebornVocation(cid, storage_reborn, 388)
selfSay("Parabens, voce virou um Vegetto", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "tapion") or msgcontains(msg, "TAPION") and talk_state == 1 then
doPlayerSetVocation(cid, 400)
setRebornVocation(cid, storage_reborn, 400)
selfSay("Parabens, voce virou um Tapion", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "kame") or msgcontains(msg, "KAME") and talk_state == 1 then
doPlayerSetVocation(cid, 413)
setRebornVocation(cid, storage_reborn, 413)
selfSay("Parabens, voce virou um Kame", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "king vegeta") or msgcontains(msg, "KING VEGETA") and talk_state == 1 then
doPlayerSetVocation(cid, 425)
setRebornVocation(cid, storage_reborn, 425)
selfSay("Parabens, voce virou um King Vegeta", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "kagome") or msgcontains(msg, "KAGOME") and talk_state == 1 then
doPlayerSetVocation(cid, 437)
setRebornVocation(cid, storage_reborn, 437)
selfSay("Parabens, voce virou um Kagome", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "zaiko") or msgcontains(msg, "ZAIKO") and talk_state == 1 then
doPlayerSetVocation(cid, 449)
setRebornVocation(cid, storage_reborn, 449)
selfSay("Parabens, voce virou um Zaiko", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "chilled") or msgcontains(msg, "CHILLED") and talk_state == 1 then
doPlayerSetVocation(cid, 461)
setRebornVocation(cid, storage_reborn, 461)
selfSay("Parabens, voce virou um Chilled", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "c8") or msgcontains(msg, "C8") and talk_state == 1 then
doPlayerSetVocation(cid, 478)
setRebornVocation(cid, storage_reborn, 478)
selfSay("Parabens, voce virou um C8", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "bills") or msgcontains(msg, "BILLS") and talk_state == 1 then
doPlayerSetVocation(cid, 552)
setRebornVocation(cid, storage_reborn, 552)
selfSay("Parabens, voce virou um Bills", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "whiss") or msgcontains(msg, "WHISS") and talk_state == 1 then
doPlayerSetVocation(cid, 572)
setRebornVocation(cid, storage_reborn, 572)
selfSay("Parabens, voce virou um Whiss", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "super broly") or msgcontains(msg, "SUPER BROLY") and talk_state == 1 then
doPlayerSetVocation(cid, 587)
setRebornVocation(cid, storage_reborn, 587)
selfSay("Parabens, voce virou um Super Broly", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "champa") or msgcontains(msg, "CHAMPA") and talk_state == 1 then
doPlayerSetVocation(cid, 602)
setRebornVocation(cid, storage_reborn, 602)
selfSay("Parabens, voce virou um Champa", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "paikuhan") or msgcontains(msg, "PAIKUHAN") and talk_state == 1 then
doPlayerSetVocation(cid, 615)
setRebornVocation(cid, storage_reborn, 615)
selfSay("Parabens, voce virou um Paikuhan", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "botamo") or msgcontains(msg, "BOTAMO") and talk_state == 1 then
doPlayerSetVocation(cid, 627)
setRebornVocation(cid, storage_reborn, 627)
selfSay("Parabens, voce virou um Botamo", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "jiren") or msgcontains(msg, "JIREN") and talk_state == 1 then
doPlayerSetVocation(cid, 640)
setRebornVocation(cid, storage_reborn, 640)
selfSay("Parabens, voce virou um Jiren", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "yamcha") or msgcontains(msg, "YAMCHA") and talk_state == 1 then
doPlayerSetVocation(cid, 653)
setRebornVocation(cid, storage_reborn, 653)
selfSay("Parabens, voce virou um Yamcha", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "zamasu") or msgcontains(msg, "ZAMASU") and talk_state == 1 then
doPlayerSetVocation(cid, 667)
setRebornVocation(cid, storage_reborn, 667)
selfSay("Parabens, voce virou um Zamasu", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, "goku black") or msgcontains(msg, "GOKU BLACK") and talk_state == 1 then
doPlayerSetVocation(cid, 681)
setRebornVocation(cid, storage_reborn, 681)
selfSay("Parabens, voce virou um Goku Black", cid)
talkState[talkUser] = 0
return true
elseif(msgcontains(msg, "bye") or msgcontains(msg, "goodbye") or msgcontains(msg, "cya")) then
selfSay("cya!", cid, TRUE)
closeShopWindow(cid)
removeFocus(cid)
talkState[talkUser] = 0
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Testa e me fala, não tenho base de Dragon Ball, então não consigo testar.