Forum

> > CS2D > Scripts > freeimage on class change
Forums overviewCS2D overview Scripts overviewLog in to reply

English freeimage on class change

4 replies
To the start Previous 1 Next To the start

old freeimage on class change

En-Kay
User Off Offline

Quote
Hi everyone. So I made a code which creates an image like aura under specific class. The problem is aura is still there when I change class. How do I fix this?

old Re: freeimage on class change

Mora
User Off Offline

Quote
imag_btch (is name of your image)

1
2
imag_btch = image("gfx/shitclass/shitauta.png",blablabal)
freeimage(imag_btch)

old Re: freeimage on class change

En-Kay
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
sarmor = {}

-- WARLOCK
	if (sample.classes.class[id]==8) then
		parse ("setmaxhealth "..id.." 135")
		parse ("equip "..id.." 80")
		sarmor[id] = image ("gfx/sprites/Aura.bmp" ,0,0,id+100)
		 imageblend(sarmor[id],1)
		 imagecolor(sarmor[id],255,0,255)
		 tween_rotateconstantly(sarmor[id],1)
		return "86,47"
	end

end

addhook ("die","sarmor_remove")
function sarmor_remove (victim)
	freeimage(sarmor[victim])
end

This way it works, but when a player dies who is different class than this, it still tries to freeimage although he doesn't have it and then I get an error in console. If I put:

     if (sample.classes.class[id]==8) then

no error but the image is not removed on class change.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview