Galera, eu peguei um npc systema Akatsuki e modifiquei para Anbu. Só que no servidor ele só fica dizendo: "
You already part of the Anbu!" sendo que o player não faz... Alguém aí poderia ajudar?
Obs: Sim as storages são diferentes. Os itens também, e as outfits também!
Citarlocal 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 level = 400 -- Level preciso pra entra para Anbu
local itemid = 6113 -- id do coraçao
local quantidade = 6 -- quantos certificados e preciso
local bonushp = 300000 -- quanto de bonus de life vai ganha
local bonusmp = 30000 -- quanto de bonus de mana vai ganha
local config = {
--[Vocation] = ( Nova Vocation, New Outfit )
[1] = { 13, 876},
[15] = { 28, 878},
[30] = { 43, 880},
[45] = { 58, 888},
[60] = { 69, 890},
[75] = { 88, 892},
[90] = { 103, 894},
[105] = { 115, 896},
[130] = { 143, 922},
[145] = { 158, 924},
[160] = { 173, 828},
[117] = { 128, 926},
[175] = { 188, 944},
[190] = { 203, 934},
[205] = { 218, 884},
[220] = { 233, 900},
[250] = { 263, 942},
[265] = { 278, 886},
[280] = { 293, 918},
[295] = { 308, 916},
[310] = { 323, 920},
[325] = { 338, 906},
[340] = { 353, 904},
[360] = { 373, 910},
[375] = { 388, 940},
[390] = { 403, 914},
[420] = { 432, 898},
[435] = { 437, 932},
[463] = { 471, 882},
[474] = { 484, 938},
[487] = { 497, 912},
[507] = { 515, 902},
[530] = { 540, 936},
}
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, 'Anbu') then
if getPlayerVocation(cid) ~= config then
if getPlayerStorageValue(cid, 89745,6) == -1 then
if getPlayerLevel(cid) >= level then
selfSay('Are you sure you want to join the Anbu?.', cid)
talkState[talkUser] = 1
else
selfSay('You there and very weak, vain talk to you when you have level '..level..'.', cid)
end
else
selfSay('You already part of the Anbu!', cid)
end
else
selfSay('Do not need you now!', cid)
end
end
if talkState[talkUser] == 1 and msgcontains(msg, 'yes') then
selfSay('me prove que voce tem a '..quantidade..' de {certificado}.', cid)
talkState[talkUser] = 2
end
if talkState[talkUser] == 2 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid, 6113) >= 6 then
local voc = config[getPlayerVocation(cid)]
doPlayerSetVocation(cid, voc[1])
local outfit = {lookType = voc[2]}
doCreatureChangeOutfit(cid, outfit)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+bonushp)
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+bonusmp)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerRemoveItem(cid, 6113, 6)
doCreatureAddMana(cid, getCreatureMaxMana(cid))
setPlayerStorageValue(cid,89745,6)
db.executeQuery("UPDATE `players` SET `name` = '[Anbu] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
addEvent(doRemoveCreature, 5*1000, cid, true)
doPlayerSendTextMessage(cid,25,'You will be kicked in 5 seconds to enter the Anbu!')
selfSay('Congratulations now you are part of Anbu.', cid)
talkState[talkUser] = 0
else
selfSay('No use to fool me, you do not have '..quantidade..' certificado, goes behind.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())