FiveM - (6420) CreatePed: Error executing native [Custom resources]
I am currently running a FiveM server with QBCore and encountering an issue with the "CreatePed" native.
Whenever players load in through the qb-multicharacter resource and select a character this error shows up (attached image) on client-side.
If the player ignores this error and attempts to join the world anyway, the game crashes.
This is only an issue when a specific streamable resource is loaded (clothes resource), but anyhow it is still an error I would like to be able to determine the root cause of, so I can fix it properly.
Interestingly, this error does not occur if a player chooses a different character and then switches back to the original "problematic" ped. In such cases, the ped loads without any issues, and gameplay continues smoothly.
The problem seems to be specifically associated with the initial loading of the affected model. Any guidance or suggestions for resolving this issue would be greatly appreciated.
RequestModel(model) --# load custom model
while not HasModelLoaded(model) do
Wait(0)
end
--# Model is loaded successfully
ped = CreatePed(2, model, -813.5, 176.22, 75.76, 0.0, false, true)
--# Crashes on CreatePed ^ even though the requested model was loaded.

Could you please help me better understand and address the root cause of the issue? Your assistance is greatly appreciated.
assuming model is a string
in the docs the second param asks for a hash not a string
then is good practice to SetModelAsNoLongerNeeded
assuming model is a string in the docs the second param asks for a hash not a string
then is good practice to
SetModelAsNoLongerNeeded
I'm pretty sure it doesn't matter in this case, anything that has hash as an argument has a function automatically converts strings to the hash (at least in Lua)
local function _ch(hash)
if g.type(hash) == 'string' then
return g.GetHashKey(hash)
end
return hash
end
function Global.CreatePed(pedType, modelHash, x, y, z, heading, isNetwork, bScriptHostPed)
return _in(0xD49F9B0955C367DE, pedType, _ch(modelHash), x, y, z, heading, isNetwork, bScriptHostPed, _ri)
end
As for the crash I couldn't tell you exactly what it is, it would be best to see if somehow the model you're crashing on is improperly setup.
Thanks for your feedback,
The 'model' variable in this case is indeed a hash key for the given model, not a string - and it works as intended with this specific model disabled.
I do not have much knowledge about creating models, and I assume there is something wrong with it: However, it is odd that it works as intended after another model (default character model) has been created.
I will provide four scenarios each explaining different perspectives of the issue:
Successful scenario (with offending model running as a resource)
- Select empty character on select screen
- Character loads the default ped as expected
- Join world with selected character
Successful scenario (without offending model running as a resource)
- Select empty character on select screen
- Character loads the default ped as expected
- Join world with selected character
Failed / successful scenario (with offending model running as a resource)
- Select character with any non-default model. (This model does not need to be from the offending resource)
- Script error in console. -- The failure as in Original Post
- Select a default character with default ped
- No script error, and default ped loads
- Select the custom model-character again
- No error and custom model loads as intended
Failed scenario (with offending model running as a resource)
- Select character with any non-default model. (This model does not need to be from the offending resource)
- Script error in console. (attached in Original Post)
- Join world anyway: Game crash
I hope this information can help further, and thanks again for your replies.
I don't see this 'specific streamable resource' provided here. Did you forget to attach it?
I don't see this 'specific streamable resource' provided here. Did you forget to attach it?
Ah, sorry; I did not intend to attach the resource as it (in the scenarios provided) doesn't seem to be the root cause for the crashes, as the non-default characters doesn't use the model/clothes from this resouce.
I will attach it here to hopefully allow further insight into the issue. erroneous-resource.zip
I don't have time to actually look into this myself yet, but a quick note:
as the non-default characters doesn't use the model/clothes from this resouce
When any script requests mp_m_freemode_01, all metadata files that are registered as a SHOP_PED_APPAREL_META_FILE for that model get loaded as well, so the issue might be related to something acting up about the creature metadata file here.
There's a lot of conflicting information about creating such metadata files and some of it is weirdly gatekept, and given the complexity I wish some of it could be abstracted away somewhen. 😕
I am currently running a FiveM server with QBCore and encountering an issue with the "CreatePed" native. Whenever players load in through the
qb-multicharacterresource and select a character this error shows up (attached image) on client-side. If the player ignores this error and attempts to join the world anyway, the game crashes.This is only an issue when a specific streamable resource is loaded (clothes resource), but anyhow it is still an error I would like to be able to determine the root cause of, so I can fix it properly.
Interestingly, this error does not occur if a player chooses a different character and then switches back to the original "problematic" ped. In such cases, the ped loads without any issues, and gameplay continues smoothly.
The problem seems to be specifically associated with the initial loading of the affected model. Any guidance or suggestions for resolving this issue would be greatly appreciated.
RequestModel(model) --# load custom model while not HasModelLoaded(model) do Wait(0) end --# Model is loaded successfully ped = CreatePed(2, model, -813.5, 176.22, 75.76, 0.0, false, true) --# Crashes on CreatePed ^ even though the requested model was loaded.
Could you please help me better understand and address the root cause of the issue? Your assistance is greatly appreciated.
Have you fixed this yet ?
I am having this same problem, and I think it has something to do with the total number of ped meta files in the server. In my case this is happening when we have over 8 addon metas similar to the erroneous resource shared by the OP. I know for a fact that those models are not really the problem, but it feels like they are not loading fast enough for the qb-multicharacter. The Gods of Ped Designs, Respond lol......
Solution : Just do a RequestModel(mp_m_freemode_01),RequestModel(mp_f_freemode_01) and then a loop for Has_Model_Loaded() for the same, before calling the open menu in the qb-multicharacter has fixed the error and the crashes for me. Ping me if u need detailed code for the solution. But to the people on this thread I know they already know how to code it themselves.
Solution : Just do a RequestModel(mp_m_freemode_01),RequestModel(mp_f_freemode_01) and then a loop for Has_Model_Loaded() for the same, before calling the open menu in the qb-multicharacter has fixed the error and the crashes for me. Ping me if u need detailed code for the solution. But to the people on this thread I know they already know how to code it themselves.
Hi ! Can we have more detailed ? ^^
Solution : Just do a RequestModel(mp_m_freemode_01),RequestModel(mp_f_freemode_01) and then a loop for Has_Model_Loaded() for the same, before calling the open menu in the qb-multicharacter has fixed the error and the crashes for me. Ping me if u need detailed code for the solution. But to the people on this thread I know they already know how to code it themselves.
Ezio21 I'm having the exact same issue. Where did you put that ? I'm running illeum appearance, and qb-mulitcharacter. do I put it in the server side? Please any help would be greatly appreciated.
While I cannot seem to replicate this locally with only the resource (i.e., just erroneous-resource), the crash location does seem consistent with too many CModelInfoStreamingModule streaming dependencies. Would it be possible to provide the number of SHOP_PED_APPAREL_META_FILE's manifest entries you have on your server (and game build).
For reference, this seems to be the relevant qb-multicharacter snippet and see previous discussion on the forums.
Solution : Just do a RequestModel(mp_m_freemode_01),RequestModel(mp_f_freemode_01) and then a loop for Has_Model_Loaded() for the same, before calling the open menu in the qb-multicharacter has fixed the error and the crashes for me. Ping me if u need detailed code for the solution. But to the people on this thread I know they already know how to code it themselves.
Hi, I'm now also having this issue. Could I please look over the detailed guide as i'm struggling with it by my lonesome. Thankyou!