Forum

> > CS2D > Scripts > Armor Request
Forums overviewCS2D overview Scripts overviewLog in to reply

English Armor Request

6 replies
To the start Previous 1 Next To the start

old Armor Request

RealDespress28
BANNED Off Offline

Quote
Hi CS2D Players, i need a script that when you Equip light armor there's an image that it is like an armor with a new design and then when you get hit the player won't kill... need help! if it is hard... tell me.

old Re: Armor Request

EP
User Off Offline

Quote
why don't you change the light armor skin and check if the player has it equipped so they can't get hit?

old Re: Armor Request

Alistaire
User Off Offline

Quote
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
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

old Re: Armor Request

Alistaire
User Off Offline

Quote
user EP has written
@user Alistaire: i think you should freeimage(plr.image[id]) in the function leaveHook...


Images are always freed on leaving. And dieing.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview