Xogy / xsound

Improved audio library for FiveM
MIT License
115 stars 82 forks source link

Play client sound & play entity sounds #18

Closed Flek26 closed 2 years ago

Flek26 commented 2 years ago

Is your feature request related to a problem? Please describe. Yes, I get very frustrated when I try to play sound on a player. For example, we use xsound for our phone, and we use it for ringtones as well as a music app. We current are using the PlayURLPos() function, which works great when standing still. As soon as you start running or driving, the sound lags behind because the refresh rate is too slow. Even when I make it really short refresh, it still lags behind when going over 100mph. I am requesting two features here.

PlayOnEntity - it emits the sound from the entity (player) and moves as the character moves, no need to update position.

The MOST important feature I would like is PlayURLClient() - the ability to play a sound for ONLY a specific client, not anyone else. Basically the PlayURL() but only send it to one player, not everyone.

Describe alternatives you've considered I tried playing around with the refresh rate and none of it worked as intended, as well as changing the ranges and that didnt work either.

Xogy commented 2 years ago

I would recommend reading the docs again because the music isn't synced at all so if you choose to play for all clients it is your fault that you have chosen it, not the API.

There are functions on the server-side such as "PlayUrlPos(source, name, URL, volume, Vector3 vec, loop)" and if you put "-1" on the source argument then it makes sense since you're telling the script to play it on all clients.

I admit the API isn't great for fast-moving sounds but there isn't anything I can do.

Flek26 commented 2 years ago

No its not a bug, its a feature request. I use the PlayURLPos, and play it on just the one client. But anyone in that area can hear it. I want a feature to only play it to the client i pick. Meaning only that person hears it

Xogy commented 2 years ago

No its not a bug, its a feature request. I use the PlayURLPos, and play it on just the one client. But anyone in that area can hear it. I want a feature to only play it to the client i pick. Meaning only that person hears it

And like I said above, if you're using exports from server side

image

Stop putting -1 as a source.


And if you're using it from client

image

So as you can see it is client-sided only and doesn't sync with anyone else you gotta step up and check your phone what you're doing wrong. it ain't fault of my API at all.