1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
invincible = {}
for id=1,32 do invincible[id] = false end
addhook("hit","check_invincibility")
function check_invincibility(id)
	if invincible[id] == true then
		return 1
	end
end
function clear_invincibility(id)
	-- convert id to number
	-- because timer() passes parameters as a string
	id = tonumber(id)
	invincible[id] = false
end
addhook("spawn","make_invincible")
function make_invincible(id)
	invincible[id] = true
	-- clear invincibility in 3 seconds
	timer(3000,"clear_invincibility",id)
end