Forum

> > CS2D > Scripts > sv_stopsound to id doesn't works
Forums overviewCS2D overview Scripts overviewLog in to reply

English sv_stopsound to id doesn't works

18 replies
To the start Previous 1 Next To the start

old sv_stopsound to id doesn't works

Promaster
User Off Offline

Quote
SV_Stopsound

Sv_Stopsound doesn't work for "id"!
I had a SV_sound2 file open, i couldn't stop the sound for one id player. But the Sv_Stopsound for the whole server works (when i trigger sv_stopsound without puting any id after the sound file name)!

Idk if i am doing it wrong or can someone help me?

1
2
3
4
5
6
7
8
9
10
11
addhook("use","testuse")
function testuse(id,event,data,x,y)
		parse("sv_sound2 " .. id .. " Lunia/BossWarning_Drake.ogg")
end


addhook("flashlight","Testflash")
function Testflash(id)
		parse("sv_stopsound  Lunia/BossWarning_Drake.ogg " .. id .. "")
		print("Triggered")
end

The print triggers but the sounds doesn't stop for my id when i flashlight

old Re: sv_stopsound to id doesn't works

BcY
Reviewer Off Offline

Quote
I tested it with both ways. It looks like it's not working with id.(stopsound)

1
2
3
4
5
6
7
8
9
10
11
addhook("use","testuse")
function testuse(id,event,data,x,y)
          parse("sv_sound2 "..id.." menu.wav")
end


addhook("flashlight","Testflash")
function Testflash(id)
          parse("sv_stopsound menu.wav")
          print("Triggered")
end
This one is working.

old Re: sv_stopsound to id doesn't works

BcY
Reviewer Off Offline

Quote
I'm not sure but maybe id is not defined for sv_stopsound. I mean maybe @user DC or @user SQ: forgot about it.
sv_stopsound soundname is working well but with id it's not. It looks like its overlooked.

old Re: sv_stopsound to id doesn't works

DC
Admin Off Offline

Quote
Yes, I think there is a bug with it and I also think that it already has been reported before. I didn't check it myself yet and we did not fix anything related to this in 1.0.0.3.

old Re: sv_stopsound to id doesn't works

Masea
Super User Off Offline

Quote
@user Mami Tomoe: Do you even know what is that function for? You were probably using it for timer when you actually don't know how to use. We use that function for transforming the numbers which are in strings to completely numbers. Maybe we can use that for anything else but this is the only thing I know so far.
1
2
local s = "3"
local ss = tonumber(s) >> 3
You can use tostring either.
1
2
local s = 3
local ss = tostring(s) >> "3"

old Re: sv_stopsound to id doesn't works

DC
Admin Off Offline

Quote
It does hurt. It's basically waste of performance, even if the impact is absolutely negligible.

user Masea and user Waldin are right. It will not help. Converting something to a number just to convert it back to a string in the next step can't change anything. You don't even need to try because logic tells us that it can't work.

tonumber makes sense for the cs2d lua cmd game command but it never makes sense when you use the value directly (without using mathematical operations first) in cs2d lua cmd parse because parse operates on a string anyway.

old Re: sv_stopsound to id doesn't works

Masea
Super User Off Offline

Quote
@user Mami Tomoe: We don't need to try that if we already know what's gonna happen

Oh guys, really? This is the first time that I examined the thread itself carefully and entirely and can't believe in you who couldn't fix this thingy already Here it is, boy:
parse('sv_stopsound "Lunia/BossWarning_Drake.ogg" '..id)


Lmao, neither there is a bug, nor user Promaster knows how to use that command, so does user DC. It fucking surprised me.
edited 1×, last 16.05.17 09:28:28 pm

old Re: sv_stopsound to id doesn't works

Masea
Super User Off Offline

Quote
@user Mami Tomoe: Trust me it's not. When we're going to stop a sound, we'd absolutely specify a sound since that command is mostly and actually fully about sound. But ID parameter is up to people, they may want or not.

old Re: sv_stopsound to id doesn't works

DC
Admin Off Offline

Quote
Good point. It's true. That's quite inconsistent. Sorry for that. But these things happen when you have hundreds of commands
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview