tente esse
local Potion = {
type = "",
healmin = 0,
healmax = 0,
vocations = {},
emptyid = 0,
}
function Potion:new(type, healmin, healmax, vocations, emptyid, uid)
local potions = {
type = type,
healmin = tonumber(healmin),
healmax = tonumber(healmax),
vocations = vocations,
uid = 0,
}
return setmetatable(potions, {__index = self})
end
function Potion:heal(cid)
if self.vocations ~= "all" and not isInArray(self.vocations, getPlayerVocation(cid)) then
doPlayerSendCancel(cid, "This vocation cannot use this potion.") return true
elseif self.type == "health" then
doCreatureAddHealth(cid, math.random(self.healmin, self.healmax))
elseif self.type == "mana" then
doPlayerAddMana(cid, math.random(self.healmin, self.healmax))
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
return true
end
Pots = {
[8704] = Potion:new("health", 50, 100, "all", 8704),
[7618] = Potion:new("health", 100, 200, "all", 7618),
[7588] = Potion:new("health", 200, 400, {3, 4, 7, 8}, 7588),
[7591] = Potion:new("health", 600, 800, {4, 8}, 7591),
[8473] = Potion:new("health", 900, 1200, {4, 8}, 8473),
[8472] = Potion:new("health", 900, 950, {3, 7}, 8472),
[7620] = Potion:new("mana", 90, 150, "all", 7620),
[7589] = Potion:new("mana", 190, 250, {1, 2, 5, 6}, 7589),
[7590] = Potion:new("mana", 300, 400, {1, 2, 5, 6}, 7590),
}
function onUse(cid, item, position, itemEx)
if not isPlayer(itemEx.uid) then
doPlayerSendCancel(cid, "Use only in players.")
return true
end
local Potions = Pots[item.itemid]
Potions.uid = item.uid
Potions:heal(itemEx.uid)
return true
end






info
Grupo: Visconde
Registrado: 27/01/13
Posts: 443
Reputação: +83
Gênero: Masculino
#Edit, resolvido.
Editado Dezembro 4 por ScythePhantom