Trying to set the location of a Sound3D every gametick to the location of the car that is being driven, to mimic a car radio. Both the car ("carplaying") and the Sound3D ("radio") are global variables that hold the id's. As of writing using SetSound3DLocation doesn't do anything. I first chalked it up to me making a mistake but the game has no problem accessing the car and sound variables and comparing the location of the two. Not entirely convinced I haven't made a mistake but figured I'd post it anyway. Here's the code where I try to change the location of the sound:
Code:
local x, y, z = GetVehicleLocation(carplaying)
if GetVehicleLocation(carplaying) ~= GetSound3DLocation(radio) then
SetSound3DLocation(radio, x, y, z)
AddPlayerChat("Radio id ="..radio..".")
AddPlayerChat("Radio: "..GetSound3DLocation(radio))
AddPlayerChat("Car id ="..carplaying..".")
AddPlayerChat("Car: "..GetVehicleLocation(carplaying))
end

Comment