Streaming textures with "AddReplaceTexture" will crash a lot of players

Hey server owners!
I just found a problem with streamed “URL” textures (AddReplaceTexture).
It looks like that a lot of players are getting random crashes when using this kind of texture streaming. I know its still experimental to stream and replace textures like that but does anybody know a fix for it? I just want to stream some vehshare textures like plates with it.

Thats the error some players are getting: blue-moon-sweet. On serverside: Game crashed: GTA5.exe!sub_1412F3D00 (0x11d)

123

And thats the script causing this crashes:

plates = {
{"plate01","URL",512,256},
}

for l, p in pairs(plates) do
    local txd = CreateRuntimeTxd("testing")
    local duiObj = CreateDui(p[2], p[3], p[4])
    local dui = GetDuiHandle(duiObj)
    local tx = CreateRuntimeTextureFromDuiHandle(txd, "test", dui)
    AddReplaceTexture("vehshare", p[1], "testing", "test")
end

Do you have any repro steps to guarantee a crash? The script looks incomplete.

… also whatever you’re doing here is extreme overkill and not how the API is intended to be used, you can just add another .ytd, request it and use that for AddReplaceTexture.

Hey the script itself isn’t incomplete. Its just simple. You just have to replace “URL” with a direct URL to the PNG you want to use.

Well as i know its completly random and some players had this issue near the military base or after playing 15 minutes. Not everyone got this error. After removing this script all the issues are gone.

So i can use it with a .ytd request? Didn’t know that.

Just a little update to texture streaming. It looks like it has something to do with the size of replaced textures. This issue was reported a year ago: Crashing with large resolution images · Issue #2 · MASRPNathan-G/customplates · GitHub

We are using 512x256 plate textures when you normaly have a texture size from 256x128.
And this will lead to the crash: blue-moon-sweet

Is there any other way for vehshare streaming or installing it client side?
I had a working vehshare.ytd clientside for 3 years, but somehow FiveM doesnt support it anymore when using it clientside: citizen\platform\levels\gta5\vehicles\vehshare.ytd. Thats why I am forced to stream it somehow, just for some custom plates and dirt textures ^^

yes, as said, don’t use dui but a txd with any other name, loaded using REQUEST_STREAMED_TEXTURE_DICT - Cfx.re Docs and then using that in replace texture

1 Like

Thx a lot i will try it :slight_smile:

Thx for your help its working and it looks like, that the crash is gone now. :slight_smile: I didn’t know there was something like “RequestStreamedTextureDict”. ^^