Forum

> > CS2D > Scripts > Lua Sound needed
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Sound needed

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua Sound needed

itsoxymoron
User Off Offline

Zitieren
• Hey guys, I need a lua, when you pick up an item (dont know, maybe ID 2,73,etc), this make a sound. too easy.

I tried but I cant , so, thx.

alt Re: Lua Sound needed

Kel9290
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
YOUR_ITEM_ID = 50 -- item id

addhook("collect","cc")
function cc(id,iid,type)
	if type = YOUR_ITEM_ID then
		parse("sv_sound fun/thats_the_way.wav")
	end
end

alt Re: Lua Sound needed

Apache uwu
User Off Offline

Zitieren
Probably should change that to sv_sound2, so no one else will hear the pickup sound.

1
parse("sv_sound2 "..id.." fun/thats_the_way.wav")
2× editiert, zuletzt 17.09.11 06:29:26

alt Re: Lua Sound needed

Apache uwu
User Off Offline

Zitieren
I believe it's walkover, not collect. Collect means picking up primary ammo/sec.

1
2
3
4
5
6
7
8
9
10
item_snd={}
item_snd[50]="fun/thats_the_way.wav"

addhook("walkover","_walkover")

function _walkover(id,iid,type,ain,a,mode)
	if item_snd[tonumber(type)]~=nil then
		parse("sv_sound2 "..id.." "..item_snd[tonumber(type)])
	end
end

Now if you want to add any new sounds you can just use this syntax.

1
item_snd[item_id]="sound file"

alt Re: Lua Sound needed

itsoxymoron
User Off Offline

Zitieren
user Apache uwu hat geschrieben
I believe it's walkover, not collect. Collect means picking up primary ammo/sec.

1
2
3
4
5
6
7
8
9
10
item_snd={}
item_snd[50]="fun/thats_the_way.wav"

addhook("walkover","_walkover")

function _walkover(id,iid,type,ain,a,mode)
	if item_snd[tonumber(type)]~=nil then
		parse("sv_sound2 "..id.." "..item_snd[tonumber(type)])
	end
end

Now if you want to add any new sounds you can just use this syntax.

1
item_snd[item_id]="sound file"


Good, Thx, but i have a problem, make a sound every time when you step on the item, it possible to have a delay. or dont do it again?

EDIT

Fixed!: I change the
1
("walkover","_walkover")


for
1
("collect","cc")


Thank you so much!
1× editiert, zuletzt 19.09.11 04:25:13

alt Re: Lua Sound needed

Apache uwu
User Off Offline

Zitieren
Well potentially the sound file should be fairly short (0.1-1 sec), anything longer it would be annoying for the client to pick up a weapon.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht