@lucashgas
voce sabe o que está errado no script, eu quero fazer que não pode usar duas poções de uma só vez
function doHealOverTime(cid, div, turn, effect)
if not isCreature(cid) then return true end
if turn <= 0 then return true end
if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return true end
local d = div / 10000
local amount = math.floor(getCreatureMaxHealth(cid) * d)
doCreatureAddHealth(cid, amount)
setPlayerStorageValue(item2.uid, 173, 0)
if math.floor(turn/10) == turn/10 then
doSendMagicEffect(getThingPos(cid), effect)
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
end
local potions = {
[12346] = {effect = 12, div = 20},
[12347] = {effect = 13, div = 40},
[12348] = {effect = 13, div = 60},
[12345] = {effect = 14, div = 80},
[12343] = {effect = 12, div = 100}}
function onUse(cid, item, frompos, item2, topos)
if isPlayer(item2.uid) then
return doPlayerSendCancel(cid, "You can only use potions on pokemons!")
end
if not isCreature(item2.uid) then
return doPlayerSendCancel(cid, "You can only use potions on pokemons!")
end
if not isPlayer(getCreatureMaster(item2.uid)) then
return doPlayerSendCancel(cid, "You cant use potions on wild pokemons.")
end
if getCreatureHealth(item2.uid) == getCreatureMaxHealth(item2.uid) then
return doPlayerSendCancel(cid, "This pokemon is already at full health.")
end
if getPlayerStorageValue(item2.uid, 173) >= 1 then
return doPlayerSendCancel(cid, "This pokemon is already under effects of potions.")
end
doCreatureSay(cid, ""..getCreatureName(item2.uid)..", take this potion!", TALKTYPE_SAY)
doSendMagicEffect(getThingPos(item2.uid), 172)
setPlayerStorageValue(item2.uid, 173, 1)
doRemoveItem(item.uid, 1)
local a = potions[item.itemid]
doHealOverTime(item2.uid, a.div, 100, a.effect)
return true
end









info
Grupo: Barão
Registrado: 10/11/07
Posts: 245
Reputação: +53
@Fagundes14
coloca seus moves na sua sign.
e para os moves não se perderem quando der goback é só add um atributo na ball.