Ir para conteúdo
  • 0

[Npc Que Vende Novas Vocação]


angelanascimento

Pergunta

Posts Recomendados

  • 0

Não consegui concertar mais achei um script aqui no xtibia.

 

Script by Vodkart:

 

Obs: apaga os outros, esse aqui um só faz a função dos 4. (como esperado do 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

msg = string.lower(msg)

local price = 1

local vocations = {5,6,7,8}

local level = 100

if isInArray({"promote","second promote","promover"}, msg) then

selfSay('Você quer ser promovido por '..price..' gps? {yes} ', cid)

talkState[talkUser] = 1

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then

if isInArray(vocations, getPlayerVocation(cid)) then

if getPlayerLevel(cid) >= level then

if doPlayerRemoveMoney(cid,price) == TRUE then

local new = (getPlayerVocation(cid)+4)

doPlayerSetVocation(cid, new)

setPlayerStorageValue(cid, 878975, new)

selfSay('Parabens! Voce tem sua segunda promocao. ', cid)

talkState[talkUser] = 0

else

selfSay('Você não tem ' .. price .. ' gps para ser promovido', cid)

talkState[talkUser] = 0

end

else

selfSay('Desculpe, você precisa ter level '.. level .. ' ou mais para se promover!', cid)

talkState[talkUser] = 0

end

else

selfSay('Desculpe, mais você não possui a primeira promotion.', cid)

talkState[talkUser] = 0

end

elseif msg == "no" and talkState[talkUser] >= 1 then

selfSay("Then not", cid)

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Em data/creaturescript/script/login.lua adc isso antes do último return true

if getPlayerStorageValue(cid, 878975) ~= -1 then

doPlayerSetVocation(cid, getPlayerStorageValue(cid, 878975))

end

Editado por Newtonnotwen
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...