C# scripting: "ref Vector3" parameters of natives don't output anymore

GTA V version? Latest.
Up to date? Yes.
Legit or Pirate copy? Legit.
Steam/CD/Social Club? Steam version.
Windows version? Windows 10 May 2019 Update.
Did you try to delete caches.xml and try again? Yes.
Error screenshot (if any)
None.
System specifications
CPU: Intel Core i7 2600 @ 3.40 GH/z
GPU: Nvidia GeForce GTX 670
RAM: 16GB DDR3
What did you do to get this issue?
The ref Vector3 parameters of natives don’t output anymore.
What server did you get this issue on?
All of my servers.
CitizenFX.log file
.dmp files/report IDs
No crashes were experienced and I believe the log isn’t needed for this type of bug report, as no errors are printed in the console.

After today’s FiveM update, I’ve noticed that the “ref Vector3” parameters of natives (this is on C#, I’m not sure if LUA is affected by this), such as GetModelDimensions and GetClosestVehicleNodeWithHeading, do not output anything. Now, this has caused an enormous amount of problems on my server, such as vehicles spawning at x: 0, y: 0, z: 0 and cameras clipping through vehicles.
I may be wrong, but I’m fairly certain this problem has been caused by this specific commit:

Here’s a simple repro script, press E or dpad right on the controller to retrieve the dimensions of your current vehicle, then open the client console to view them. The expected result is anything other than zeros. The same applies to the GetClosestVehicleNodeWithHeading native, the position parameter always ends up being x: 0, y: 0, z: 0.


testscript.zip (3.0 KB)

using CitizenFX.Core;
using System.Threading.Tasks;
using static CitizenFX.Core.Native.API;

namespace TestScript
{
    public class TestScript : BaseScript
    {
        public TestScript()
        {
            Tick += OnTick;
        }

        private async Task OnTick()
        {
            if (IsControlJustPressed(0, 51)) //E or dpad right
            {
                int PlayerPed = PlayerPedId();
                int OwnVehicle = GetVehiclePedIsIn(PlayerPed, false);

                if (DoesEntityExist(OwnVehicle))
                {
                    uint OwnVehicleModel = (uint)GetEntityModel(OwnVehicle);
                    Vector3 minimumDimensions = new Vector3();
                    Vector3 maximumDimensions = new Vector3();
                    GetModelDimensions(OwnVehicleModel, ref minimumDimensions, ref maximumDimensions);
                    Debug.WriteLine("Xmin: " + minimumDimensions.X + " Ymin: " + minimumDimensions.Y + " Zmin: " + minimumDimensions.Z + " Xmax: " + maximumDimensions.X + " Ymax: " + maximumDimensions.Y + " Zmax: " + maximumDimensions.Z);
                }
            }

            await Task.FromResult(0);
        }
    }
}
3 Likes

I am having the same issues with my server and I thought I was doing something wrong. My server was completely fine before.

It appears that while refactoring native invocation, a call to rage::scrThread::Info::CopyReferencedParametersOut was forgotten to be replicated, and this escaped testing.

This should be fixed ~15 minutes from now.

You are a life saver! Thank you. :smiley: