Forum

> > CS2D > Scripts > Where to and how to place freeimage ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Where to and how to place freeimage ?

2 replies
To the start Previous 1 Next To the start

old Where to and how to place freeimage ?

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
addhook("second","checkwep")
function checkwep()
local itemlist=playerweapons(1,91)
  for _,id in pairs(itemlist) do
	 local guns = false
   		if itemtype(id,"name")=="Knife" or itemtype(id,"name")== "Smoke grenade" then
		image('gfx/sprites/text2.bmp',0,0,101)
  		else
  		 image('gfx/sprites/text1.bmp',0,0,101)
  		end
  end
end

My fellow friend helped me a little but I'm not sure how to add freeimage(id) so it would display only one image.. Thanks for your help.

old Re: Where to and how to place freeimage ?

Alistaire
User Off Offline

Quote
Damn it dude, add bloody arrays to store the images.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function array()
	local a = {}
	for i = 1, 32 do
		a[i] = 0
	end
	return a;
end

image = {text = array()}

--Then in your crappy second hook

image.text[id] = image(etc etc)

--And to free the image

freeimage(image.text[id])

Just take a look at e.g my WornWeapons script. It's pretty much what you want to do with your script, afaik.

old Re: Where to and how to place freeimage ?

Rainoth
Moderator Off Offline

Quote
user Alistaire has written
Damn it dude, add bloody arrays to store the images.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function array()
	local a = {}
	for i = 1, 32 do
		a[i] = 0
	end
	return a;
end

image = {text = array()}

--Then in your crappy second hook

image.text[id] = image(etc etc)

--And to free the image

freeimage(image.text[id])

Just take a look at e.g my WornWeapons script. It's pretty much what you want to do with your script, afaik.


I would but when I look at something you made my brain explodes and I understand completely nothing
Thanks for solution though
EDIT : About WW script. I tried I TRIED and I failed ...
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview