Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2214 215 216338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
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
_timer = 4
addhook("second", "countdown")
function countdown ()
	if _timer > 0  then
		msg(_timer.." seconds remaining...")
		parse("sv_sound countdwn_".._timer..".wav")
		_timer = _timer - 1
	elseif _timer == 0 then
		msg("FIGHT!@C")
		parse("sv_sound start.wav")
		for _, i in pairs(player(0,"table")) do
			if player(i,"health") > 0 then
				parse("speedmod " .. i .. " 0")
			end
		end
		_timer = -1
	end
end

addhook("startround","start")
function start()
	for _, id in pairs(player(0,"table")) do
		parse("speedmod "..id.." -100")
	end
	_timer = 4
end

I changed "timer" to "_timer" because timer is a function of CS2D. like a hook.
3× editiert, zuletzt 30.06.10 03:18:22

alt Re: Lua Scripts/Questions/Help

Stormtrooper595
User Off Offline

Zitieren
it works thanks. Now if i wanted to change color of the text to red or something how do i do that. is it in hex values or something?
1× editiert, zuletzt 30.06.10 04:43:00

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
@stormtrooper
replace the msg("FIGHT") and other msg with msg("©255000000FIGHT")

----
Is there a way to know if a player was flashed with the flashbang?

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
Ok, Im trying to do when you throw an Smoke it freeze's the one's it hit.

But i cant get it to work


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--Weapons--
addhook("projectile","hnsteam_smokecus")
function hnsteam_smokecus(id,weapon,x,y)
  if (weapon==53) then
     		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
     		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		return 1
	end
end

addhook("hit","hnsteam_smokefreeze")
function hnsteam_freeze(target,weapon)
  if (weapon==53) then
		parse("speedmod "..target.." -100")
		return 1
	end
end

Help Please

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
vesa-omar hat geschrieben
Ok, Im trying to do when you throw an Smoke it freeze's the one's it hit.

But i cant get it to work


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--Weapons--
addhook("projectile","hnsteam_smokecus")
function hnsteam_smokecus(id,weapon,x,y)
  if (weapon==53) then
     		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
     		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		return 1
	end
end

addhook("hit","hnsteam_smokefreeze")
function hnsteam_freeze(target,weapon)
  if (weapon==53) then
		parse("speedmod "..target.." -100")
		return 1
	end
end

Help Please




here it is..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
RANGE = 300

addhook("projectile","hnsteam_smokecus")
function hnsteam_smokecus(id,weapon,x,y)
	if (weapon==53) then
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 128')
		  
		for _i,v in ipairs(player(0,"table")) do
			if(_i ~= id) then
				local _x,_y = player(_i,"x"),player(_i,"y")
				local dx,dy = _x - x,_y-y
				local dist = math.sqrt(dx*dx + dy*dy)
				if dist<RANGE then
					parse("speedmod ".._i.." -100")
				end
			end
		 end
		return 1
	end
end

[quote = "StormTrooper"]
@stormtrooper
replace the msg("FIGHT") and other msg with msg("©255000000FIGHT")

----
Is there a way to know if a player was flashed with the flashbang?
[/quote]

Yes there is. But it's quite a work to do it. You'll have to find out the maximum range of the flashbang, and then if the player is inside that range, check if the walls don't stand in the way of the flashbang. Possible, but hard.

Ah well, i decided to script it, and here it is:

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
31
32
33
34
35
function flashed(p,fx,fy,flashradius)	
	local px,py = player(p,"x"),player(p,"y")
	local dx,dy = fx - px,fy-py		
	local dist = math.sqrt(dx*dx + dy*dy)
	
	if(dist > flashradius) then
		return false
	end

	local angle = (math.atan2(dy,dx) - math.pi / 2)%(math.pi)	
	if(fx >px) then
		angle = angle - math.pi
	end
	
	for i = 0,math.floor(dist),10 do
		local xt =fx +math.sin(angle)*i
		local yt = fy - math.cos(angle)*i					
		if(tile(xt/32,yt/32,"wall")) then
			return false
		end
	end
	return true
end


addhook("projectile","my_projectile")
function my_projectile(id,weapon,x,y)	
	if(weapon ==52) then
		for _i,_v in ipairs(player(0,"table")) do
			if(flashed(_i,x,y,500))then
				msg(player(id,"name").." flashed: "..player(_i,"name"))
			end
		end
	end
end
5× editiert, zuletzt 30.06.10 13:13:27

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
addhook("projectile","zhm_ammogiver")
function zhm_ammogiver(id,weapon,x,y)
	if (weapon==51) then
		parse("spawnitem 61 "..x.." "..y)
		parse("spawnitem 62 "..x.." "..y)
		return 1
	end
end

Umm im trying to do when you throw a HE 1st ammo and 2st ammo spawn's there you throwed it and after you throwed it you get a new HE

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
1
2
3
4
5
6
addhook("projectile","zhm_ammogiver")
function zhm_ammogiver(id,weapon,x,y)
if (weapon==51) then
parse ("equip "..id.." 51")
end
end

try this shit.
this may work.

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
Srry didnt work,

and i meant it spawns the item in the map not just equips it.
I need this couse im doing an mod called Zombie harm Mod
And the one that help's me will get credit's there

alt amx2d help lua...

resdiyer
User Off Offline

Zitieren
Hi guys I NEED amx2d help (pdf) file... i have this one year ago but i formatted my pc...

Who can give me amx2d pdf file link?

Because amx2d.co.cc is close?

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
vesa-omar hat geschrieben
Srry didnt work,

and i meant it spawns the item in the map not just equips it.
I need this couse im doing an mod called Zombie harm Mod
And the one that help's me will get credit's there


ahh just say this!

1
2
3
4
5
6
7
addhook("projectile","zhm_ammogiver")
function zhm_ammogiver(id,weapon,x,y)
     if (weapon==51) then
          parse("spawnitem 61 "..x*32.." "..y*32)
          parse("spawnitem 62 "..x*32.." "..y*32)
     end
end

Noooowww! it must work

x coords are in pixeles so you must convert them in fucking tiles...

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
addhook("projectile","zhm_ammogiver")
function zhm_ammogiver(id,weapon,x,y)
if (weapon==51) then
x = x  * 32
y = y * 32
parse("spawnitem 61 "..x.." "..y)
parse("spawnitem 62 "..x.." "..y)
end
end

creepy....

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
Omg realy scary it still dosent work's Oo
-- Nvm ill give u credit's for trying to help me anyway's
Ill just do somthing simple, When you press f2 you can buy Ammo and you lose 1k

But you can help me with this

1
2
3
4
5
6
7
8
9
addhook("hit","zhm_uspheal")
function zhm_uspheal(id,source,weapon,hpdmg,apdmg)
	if (weapon==1) then
		parse ("sethealth "..id.." "..player(id,"health")+20)
		parse('effect "fire" ' ..x.. ' ' ..y.. ' 140 96 0 0 0')
		msg2(id,"©000500000You got healed by "..player(p,"name").."")
		return 1
	end
end

When you hit some one it comes fire on him (dosent hurts) just that Effect comes on the guy you hit

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
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
31
32
33
34
35
function flashed(p,fx,fy,flashradius)     
     local px,py = player(p,"x"),player(p,"y")
     local dx,dy = fx - px,fy-py          
     local dist = math.sqrt(dx*dx + dy*dy)
     
     if(dist > flashradius) then
          return false
     end

     local angle = (math.atan2(dy,dx) - math.pi / 2)%(math.pi)     
     if(fx >px) then
          angle = angle - math.pi
     end
     
     for i = 0,math.floor(dist),10 do
          local xt =fx +math.sin(angle)*i
          local yt = fy - math.cos(angle)*i                         
          if(tile(xt/32,yt/32,"wall")) then
               return false
          end
     end
     return true
end


addhook("projectile","my_projectile")
function my_projectile(id,weapon,x,y)     
     if(weapon ==52) then
          for _i,_v in ipairs(player(0,"table")) do
               if(flashed(_i,x,y,500))then
                    msg(player(id,"name").." flashed: "..player(_i,"name"))
               end
          end
     end
end

YellowBanana did that code for you

That's the code wich show's if some one is flashed
Zum Anfang Vorherige 1 2214 215 216338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht