Jump to content

Playing 3d sounds for more than the local player?


cokacola

Recommended Posts

Okay, i am making a custom radio, with a selection of songs, but my problem is, that playSound3D only works for the local player.

Is there someway to make it play for all players within a certain distance from the players car?

maybe some form of code that checks a players distance and then uses playSound3D for them?

i must admit, i was disappointed that 3d sounds only worked for the local player :P(BTW, i am trying to keep it clientside, as the radio is a GUI with a list of songs)

Link to comment

You only need to notify other clients a sound is running. You can do this using:

1. Events. (triggerServerEvent + triggerClientEvent)

2. Element data, which is also synced in (most) occasions. (setElementData. Note though that this is only recommended for a low amount of uses. Doesn't require any server-side code though)

If you want to know the distance, just supply the target position/element and let the client decide if he's inside the range or not.

Link to comment

I have found a rather weird problem, I had a few songs at first, and it worked.

I now have 9 songs, and it fails to download them, the only way you can use it without being disconnected, is to copy the songs to the radio3d resource folder in your MTA client downloaded mods..

its only on my local server, but thats abit of a problem(BTW, it came to about 25-30 MB, if its just an MTA limit)

but anyway, it works good after I have copied them :P

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