Dealman Posted November 17, 2014 Share Posted November 17, 2014 Earlier today I thought I'd make a simple script that automatically mutes music played from maps, now this all good and easy using either destroyElement or onClientSoundStarted. However, since the event is so poorly made - there is no way(as far as I know) to get from where the sound was started. And the issue comes down to that it stops all sounds, even the countdown and sounds started via a music player. I know there are some poor workarounds you could do using timers and other events - but I would rather not, as it wouldn't be guaranteed to work. So I started to play around a bit, at first, I did this; outputChatBox("Parent Type: ["..tostring(getElementType(getElementParent(source)))).."]"); And this returned "map". And since that was of no use to me, I tried to get the parent of that parent, like this; outputChatBox("Parent Type: ["..tostring(getElementType(getElementParent(getElementParent(source))))).."]"); And low and behold, this returned resource. However, I'm not sure whether I'm blind or not - because I can not seem to get the resource name of this resource. Since all it gives me is "expected resource-data at argument 1, got resource". Could anyone else think of a nifty solution to this as 98% of all songs on DM maps are as bad as they possibly could be? Link to comment
Derpy Posted November 17, 2014 Share Posted November 17, 2014 um this is possibly useless post of mine but just to let you know most of songs are named music.mp3 so basically u can "block" that name and filetype of music it would solve 95% of music problems this is probably useless post because it wouldnt totally get rid of all songs in maps Link to comment
Bonsai Posted November 17, 2014 Share Posted November 17, 2014 It might be possible to get all Songs by getElementsByType, and then check for its length. Just not sure right now if you can get any sound element, or just the ones of the current resource. Link to comment
Derpy Posted November 17, 2014 Share Posted November 17, 2014 you could also make a list of allowed sounds and if sound isnt allowed,destroy it Link to comment
Dealman Posted November 17, 2014 Author Share Posted November 17, 2014 It might be possible to get all Songs by getElementsByType, and then check for its length.Just not sure right now if you can get any sound element, or just the ones of the current resource. I actually thought about this, and I guess it would work to some degree. It might still interfere with the music player, though. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now