Forum

> > CS2D > Scripts > Painting Script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Painting Script

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Painting Script

Jededias
User Off Offline

Zitieren
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

alt Re: Painting Script

Rainoth
Moderator Off Offline

Zitieren
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.
1× editiert, zuletzt 10.08.14 15:44:15

alt Re: Painting Script

Jededias
User Off Offline

Zitieren
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.

alt Re: Painting Script

Zeik
User Off Offline

Zitieren
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
3× editiert, zuletzt 10.08.14 06:33:54
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht