Untitled

mail@pastecode.io avatar
unknown
lua
a year ago
964 B
2
Indexable
Never
local isRunning = false

local monstros = {"Demon", "Triple Medusa", "Fire Elemental"}
local config = {
	minPorcentaje = 10,
	segundos = 7,
	monstrarMsgs = true,
}

local function crearMonster(monsterCID)
 for _, monstro in ipairs(monstros) do
        doCreateMonster(monstros, pos)
		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 isRunning then
			if config.monstrarMsgs then
				print("Enviando addEvent...")
			end
			
			doCreatureSay(cid, "No eres rival para mi!", TALKTYPE_ORANGE_2)
			addEvent(crearMonster, config.segundos, cid)
		end
	end
	return true
end