Forum

> > CS2D > Scripts > I dont know how to make laser lua
Forums overviewCS2D overview Scripts overviewLog in to reply

English I dont know how to make laser lua

9 replies
To the start Previous 1 Next To the start

old I dont know how to make laser lua

TheBosS_
User Off Offline

Quote
Hi Guys , ,

Can Someone help me plz ?

I need help in creating lua of laser . .

I want it same as that:

Laser Color Yellow: Freeze

Laser Color Blue: Heal Player

Laser Color Red: Bring Player To You

Laser Color Green: Let The Player Speed 10


Hope U May Help Me Guys . .

Thanks,
TheBosS_

old Re: I dont know how to make laser lua

Tobey
User Off Offline

Quote
You need to use mode with attack2 hook. The hook is triggered when you rightclick on a weapon to change its mode. So you have to check for Laser weapon equipped and its mode and insert what you wrote there properly.

old Re: I dont know how to make laser lua

TheBosS_
User Off Offline

Quote
user Tobey has written
You need to use mode with attack2 hook. The hook is triggered when you rightclick on a weapon to change its mode. So you have to check for Laser weapon equipped and its mode and insert what you wrote there properly.


hmm . . it is first time to hear the attack2 . . but how to let it for freezing ?

old Re: I dont know how to make laser lua

Happy eyes
User 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
23
24
25
26
27
28
laser_colour={}
for a=1,32 do
	laser_colour[a]=1
end

addhook('attack2','attack2')
function attack2(id,mode)
	laser_colour[id]=mode
end

addhook('hit','hit')
function hit(id,source,weapon,hpdmg,apdmg,rawdmg)
	if weapon == 45 then
		if laser_colour[source]==2 then
			parse('speedmod '..id..' -50')
			return 1
		elseif laser_colour[source]==3 then
			parse('sethealth '..id..' '..player(id,"maxhealth"))
			return 1
		elseif laser_colour[source]==1 then
			parse('setpos '..id..' '..player(source,"x")..' '..player(source,"y"))
			return 1
		else
			parse('speedmod '..id..' 10')
			return 1
		end
	end
end

old Re: I dont know how to make laser lua

MikuAuahDark
User Off Offline

Quote
user Happy eyes has written
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
laser_colour={}
for a=1,32 do
	laser_colour[a]=1
end

addhook('attack2','attack2')
function attack2(id,mode)
	laser_colour[id]=mode
end

addhook('hit','hit')
function hit(id,source,weapon,hpdmg,apdmg,rawdmg)
	if weapon == 45 then
		if laser_colour[source]==2 then
			parse('speedmod '..id..' -50')
			return 1
		elseif laser_colour[source]==3 then
			parse('sethealth '..id..' '..player(id,"maxhealth"))
			return 1
		elseif laser_colour[source]==1 then
			parse('setpos '..id..' '..player(source,"x")..' '..player(source,"y"))
			return 1
		else
			parse('speedmod '..id..' 10')
			return 1
		end
	end
end

you need to check if attack2 is triggered by laser(id 45)
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
laser_colour={}
for a=1,32 do
	laser_colour[a]=0
end

addhook("attack2","_attack2")
function attack2(id,mode)
	if player(id,"weapontype")==45 then
		laser_colour[id]=mode
	end
end

addhook("hit","_hit")
function hit(id,pl,weapon)
	if weapon == 45 then
		if laser_colour[pl]==2 then
			parse("speedmod "..id.." -50")
		elseif laser_colour[pl]==3 then
			parse("sethealth "..id.." "..player(id,"maxhealth"))
		elseif laser_colour[pl]==1 then
			parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
		elseif laser_colour[pl]==0
			parse("speedmod "..id.." 10")
		end
		return 1
	end
end

old Re: I dont know how to make laser lua

Tobey
User 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
23
24
25
26
27
28
29
laser_colour={}
for a=1,32 do
     laser_colour[a]=0
end

addhook("attack2","_attack2")
function attack2(id,mode)
     if player(id,"weapontype")==45 then
          laser_colour[id]=mode
     end
end

addhook("hit","_hit")
function hit(id,pl,weapon)
  if player(id,"usgn")==XXXXX or XXXXX or XXXXX then
     if weapon == 45 then
          if laser_colour[pl]==2 then
               parse("speedmod "..id.." -50")
          elseif laser_colour[pl]==3 then
               parse("sethealth "..id.." "..player(id,"maxhealth"))
          elseif laser_colour[pl]==1 then
               parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
          elseif laser_colour[pl]==0
               parse("speedmod "..id.." 10")
          end
          return 1
     end
  end
end

Would be the most simple and understandable version for you. You can also use a table or an array for it.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview