Forum

> > CS2D > Scripts > Painting Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Painting Script

6 replies
To the start Previous 1 Next To the start

old Painting Script

Jededias
User Off Offline

Quote
Can someone help me with this?
If player is in position 120(X) and 150 (Y) When it use mouse1, Will spawn one image called image1.png in the cursor direction

And if player is in position 125(X) and 150 (Y) When it use mouse1, Will spawn one image called image2.png in the cursor direction

If player say !removeimages the spawned images will be deleted

old Re: Painting Script

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
addhook("attack","makeImages")
function makeImages(id)
	local x = player(id,"tilex")
	local y = player(id,"tiley")
	if x == 120 and y == 150 then
		local img1 = image("path/of/your/image.png",0,0,0)
		imagerot(img1,player(id,"rot"))
	elseif x == 125 and y == 150 then
		local img2 = image("path/of/your/image2.png",0,0,0)
		imagerot(img2,player(id,"rot"))
	end
end
Partly made cause I was in a hurry. Anyone can finish this up.
edited 1×, last 10.08.14 03:44:15 pm

old Re: Painting Script

Jededias
User Off Offline

Quote
RiT, try it, here don't work, i create the img files and put in gfx and change the code but not work for me, please try it.

old Re: Painting Script

Zeik
User Off Offline

Quote
The problem was that the function "imagerot" doesn't exist.

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
images = {}
images.qty = 0

addhook("attack","makeImages")
function makeImages(id)
    local x = player(id,"tilex")
    local y = player(id,"tiley")
	if y == 150 then
		if x == 120 then
			images[images.qty] = image("gfx/image1.png",0,0,0)
			imagepos(images[images.qty],x*32+16,y*32+16,player(id,"rot"))
			images.qty = images.qty + 1
		elseif x == 125 then
			images[img_number] = image("gfx/image2.png",0,0,0)
			imagepos(images[img_number],x*32+16,y*32+16,player(id,"rot"))
			images.qty = images.qty + 1
		end
	end
end

addhook("say", "f_say")
function f_say(id, txt)
	if txt=="!removeimages" then
		for i=0, images.qty-1 do
			freeimage(images[i])
		end
		images.qty = 0
		return 1
	end
end

Don't know what you want the script to do anyway.

EDIT: Added the !removeimages command
edited 3×, last 10.08.14 06:33:54 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview