Potion System

ScythePhantom
em Scripts
  • 1
  • 2

kttallan

Lord Sorte
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 06/03/13Posts: 1574Gênero: MasculinoChar no Tibia: Lord Sorte

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

 

 

                                                                Scripter em Treinamento

 

Codigos

 

Simples Pet Sistema < New

 

Assim que possivel mais codigos, com criatividade.

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

Ainda não, eu quero que ele gaste, porém que não fique o empty, assim ainda está infinita.

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

kttallan

Lord Sorte
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 06/03/13Posts: 1574Gênero: MasculinoChar no Tibia: Lord Sorte

use

doRemoveItem(uid, 1)

no scripter..

                                                                Scripter em Treinamento

 

Codigos

 

Simples Pet Sistema < New

 

Assim que possivel mais codigos, com criatividade.

Omega

o/
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 17/06/07Posts: 1165Gênero: MasculinoChar no Tibia: Nenhum

Como o cara aí disse, deve funcionar assim:

 

 

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", 7636),
[7618] = Potion:new("health", 100, 200, "all", 7636),
[7588] = Potion:new("health", 200, 400, {3, 4, 7, 8}, 7634),
[7591] = Potion:new("health", 600, 800, {4, 8}, 7635),
[8473] = Potion:new("health", 900, 1200, {4, 8}, 7635),
[8472] = Potion:new("health", 900, 950, {3, 7}, 7635),
[7620] = Potion:new("mana", 90, 150, "all", 7636),
[7589] = Potion:new("mana", 190, 250, {1, 2, 5, 6}, 7634),
[7590] = Potion:new("mana", 300, 400, {1, 2, 5, 6}, 7635),
}
 
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)
doRemoveItem(item.uid, 1)
return true
 

end

 

 

Lumus

Lumus ;)
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 03/02/13Posts: 1233Gênero: MasculinoChar no Tibia: Partiu Baladinha

Tó:

local MIN = 950
local MAX = 1050
local EMPTY_POTION = 7635
local RANGE = -1

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) == FALSE then
		return FALSE
	end

	if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end
	
	if(RANGE > 0 and cid ~= itemEx.uid and getDistanceBetween(getThingPosition(cid), getThingPosition(itemEx.uid)) > RANGE) then
		return FALSE
	end

	if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
		return FALSE
	end

	doAddCondition(cid, exhaust)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah!!!", TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
        pot_count = getPlayerItemCount(cid, EMPTY_POTION)
        doPlayerRemoveItem(cid, EMPTY_POTION, pot_count)
        return TRUE
end

#include <iostream>

 

cout <<"Mano, a brisa é louca o barato é dentro";

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

Como o cara aí disse, deve funcionar assim:

Spoiler

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", 7636),

[7618] = Potion:new("health", 100, 200, "all", 7636),

[7588] = Potion:new("health", 200, 400, {3, 4, 7, 8}, 7634),

[7591] = Potion:new("health", 600, 800, {4, 8}, 7635),

[8473] = Potion:new("health", 900, 1200, {4, 8}, 7635),

[8472] = Potion:new("health", 900, 950, {3, 7}, 7635),

[7620] = Potion:new("mana", 90, 150, "all", 7636),

[7589] = Potion:new("mana", 190, 250, {1, 2, 5, 6}, 7634),

[7590] = Potion:new("mana", 300, 400, {1, 2, 5, 6}, 7635),

}

 

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)

doRemoveItem(item.uid, 1)

return true

 

 

end

 

Funcionou, porém se uma vocação tenta usar um potion de outra vocação os potions também gastam, não healam, mas ainda assim são gastos, no caso deveria apararecer uma mensagem Only vocation... e tal, e não serem gastos.

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

lucasfgx

XTibia
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/10/13Posts: 21Char no Tibia: WizzHunteR

tenta aew

local config = {
removeOnUse = "yes",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1100}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {90, 170}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {500, 800}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {400, 600}, mana = {230, 380}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return TRUE
end
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return TRUE
end
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return TRUE
end
doRemoveItem(item.uid, 0)
doPlayerAddItem(cid, potion.empty, 0)
doPlayerRemoveItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty))
doPlayerAddItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty))
return TRUE
end

                                                       a7s7.png

                                                  REP+

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

Mesma coisa, tipo aparece a mensagem This vocation cannot use this potion mas ainda assim o potion é gasto.

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

lucasfgx

XTibia
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/10/13Posts: 21Char no Tibia: WizzHunteR

Mesma coisa, tipo aparece a mensagem This vocation cannot use this potion mas ainda assim o potion é gasto.

foi mal eu eskeci de arruma um negocio kkk tenta essa dae.mdr.gif

eu arrumei ali em cima.

                                                       a7s7.png

                                                  REP+

Omega

o/
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 17/06/07Posts: 1165Gênero: MasculinoChar no Tibia: Nenhum

 

 

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
doPlayerRemoveItem(cid, self.uid, 1)
doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
return true
end
 
Pots = {
[8704] = Potion:new("health", 50, 100, "all", 7636),
[7618] = Potion:new("health", 100, 200, "all", 7636),
[7588] = Potion:new("health", 200, 400, {3, 4, 7, 8}, 7634),
[7591] = Potion:new("health", 600, 800, {4, 8}, 7635),
[8473] = Potion:new("health", 900, 1200, {4, 8}, 7635),
[8472] = Potion:new("health", 900, 950, {3, 7}, 7635),
[7620] = Potion:new("mana", 90, 150, "all", 7636),
[7589] = Potion:new("mana", 190, 250, {1, 2, 5, 6}, 7634),
[7590] = Potion:new("mana", 300, 400, {1, 2, 5, 6}, 7635),
}
 
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

 

 

lucasfgx

XTibia
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/10/13Posts: 21Char no Tibia: WizzHunteR

Omega eu ja postei ali em cima.

                                                       a7s7.png

                                                  REP+

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

Agora está certo, porém está infinita... não gasta nenhuma.

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

lucasfgx

XTibia
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/10/13Posts: 21Char no Tibia: WizzHunteR

Agora está certo, porém está infinita... não gasta nenhuma.

mano usa a minha la esta certo e esta gastando.

 

local config = {

removeOnUse = "yes",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1100}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {90, 170}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {500, 800}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {400, 600}, mana = {230, 380}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return TRUE
end
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return TRUE
end
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return TRUE
end
doRemoveItem(item.uid, 0)
doPlayerAddItem(cid, potion.empty, 0)
doPlayerRemoveItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty))
doPlayerAddItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty))
return TRUE
end

                                                       a7s7.png

                                                  REP+

Omega

o/
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 17/06/07Posts: 1165Gênero: MasculinoChar no Tibia: Nenhum

Usuário acima, embora seu script possa ser funcional, a base que ele forneceu é muito superior e, por favor, use spoilers para postar códigos grandes.

 

 

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 false
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", 7636),
[7618] = Potion:new("health", 100, 200, "all", 7636),
[7588] = Potion:new("health", 200, 400, {3, 4, 7, 8}, 7634),
[7591] = Potion:new("health", 600, 800, {4, 8}, 7635),
[8473] = Potion:new("health", 900, 1200, {4, 8}, 7635),
[8472] = Potion:new("health", 900, 950, {3, 7}, 7635),
[7620] = Potion:new("mana", 90, 150, "all", 7636),
[7589] = Potion:new("mana", 190, 250, {1, 2, 5, 6}, 7634),
[7590] = Potion:new("mana", 300, 400, {1, 2, 5, 6}, 7635),
}
 
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
if Potions:heal(itemEx.uid) then
	doRemoveItem(item.uid, 1)
end
return true

end

 

 

 

Testa mais esse aqui se quiser manter, agora deve funcionar.

  • 1
  • 2