Forum

> > CS2D > Scripts > Mouse -> img
Forums overviewCS2D overview Scripts overviewLog in to reply

English Mouse -> img

2 replies
To the start Previous 1 Next To the start

old Mouse -> img

Good day
User Off Offline

Quote
Hi all, I'm just a beginner and can not do it.
When the mouse pointer is on the coordinates (example x=1 y=1), the image is presented on the mouse pointer.
if the value of x is not equal to unity, then remove the image. Thx very much. Sry, my English is bad. D=

old Re: Mouse -> img

Rainoth
Moderator 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
img = image("path/of/the/image.png",0,0,0)
imagealpha(img,0)

addhook("ms100","a")
function a()
	for _,id in pairs (player(0,"table")) do
		reqcld(id,2)
	end
end

addhook("clientdata","b")
function b(id,mode,d1,d2)
	if mode == 2 then
		local tx = math.floor(d1/32)
		local ty = math.floor(d2/32)
		if tx == 1 and ty == 1 then
			imagealpha(img,1)
		else
			imagealpha(img,2)
		end
	end
end

Not the best method but my brain refuses to think right now so you'll have to do with this.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview