Jump to content

Get Resource-Data From Resource?


Dealman

Recommended Posts

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? :P

Link to comment

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...