1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function Array(m, v)
	local T = {}
	for i = 1, m do
		T[i] = v
	end
	return T
end
Poison = Array(32, 0)
MaxPoisonTime = 10 -- limit of time of poison
PoisonDamage = 5 -- damage per second when poisoned
PoisonedWeapons = { [1] = 2} -- [weapon] = poison points per hit
addhook("second", "HookSecond",999)
HookSecond = function()
	for _, id in pairs(player(0, "tableliving")) do
		if Poison[id] > 0 then
			local health = (player(id, "health") - PoisonDamage)
			if health <= 0 then
				parse('customkill '..id..' "Poison" '..id)
			else
				parse("sethealth "..id.." "..health)
			end
			Poison[id] = Poison[id] - 1
			parse('effect "colorsmoke"'..player(id, "x").." "..player(id, "y").."30 15 000 128 128")
		end
	end
end
addhook("hit", "HookHit",999)
HookHit = function(id, src, wpn)
	if game("sv_friendlyfire") == "1" or player(id, "team") ~= player(src, "team") or game("sv_gamemode") == 1 then
		for k,v in pairs(PoisonedWeapons) do
			if wpn == k then
				Poison[id] = Poison[id] + v
				if MaxPoisonTime < Poison[id] then
					Poison[id] = MaxPoisonTime
				end
			end
		end
	end
end
addhook("spawn", "HookSpawn",999)
HookSpawn = function(id)
	Poison[id] = 0
end
addhook("collect", "HookCollect")
HookCollect = function(id, iid, typ)
	if typ == 64 or typ == 65 then
		Poison[id] = 0
	end
end