Forum
CS2D Scripts Lua Scripts/Questions/HelpWhere t is your table, n is your index or key and v is your value.
I want to select the five-seven laser is created.
Everything was fine with Usp (1) but the change (6) no longer works. What do I wrong?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
laser=initArray(32) laser01=initArray(32) addhook("select","laserz") function laserz(id,type,mode) 	if type == 6 then 		if (laser01[type] == 6) then 			laser01[type]=0 			freeimage(laser[type]) 		else 			laser01[type]=6 			laser[type]=image("gfx/!Huevitorojo Sprites/laser.png",1,1,200+type) 			imageblend(laser[type],1) 			imagecolor(laser[type],255,0,0) 			imagealpha(laser[type],0.7) 		end 		return 1 	end end
Zanahoria has written
Help me!
I want to select the five-seven laser is created.
Everything was fine with Usp (1) but the change (6) no longer works. What do I wrong?
I want to select the five-seven laser is created.
Everything was fine with Usp (1) but the change (6) no longer works. What do I wrong?
Why do you use [type] instead of id?
If you add players it will always give the player with id "type" the laser.
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
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
function initArray(m) 	local array = {} 	for i = 1, m 	do array[i]=0 	end 		return array end laser=initArray(32) laser01=initArray(32) addhook("select","laserz") function laserz(id,t,mode) if t == 1 then if (laser01[id] == 1) then laser01[id]=0 freeimage(laser[id]) else laser01[id]=1 laser[id]=image("gfx/!Huevitorojo Sprites/laser.png",1,1,200+id) imageblend(laser[id],1) imagecolor(laser[id],255,0,0) imagealpha(laser[id],0.7) end else 	-- If not selected the right weapon, Remove the laser. 		laser01[id]=0 		freeimage(laser[id]) end end
Something is wrong with the tabs, i don't know why.
Looks good in notepad++...
edited 1×, last 21.01.10 02:20:09 am
1)if I do it with another weapon, I do another?
2) i want make this with F3 and not F2
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
t = {12,"hi"} print(t[3]) -->Output: Nil t = {12,"hi"} table.insert(t,"hello") print(t[3]) -->Output: hello
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
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
x = 0 addhook("say","discot") function discot(p,t) 	if t == "disco" then 		test = image("gfx/sprites/flare1.bmp", player(p,"x"), player(p,"y"),1) 		testx = player(p,"x") 		testy = player(p,"y") 		imageblend(test,1) 		imagescale(test,2,2) 	end end addhook("ms100","sec") function sec() 	if test ~= nil then 		x = x + 30 		rand = math.random(1,3) 		if x < 360 then 			imagepos(test,testx,testy,x) 			imagecolor(test,x+80,x*2,x-100) 			imagescale(test,rand,rand) 		else 			x = 0 			imagepos(test,testx,testy,x) 		end 	end end
I just want make reload script sounds but dont know how fix it
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
--hooks addhook("reload","op4_rw") --funcs function op4_rw(id,mode) 	if (mode==1) then 		if (player(id,"weapontype")==30) then 			parse("sv_sound2 "..id.." \"lolwtf/ak47rld.wav\"") 		elseif (player(id,"weapontype")==32) then 			parse("sv_sound2 "..id.." \"lolwtf/m4a1rld.wav\"") 			end
TicTac has written
Help me .. it shows me a error how fix this?
I just want make reload script sounds but dont know how fix it
I just want make reload script sounds but dont know how fix it
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
--hooks addhook("reload","op4_rw") --funcs function op4_rw(id,mode) 	if (mode==1) then 		if (player(id,"weapontype")==30) then 			parse("sv_sound2 "..id.." \"lolwtf/ak47rld.wav\"") 		elseif (player(id,"weapontype")==32) then 			parse("sv_sound2 "..id.." \"lolwtf/m4a1rld.wav\"") 			end
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
addhook("reload","op4_rw") function op4_rw(id,m) wpn = player(id,"weapontype") 	if (wpn==30) then 		parse("sv_sound2 "..id.." \"lolwtf/ak47rld.wav\"") 	elseif (wpn==32) then 		parse("sv_sound2 "..id.." \"lolwtf/m4a1rld.wav\"") 	end end
What i need to change?
1
if p == 1 then
1
if p == 2 then
You should use right function parameters... You switched them.
Quote
serveraction(id,action)
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
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
function initArray(m) 	local array = {} 	for i = 1, m do 		array[i]=0 	end 	return array end light01=initArray(32) light=initArray(32) addhook("serveraction","menuss") function menuss(id,button) 	if button == 2 then 		if (light01[id] == 1) then 			light01[id]=0 			freeimage(light[id]) 		else 			light01[id]=1 			light[id]=image("gfx/!Huevitorojo Sprites/linterna.png",1,1,200+id) 			imageblend(light[id],1) 			imagecolor(light[id],200,200,100) 			imagealpha(light[id],0.7) 		end 	end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Explosive -- if (sample.zombie.class[id]==6) then if (player(id,"team")==1) then parse ("setmaxhealth "..id.." 120") parse ("speedmod "..id.." -4") parse ("equip "..id.." 51") msg2(id,"©255000000Class:Explosive") 	 sample.zombie.teleports[id]=0 end end 	function explosion(x, y, size, damage) 	parse("explosion "..x.." "..y.." "..size.." "..damage) 	end 	addhook("die","explode") 	function explode(id,x,y) 		if (sample.zombie.class[id]==6) then 		explosion(x,y,300, 300) 		end 	end
But what was the little problem?
Blazzingxx has written
You should use right function parameters... You switched them
Again, you switched player ID and button parameters.
So in your script button was player id.
And player ID was button.
redefinder has written This is supposed to make an explosion on the place where the player is killed,but instead it makes an explosion on a specific place of the map.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Explosive -- if (sample.zombie.class[id]==6) then if (player(id,"team")==1) then parse ("setmaxhealth "..id.." 120") parse ("speedmod "..id.." -4") parse ("equip "..id.." 51") msg2(id,"©255000000Class:Explosive") sample.zombie.teleports[id]=0 end end function explosion(x, y, size, damage) parse("explosion "..x.." "..y.." "..size.." "..damage) end addhook("die","explode") function explode(id,x,y) if (sample.zombie.class[id]==6) then explosion(x,y,300, 300) end end
someone help me plz