Sound.PlayURL constant pos

Is there any way of setting the sound that plays from: sound.PlayURL to a constant position?
By this I mean if I set it to the players pos and he moves, it will continue to play in the previous position.
Any help would be appreciated.

Remove the other one and update the new one to follow the player?
But i guess that would be cpu intensive

So any better method?

You need the 3d flag, then in on the IGmodAudioChannel in the callback, do channel:SetPos( Vector )

Yes but whenever the player drives his car, the radio still continues to play in the last position. I’m trying to make it play in a constant position. So far I’ve made a pretty neat radio system and this is the only problem so far.

Just have a constant check if the position of the player moves, if it does, set the position of the audio channel to the players new position.

This is what is confusing me I guess. From what the user above is suggesting, I’m assuming you don’t want a constant position, but instead want it to act as if it was parented to a player? If so, think hook, SetPos to player’s position.

I did a constant timer instead since its clientside and I don’t think that ‘think hook’ works client-side, correct me if I’m wrong. But yea, seems to work. A shame sound.PlayURL doesnt work server-side.

Why do you keep saying constant so much?!

Also timer is a bad idea, the think hook works, you are just using it incorrectly, show code please.

Think hooks work client side…

I would probably try to use a faster hook like CreateMove or HUDPaint, though, so the changes are more smooth, but I don’t really know if using these would have any sort of impact on the performance.

No need, didn’t realize it worked on client too. I replaced the timer with the think. Just to make sure, no way of getting sound.PlayURL to work on server so others can hear it?


Use the net library. Let’s say your player wants to play a song, a net message is sent to the server, the server broadcasts a net message telling all the clients to do a sound.PlayURL, and have a think hook on the clients to update the IGmodAudioChannels appropriately.


Yeah but don’t be stupid and network it from the client to the server to other clients every frame.