@@ -403,6 +403,12 @@ static HookFunction hookFunction([]()
403
403
// Call GET_PED_DRAWABLE_VARIATION to get global drawable index.
404
404
fx::ScriptEngine::CallNativeHandler (0x67F3780DD425D4FC , newContext);
405
405
int globalDrawableIndex = newContext.GetResult <int >();
406
+ if (globalDrawableIndex < 0 )
407
+ {
408
+ context.SetResult <int >(-1 );
409
+ return ;
410
+ }
411
+
406
412
context.SetResult <int >(g_GetDlcDrawableIdx (variationInfoCollection, componentId, globalDrawableIndex));
407
413
});
408
414
fx::ScriptEngine::RegisterNativeHandler (" GET_PED_DRAWABLE_VARIATION_COLLECTION_NAME" , [](fx::ScriptContext& context)
@@ -422,13 +428,76 @@ static HookFunction hookFunction([]()
422
428
// Call GET_PED_DRAWABLE_VARIATION to get global drawable index.
423
429
fx::ScriptEngine::CallNativeHandler (0x67F3780DD425D4FC , newContext);
424
430
int globalDrawableIndex = newContext.GetResult <int >();
431
+ if (globalDrawableIndex < 0 )
432
+ {
433
+ context.SetResult <const char *>(nullptr );
434
+ return ;
435
+ }
436
+
425
437
auto variationInfo = g_GetVariationInfoFromDrawableIdx (variationInfoCollection, componentId, globalDrawableIndex);
426
438
if (!variationInfo)
427
439
{
428
440
context.SetResult <const char *>(nullptr );
429
441
return ;
430
442
}
431
443
444
+ context.SetResult <const char *>(GetCollectionName (variationInfo));
445
+ });
446
+ fx::ScriptEngine::RegisterNativeHandler (" GET_PED_PROP_COLLECTION_LOCAL_INDEX" , [](fx::ScriptContext& context)
447
+ {
448
+ uint32_t pedId = context.GetArgument <uint32_t >(0 );
449
+ int anchorPoint = context.GetArgument <int >(1 );
450
+ auto variationInfoCollection = GetPedVariationInfoCollection (pedId);
451
+ if (!variationInfoCollection)
452
+ {
453
+ context.SetResult <int >(-1 );
454
+ return ;
455
+ }
456
+
457
+ fx::ScriptContextBuffer newContext;
458
+ newContext.Push (pedId);
459
+ newContext.Push (anchorPoint);
460
+ // Call GET_PED_PROP_INDEX to get global prop index.
461
+ fx::ScriptEngine::CallNativeHandler (0x898CC20EA75BACD8 , newContext);
462
+ int globalPropIndex = newContext.GetResult <int >();
463
+ if (globalPropIndex < 0 )
464
+ {
465
+ context.SetResult <int >(-1 );
466
+ return ;
467
+ }
468
+
469
+ context.SetResult <int >(g_GetDlcPropIdx (variationInfoCollection, anchorPoint, globalPropIndex));
470
+ });
471
+ fx::ScriptEngine::RegisterNativeHandler (" GET_PED_PROP_COLLECTION_NAME" , [](fx::ScriptContext& context)
472
+ {
473
+ uint32_t pedId = context.GetArgument <uint32_t >(0 );
474
+ int anchorPoint = context.GetArgument <int >(1 );
475
+ auto variationInfoCollection = GetPedVariationInfoCollection (pedId);
476
+ if (!variationInfoCollection)
477
+ {
478
+ context.SetResult <const char *>(nullptr );
479
+ return ;
480
+ }
481
+
482
+ fx::ScriptContextBuffer newContext;
483
+ newContext.Push (pedId);
484
+ newContext.Push (anchorPoint);
485
+ // Call GET_PED_PROP_INDEX to get global prop index.
486
+ fx::ScriptEngine::CallNativeHandler (0x898CC20EA75BACD8 , newContext);
487
+ int globalPropIndex = newContext.GetResult <int >();
488
+ if (globalPropIndex < 0 )
489
+ {
490
+ context.SetResult <const char *>(nullptr );
491
+ return ;
492
+ }
493
+
494
+ auto variationInfo = g_GetVariationInfoFromPropIdx (variationInfoCollection, anchorPoint, globalPropIndex);
495
+ if (!variationInfo)
496
+ {
497
+ context.SetResult <const char *>(nullptr );
498
+ return ;
499
+ }
500
+
432
501
context.SetResult <const char *>(GetCollectionName (variationInfo));
433
502
});
434
503
});
0 commit comments