Untitled

mail@pastecode.io avatar
unknown
lua
a year ago
1.0 kB
6
Indexable
Never
local isRunning = false

local config = {
	minPorcentaje = 5.5,
	hpRange = {250000, 300000},
	segundos = 7,
	monstrarMsgs = true,
}

local function curarMonster(monsterCID)
	if isMonster(monsterCID) then
		doCreatureAddHealth(monsterCID, math.random(config.hpRange[1], config.hpRange[2]))
		doSendMagicEffect(getCreaturePosition(monsterCID), CONST_ME_MAGIC_BLUE)
		doCreatureSay(monsterCID, "Podeeer!", TALKTYPE_ORANGE_2)
		if config.monstrarMsgs then
			print("Recibiendo addEvent...")
		end
	end
end

function onStatsChange(cid, attacker, type, combat, value)
	if isMonster(cid) and isPlayer(attacker) then
		local hpPorcentaje = (getCreatureHealth(cid)/getCreatureMaxHealth(cid))*100
		if hpPorcentaje < config.minPorcentaje and not running then
			if config.monstrarMsgs then
				print("Enviando addEvent...")
			end
			
			doCreatureSay(monsterCID, "No eres rival para mi!", TALKTYPE_ORANGE_2)
			addEvent(curarMonster, config.segundos, cid)
		end
	end
	return true
end