hello,
i use pet system, if someone use "!support", then pet has been summoned, and player recive 12% hp and mana each 6sec.
All working corretly, but...
When someone use pet, and fast delete this pet, and use pet again, then he recived 2x of that bonus.
Tzn 2 functions "heal" are running at the same time.
Please help me guys :3
And have next question, its possible to make spell Mass healing (exura gran mas res), to heal only players?
i use pet system, if someone use "!support", then pet has been summoned, and player recive 12% hp and mana each 6sec.
All working corretly, but...
When someone use pet, and fast delete this pet, and use pet again, then he recived 2x of that bonus.
Tzn 2 functions "heal" are running at the same time.
Please help me guys :3
LUA:
local amount = 0.12 -- amount of hp
local times = 6 -- in sec
local name = "support shinobi" -- monster name , make sure that the monster is convinced
local storage = 6747 -- player who have this storage will be able to use
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE)
local function heal(cid)
local p = getThingPos(cid)
local mana = false
if(#getCreatureSummons(cid) >= 1) then
for _,pid in ipairs(getCreatureSummons(cid)) do
if string.lower(getCreatureName(pid)) == string.lower(name) then
mana = true
break
end
end
end
if mana == true then
doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*amount))
doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*amount))
doSendMagicEffect(getThingPos(cid),13)
addEvent(heal,times*1000,cid)
for _,pid in ipairs(getCreatureSummons(cid)) do
if string.lower(getCreatureName(pid)) == string.lower(name) then
break
end
end
end
return true
end
local function check(cid)
local checked = 0
local place = { x=0,y=0,z=0}
local h = getThingPos(cid)
local frompos = {x=h.x-2,y=h.y-2,z=h.z}
local topos = {x=h.x+2,y=h.y+2,z=h.z}
for g = frompos.x,topos.x do
for d = frompos.y,topos.y do
local poss = {x=g,y=d,z=h.z}
local tid = getTopCreature(poss).uid
if isMonster(tid) or isPlayer(tid) or getTilePzInfo(poss) == TRUE or doTileQueryAdd(cid, poss) ~= 1 then
checked = checked + 1
else
place.x = poss.x
place.y = poss.y
place.z = poss.z
break
end
end
end
if checked >= 25 then
return checked
elseif checked < 25 then
return place
end
return true
end
function onCastSpell(cid, var)
if getPlayerStorageValue(cid,4112) == 1 then
return doPlayerSendCancel(cid,"You are exhausted") and doSendMagicEffect(getThingPos(cid),2) and false
end
if getPlayerStorageValue(cid,6746) < 1 then
return doPlayerSendCancel(cid,"You must have all 6pets to summon this pet!") and doSendMagicEffect(getThingPos(cid),2) and false
end
if getPlayerStorageValue(cid,6747) < 1 then
return doPlayerSendCancel(cid,"You must have all 6pets to summon this pet!") and doSendMagicEffect(getThingPos(cid),2) and false
end
if getPlayerStorageValue(cid,6748) < 1 then
return doPlayerSendCancel(cid,"You must have all 6pets to summon this pet!") and doSendMagicEffect(getThingPos(cid),2) and false
end
if getPlayerStorageValue(cid,6749) < 1 then
return doPlayerSendCancel(cid,"You must have all 6pets to summon this pet!") and doSendMagicEffect(getThingPos(cid),2) and false
end
if getPlayerStorageValue(cid,6750) < 1 then
return doPlayerSendCancel(cid,"You must have all 6pets to summon this pet!") and doSendMagicEffect(getThingPos(cid),2) and false
end
if getPlayerStorageValue(cid,6751) < 1 then
return doPlayerSendCancel(cid,"You must have all 6pets to summon this pet!") and doSendMagicEffect(getThingPos(cid),2) and false
end
local search = false
if(#getCreatureSummons(cid) >= 1) then
for _,pid in ipairs(getCreatureSummons(cid)) do
if string.lower(getCreatureName(pid)) == string.lower(name) then
search = true
break
end
end
end
if search == true then
doPlayerSendCancel(cid,"You already have a "..string.lower(name).." summoned.")
doSendMagicEffect(getThingPos(cid),2)
return false
else
local f = getThingPos(cid)
local pos = {x=f.x+1,y=f.y,z=f.z}
if not tonumber(checkevent) then
doSummonMonster(cid, 'support shinobi')
stopEvent(heal)
heal(cid)
doCombat(cid,combat,var)
else
doPlayerSendCancel(cid,"You cant summon here.")
doSendMagicEffect(getThingPos(cid),2)
return false
end
return true
end
return true
end
And have next question, its possible to make spell Mass healing (exura gran mas res), to heal only players?