✅Poner vocation a este potion al usarlo

nyebez

Miembro
LV
13
 
Awards
10
hola, quiero ponerle vocacion a este potion, es el great mana potion, que agrege a un servidor 7.4 tfs 1.2, ya tiene nivel y todo, pero ocupo ponerle vocacion y no puedo, alguien podria ayudarme con eso?

Código:
function onUse(cid, item, frompos, itemEx, toPosition)
local health_minimum = 425
local health_maximum = 575

-- Mana Formula Settings END --
if getPlayerLevel(cid) >= 80 then
local health_add = math.random(health_minimum, health_maximum)
doCreatureAddHealth(cid, health_add)
doRemoveItem(item.uid, 1)
doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER_SAY)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
else
doCreatureSay(cid, "This potion can only be consumed by players of level 80 or higher.", TALKTYPE_MONSTER_SAY)
end
return TRUE
end
 
Última edición por un moderador:
Solución
Código:
local config = {
    ['vocations'] = {4,8},
    ['min'] = 650,
    ['max'] = 850,
}

function onUse(player, item, fromPosition, target, toPosition)
    if not table.contains(config['vocations'], player:getVocation():getId()) then
        player:say("Only knights may drink this fluid.", TALKTYPE_MONSTER_SAY)
        return false
    elseif player:getLevel() < 130 then
        player:say("Only knight of level 130 or above may drink this fluid.", TALKTYPE_MONSTER_SAY)
        return false
    end

    item:remove(1)
    toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    player:addHealth(math.random(config['min'], config['max']))
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
    return true
end

nyebez

Miembro
LV
13
 
Awards
10
ya encontre la solucion, aqui esta para quien lo quiero pasa sus ots olds



local config = {
['vocations'] = {4,8},
['min'] = 650,
['max'] = 850,
}

function onUse(player, item, fromPosition, target, toPosition)
if not table.contains(config['vocations'], player:getVocation():getId()) then
player:say("Only knights may drink this fluid.", TALKTYPE_MONSTER_SAY)
return false
elseif player:getLevel() < 130 then
player:say("Only knight of level 130 or above may drink this fluid.", TALKTYPE_MONSTER_SAY)
return false
end

item:remove(1)
toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:addHealth(math.random(config['min'], config['max']))
player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
return true
end
 

nyebez

Miembro
LV
13
 
Awards
10
Código:
local config = {
    ['vocations'] = {4,8},
    ['min'] = 650,
    ['max'] = 850,
}

function onUse(player, item, fromPosition, target, toPosition)
    if not table.contains(config['vocations'], player:getVocation():getId()) then
        player:say("Only knights may drink this fluid.", TALKTYPE_MONSTER_SAY)
        return false
    elseif player:getLevel() < 130 then
        player:say("Only knight of level 130 or above may drink this fluid.", TALKTYPE_MONSTER_SAY)
        return false
    end

    item:remove(1)
    toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    player:addHealth(math.random(config['min'], config['max']))
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
    return true
end
 
Última edición por un moderador:
Arriba