Forum

> > CS2D > Scripts > Different sounds playing after team wins.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Different sounds playing after team wins.

10 replies
To the start Previous 1 Next To the start

old Different sounds playing after team wins.

D-D3ADxPro
User Off Offline

Quote
As you can see, im trying to create a script, when after any team wins, a sound will be played. I need it to play different sounds instead of the same sound over and over

Here was the script that i tried to use:
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
addhook("endround", "end_of_round")
function ctwin()
	a = math.random(1,2)
parse(string.format("sv_sound \"amxserv/CT-1.ogg\"", a))
else
	parse(string.format("sv_sound \"amxserv/CT-2.ogg\"", a))
end

function twin()
     a = math.random(1,3)
parse(string.format("sv_sound \"amxserv/T-1.ogg\"", a))
else
	parse(string.format("sv_sound \"amxserv/T-2.ogg\"", a))
end

function end_of_round(mode)
     if mode==1 then --Regular T win
          twin()
     elseif mode==2 then --Regular CT win
          ctwin()
     elseif mode==3 then --Round draw
     elseif mode==4 then --Game commencing
     elseif mode==10 then --VIP assassinated; T win
          twin()
     elseif mode==11 then --VIP escaped; CT win
          ctwin()
     elseif mode==12 then --VIP did not escape; T win
          twin()
     elseif mode==20 then --Bomb exploded; T win
          twin()
     elseif mode==21 then --Bomb defused; CT win
          ctwin()
     elseif mode==22 then --Failed to plant the bomb in specified time; CT win
          ctwin()
     elseif mode==30 then --Failed to rescue hostages in specified time; T win
          twin()
     elseif mode==31 then --All hostages rescued; CT win
          ctwin()
     elseif mode==40 then --Blue flag captured; T win
          twin()
     elseif mode==41 then --Red flag captured; CT win
          ctwin()
     elseif mode==50 then --All points dominated; T win
          twin()
     elseif mode==51 then --All points dominated; CT win
          ctwin()
     elseif mode==60 then --All humans infested; Zombies win
     elseif mode==61 then --Humans survived; Humans win
     end
end

But in console, I get a lua error that says:
1
LUA ERROR: sys/lua/wroundsound.lua:5: 'end' expected (to close 'function' at line 2) near 'else'

Does anyone know how to fix this lua error?

old Re: Different sounds playing after team wins.

EP
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
function ctwin()
	local a = math.random(1,2)
	parse(string.format("sv_sound sfx/amxserv/CT-%s.ogg",a))
end

function twin()
	local a = math.random(1,2)
	parse(string.format("sv_sound sfx/amxserv/T-%s.ogg",a))
end
i guess these new functions will work, replace them with the old ones and test it!

edit: oh f***, how couldn't i notice dat
edited 1×, last 09.06.13 05:59:20 pm

old Re: Different sounds playing after team wins.

D-D3ADxPro
User Off Offline

Quote
Oh, it works! I just forgot to put sfx in front of it

EDIT: Now it stopped working?

Im not sure how to make it exactly play the sounds i want it to, because in console, it shows this:

1
ERROR: cannot play sound 'sfx/misc/ctwinnar3.wav' - file does not exists (sv_sound)

Something is making it always play sfx/misc/ctwinnar3.wav
edited 1×, last 09.06.13 07:04:50 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview