galera to com uma talk que muda vocation do player e transform ele por certo tempo, eu queria saber se tem como fazer pra ela ficar gastando a mana do player e quando chega-se a certa quantidade ele voltava a vocaçao normal e o addon saia, caso nao de certo fazer isso, façam so para tirar mana msm, que da certo, script:
-- Script by LuckOake
local function endTransform(cid)
if isCreature(cid) and getPlayerStorageValue(cid, 8152) > 0 then
doPlayerSetVocation(cid, getPlayerStorageValue(cid, 8152))
setPlayerStorageValue(cid, 8152, -1)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
end
function onSay(cid, words)
local waittime = 2 -- Tempo de exhaustion
local storage = 6811
local tempo = 1000000000000000 -- Tempo em milesegundos (1seg = 1000) até a vocation sumir
local vocation = 61 -- Vocation ID
local mana = 100 -- Mana necessária
local outfit = {lookType = 118, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} -- Outfit
local useable_vocs = {"Knight"} -- Vocations que podem usar a talk
local level = 40
local levelMax = 150
if not isInArray(useable_vocs, getPlayerVocationName(cid)) then
doPlayerSendCancel(cid, "Essa vocaçao nao possui o selo.") return true
elseif exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar esse selo novamente.") return true
elseif getPlayerMana(cid) < mana then
doPlayerSendCancel(cid, "Voce nao tem chakra suficiente.") return true
elseif getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, "Voce prescisa estar level "..level..".") return true
elseif getPlayerLevel(cid) >= levelMax then
doPlayerSendCancel(cid, "O level maximo para usar esse selo é ("..levelMax..").") return true
end
exhaustion.set(cid, storage, waittime)
doPlayerAddMana(cid, -mana)
setPlayerStorageValue(cid, 8152, getPlayerVocation(cid))
doSetCreatureOutfit(cid, outfit, -1)
doPlayerSetVocation(cid, vocation)
addEvent(endTransform, tempo, cid)
return true
end