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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
function initArray(m) local array = {} for i = 1, m do array[i] = 0 end return array end if hp == nil then hp = {} end local hp = initArray(32,0) addhook("startround","_startround") function _startround(mode) local players = player(0,'table') for i = 1, #players do local id = players[i] local terrorist = player(0,'team1') for i = 1, #terrorist do local t = terrorist[i] if player(id,'team') == 1 then hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,t) imageframe(hp[id],1) end end local counterterrorist = player(0,'team2') for i = 1, #counterterrorist do local ct = counterterrorist[i] if player(id,'team') == 2 then hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,ct) imageframe(hp[id],1) end end end end addhook("hit","_hit") function _hit(id,source,weapon,hpdmg,apdmg,rawdmg,object) timer(0,"_HP") function _HP() local terrorist = player(0,'team1') for i = 1, #terrorist do local t = terrorist[i] if player(id,'team') == 1 then if player(id,'health') <= 30 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,t) imageframe(hp[id],5) elseif player(id,'health') >= 31 and player(id,'health') <= 47 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,t) imageframe(hp[id],4) elseif player(id,'health') >= 48 and player(id,'health') <= 64 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,t) imageframe(hp[id],3) elseif player(id,'health') >= 65 and player(id,'health') <= 81 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,t) imageframe(hp[id],2) end end end local counterterrorist = player(0,'team2') for i = 1, #counterterrorist do local ct = counterterrorist[i] if player(id,'team') == 2 then if player(id,'health') <= 30 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,ct) imageframe(hp[id],5) elseif player(id,'health') >= 31 and player(id,'health') <= 47 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,ct) imageframe(hp[id],4) elseif player(id,'health') >= 48 and player(id,'health') <= 64 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,ct) imageframe(hp[id],3) elseif player(id,'health') >= 65 and player(id,'health') <= 81 then freeimage(hp[id]) hp[id] = image('<spritesheet:gfx/cs2dbr/hp/HP.png:32:64:n>',0,1,id+200,ct) imageframe(hp[id],2) end end end end end