É o seguinte.. estou usando um npc que vende vocação vip apenas para quem tem promotion. A pessoa compra normalmente a vocação, mas quando ela desloga e entra.. a vocação vip some e a pessoa fica com a vocação anterior.
Eis aqui o script do meu npc que vende vocação vip : (script feito pelo Vodkart)
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 a = {
[5] = {new_voc = 9,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true},
[6] = {new_voc = 10,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true},
[7] = {new_voc = 11,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true},
[8] = {new_voc = 12,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true}
}
local b = a[getPlayerVocation(cid)]
if(msgcontains(msg, 'vip promotion') or msgcontains(msg, 'vip promote')) then
if(not b) then
selfSay('Você não tem a second promote, então não poderá ser promovido!.', cid)
talkState[talkUser] = 0
else
selfSay('Deseja virar ' .. getVocationInfo(b.new_voc).name .. ' por '..b.price..' gold coins? {yes}', cid)
talkState[talkUser] = 1
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if b.need_premium == true and not isPremium(cid) then
selfSay('Você precisa ser Premium para ser promovido!.', cid)
talkState[talkUser] = 0
elseif b.need_level == true and getPlayerLevel(cid) < b.level then
selfSay('Você deve ter pelo menos level '.. b.level ..' para ser promovido!.', cid)
talkState[talkUser] = 0
elseif b.cobrar == true and doPlayerRemoveMoney(cid, b.price) == TRUE then
doPlayerSetVocation(cid,b.new_voc)
selfSay('Você foi promovido com sucesso.', cid)
talkState[talkUser] = 0
else
selfSay('Você não tem '..b.price..' gold coins Suficientes.', cid)
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Group: Artesão
Joined: 03/06/11
Posts: 143
Reputation: +102
Tibia Character: [ADM] Sakyo
É o seguinte.. estou usando um npc que vende vocação vip apenas para quem tem promotion. A pessoa compra normalmente a vocação, mas quando ela desloga e entra.. a vocação vip some e a pessoa fica com a vocação anterior.
Eis aqui o script do meu npc que vende vocação vip : (script feito pelo Vodkart)
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 a = { [5] = {new_voc = 9,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true}, [6] = {new_voc = 10,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true}, [7] = {new_voc = 11,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true}, [8] = {new_voc = 12,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true} } local b = a[getPlayerVocation(cid)] if(msgcontains(msg, 'vip promotion') or msgcontains(msg, 'vip promote')) then if(not b) then selfSay('Você não tem a second promote, então não poderá ser promovido!.', cid) talkState[talkUser] = 0 else selfSay('Deseja virar ' .. getVocationInfo(b.new_voc).name .. ' por '..b.price..' gold coins? {yes}', cid) talkState[talkUser] = 1 end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if b.need_premium == true and not isPremium(cid) then selfSay('Você precisa ser Premium para ser promovido!.', cid) talkState[talkUser] = 0 elseif b.need_level == true and getPlayerLevel(cid) < b.level then selfSay('Você deve ter pelo menos level '.. b.level ..' para ser promovido!.', cid) talkState[talkUser] = 0 elseif b.cobrar == true and doPlayerRemoveMoney(cid, b.price) == TRUE then doPlayerSetVocation(cid,b.new_voc) selfSay('Você foi promovido com sucesso.', cid) talkState[talkUser] = 0 else selfSay('Você não tem '..b.price..' gold coins Suficientes.', cid) doSendMagicEffect(getPlayerPosition(cid), 2) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())Estarei dando Rep ++
Para quem puder ajudar. Obrigado
Edited Junho 23 by RaizenUrameshi