Forum

> > CS2D > Scripts > Stopsound for a certain user only
Forums overviewCS2D overview Scripts overviewLog in to reply

English Stopsound for a certain user only

8 replies
To the start Previous 1 Next To the start

old Stopsound for a certain user only

mrc
User Off Offline

Quote
When you join my server you will hear a sound just for you:

1
2
3
4
addhook('join', 'SoundOnJoin')
function SoundOnJoin(id)
	parse("sv_sound2 "..id.." music.ogg")
end

And when you choose a look (skin) the sound will stop:

1
2
3
4
5
6
addhook("team","stopsound")
function stopsound(id,team,look)
	if look >= 0 then
		parse("sv_stopsound "..id.." music.ogg")
	end
end

But the problem is, if I'm listening the music and OTHER player joins and select a look (skin) the sound stop for me but it may stop just for him. Anyone knows how to fix this?

old Re: Stopsound for a certain user only

DC
Admin Off Offline

Quote
user TrialAndError has written
It's weird how cs2d cmd sv_stopsound is "sv_stopsound <soundfile> <player>" but cs2d cmd sv_sound2 is "sv_sound2 <player> <soundfile>". Try swapping the parameters in your
parse("sv_stopsound "..id.." music.ogg")

Yes, it's weird and confusing. I agree.
The reason for the swapped parameter order is that cs2d cmd sv_stopsound originally had only one parameter. The second parameter (player) has been added later on. I always have to append new parameters to the end to keep commands compatible with existing scripts.

I just improved the documentation accordingly.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview