Forum

> > CS2D > Scripts > Stopsound for a certain user only
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Stopsound for a certain user only

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Stopsound for a certain user only

mrc
User Off Offline

Zitieren
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?

alt Re: Stopsound for a certain user only

DC
Admin Off Offline

Zitieren
user TrialAndError hat geschrieben
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht