B2060 Crash - SetPlayerModel()

Game crash to desktop when using the native SetPlayerModel on b2060.

Crash Details
Legacy Code: ohio-green-low

Logfile Output
[    217547] [b2060_GTAProce]             MainThrd/ [skin] Trying to load model! Model: 1885233650
[    217547] [b2060_GTAProce]             MainThrd/ Model Requested: 1885233650
[    217703] [b2060_GTAProce]             MainThrd/ Model loaded!
[    217718] [b2060_GTAProce]             MainThrd/ Model is valid! Setting now!
[    217718] [b2060_GTAProce]             MainThrd/ InvokeNative: execution failed: Error executing native 0x00a1cadd00108836 at address 0x1407baccc.
[    217734] [b2060_GTAProce]             MainThrd/ Execution of native 00a1cadd00108836 in script host failed: Error executing native 0x00a1cadd00108836 at address 0x1407baccc.
[    223015] [b2060_DumpServ]                18964/ Process crash captured. Crash dialog content:
[    223031] [b2060_DumpServ]                18964/ FiveM_b2060_GTAProcess.exe+6C9BE7
[    223031] [b2060_DumpServ]                18964/ An error at FiveM_b2060_GTAProcess.exe+6C9BE7 caused FiveM to stop working. A crash report is being uploaded to the FiveM developers.
[    223047] [b2060_DumpServ]                18964/ 
[    223047] [b2060_DumpServ]                18964/ Legacy crash hash: ohio-green-low
[    223062] [b2060_DumpServ]                18964/ Stack trace:
[    223062] [b2060_DumpServ]                18964/   FiveM_b2060_GTAProcess.exe+6C9BE7
[    223062] [b2060_DumpServ]                18964/   FiveM_b2060_GTAProcess.exe+6C9B9A
[    223078] [b2060_DumpServ]                18964/   FiveM_b2060_GTAProcess.exe+919DE0
[    223078] [b2060_DumpServ]                18964/   gta-core-five.dll!rage::RunEntries (0x1a1) (<A HREF="https://github.com/citizenfx/fivem/blob/master/code/components/gta-core-five/src/GameSkeleton.cpp#L181">GameSkeleton.cpp:181</A>)
[    223109] [b2060_DumpServ]                18964/   gta-core-five.dll!rage::RunEntries (0x1a1) (<A HREF="https://github.com/citizenfx/fivem/blob/master/code/components/gta-core-five/src/GameSkeleton.cpp#L181">GameSkeleton.cpp:181</A>)
[    223125] [b2060_DumpServ]                18964/   gta-core-five.dll!rage::RunEntries (0x172) (<A HREF="https://github.com/citizenfx/fivem/blob/master/code/components/gta-core-five/src/GameSkeleton.cpp#L181">GameSkeleton.cpp:181</A>)
[    223140] [b2060_DumpServ]                18964/   gta-core-five.dll!rage::gameSkeleton::RunUpdate (0x1c1) (<A HREF="https://github.com/citizenfx/fivem/blob/master/code/components/gta-core-five/src/GameSkeleton.cpp#L197">GameSkeleton.cpp:197</A>)
[    223156] [b2060_DumpServ]                18964/ 
[    231687] [b2060_DumpServ]                18964/ Crash report service returned si-fdf7a8a9813445bdb34f8a84a42c1976

Reproduction Steps

local modelHash = GetHashKey("mp_m_freemode_01")

print("[skin] Trying to load model! Model: "..modelHash)

if not IsModelValid(modelHash) then
    print("[skin] Model didn't exist! Model: "..modelHash)
    return false

print("Model Requested: "..modelHash)

while not HasModelLoaded(modelHash) do

print("Model loaded!")

if IsModelInCdimage(modelHash) and HasModelLoaded(modelHash) then
    print("Model is valid! Setting now!")
    SetPlayerModel(PlayerId(), modelHash)


This seems to cause the above crash as soon as SetPlayerModel is triggered.

Crash Logs
CfxCrashDump_2020_08_27_11_17_49.zip (1.5 MB)

Until we can answer:

  1. Provide the whole function (I assume it’s a function because of the return false in the if statement)
  2. Provide any errors from server/client console.

The whole thing should work as far as I know. According to the docs, it looks good. Also please check this post, which has very similar code.

  1. I actually copied this code from another resource we use without issue on the previous update. That is the exact code which I ran in runcode to cause the crash to occur. Nothing more than that

  2. I did provide the client console errors?

I know it should work, however for some reason every client on my server running b2060 can repro this crash with the exact steps above. We’re still looking into what may be making our server different to others. It’s not an issue of it “not working” it seems that (at least for us) on the latest GTA patch that code is causing the game crash stated above.

And seemingly only for you - code runs fine on b2060 here :confused: Are you using any addon ped components?

On my server I found this:

local playerPed = PlayerPedId()
local characterModel = GetHashKey('mp_m_freemode_01')


		while not HasModelLoaded(characterModel) do

		if IsModelInCdimage(characterModel) and IsModelValid(characterModel) then
			SetPlayerModel(PlayerId(), characterModel)


It is working and the only difference is the CreateThread wrapper. Try it and let me know if that helped.

Yeah, so we just disabled our clothing / ped resources and the issue no longer exists. Looking more into it now.

Further addition, it seems our addon clothing is causing the issue. Any sort of clothing replacement and addon peds work fine. Probably some sort of weird issue with how we mount the addon. I’ll look into it more tomorrow

Just wondering - did anyone even document a general process regarding DLC-style addon ped metadata? I wonder if there’s some hardcoded indices going on there that don’t like additional DLC being in its place…

I’ll ask some of my other guys about it, but we have generally just kept trying and researching stuff until it works.

I’ll look what guide they used, and can post the steps we took to do it

Must have been an issue on our end. I recompiled all our addon DLC and the issue seems to be completely rectified. Weird that it only happened on 2060 but :man_shrugging: