Forum
Scripts
Armor Request
Armor Request
6 replies
1

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
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
function array(x)
	local a = {}
	for i = 1, 32 do
		a[i] = x
	end
	return a
end
plr = {}
plr.image = array(0)
armourPath = 'gfx/shadow.bmp'
addhook('collect', 'collectHook')
addhook('hit', 'hitHook')
addhook('leave', 'leaveHook')
function collectHook(id, iid, type)
	if type >= 79 and type <= 84 then
		if plr.image[id] == 1 then
			freeimage(plr.image[id])
		end
		if type == 79 then
			plr.image[id] = image(armourPath, 1, 0, 200 + id)
			plr.image[id] = 1
		else
			plr.image[id] = 0
		end
	end
end
function hitHook(id)
	if player(id, 'armor') == 201 then
		return 1
	end
end
function leaveHook(id)
	plr.image[id] = 0
end
Alistaire: i think you should freeimage(plr.image[id]) in the function leaveHook... Images are always freed on leaving. And dieing.
Alistaire: not working!
RealDespress28 has written
Alistaire: not working!Well that was the most bloody amazing description of any error ever.
1

Offline