RedM Natives

GET_SHAPE_TEST_RESULT

Returns the result of a shape test: 0 if the handle is invalid, 1 if the shape test is still pending, or 2 if the shape test has completed, and the handle should be invalidated.

Hash0xEDE8AC7C5108FB1D
Runtime nameGetShapeTestResult
NamespaceSHAPETEST
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x3D87450E15D98694

Signature

int GET_SHAPE_TEST_RESULT(ScrHandle shapeTestHandle, BOOL* hit, Vector3* endCoords, Vector3* surfaceNormal, Entity* entityHit);

Parameters

NameTypeDescription
shapeTestHandleScrHandle—
hitBOOL*—
endCoordsVector3*—
surfaceNormalVector3*—
entityHitEntity*—

Returns int

Description

Returns the result of a shape test: 0 if the handle is invalid, 1 if the shape test is still pending, or 2 if the shape test has completed, and the handle should be invalidated.

When used with an asynchronous shape test, this native should be looped until returning 0 or 2, after which the handle is invalidated.

enum eShapeTestStatus
{
	SHAPETEST_STATUS_NONEXISTENT,
	SHAPETEST_STATUS_RESULTS_NOTREADY,
	SHAPETEST_STATUS_RESULTS_READY
};

Usage

Lua
local retval, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(shapeTestHandle)

-- always works, by hash
local retval, hit, endCoords, surfaceNormal, entityHit = Citizen.InvokeNative(0xEDE8AC7C5108FB1D, shapeTestHandle, Citizen.PointerValueInt() --[[ BOOL* ]], Citizen.PointerValueVector(), Citizen.PointerValueVector(), Citizen.PointerValueInt(), Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const [retval, hit, endCoords, surfaceNormal, entityHit] = GetShapeTestResult(shapeTestHandle);

// by hash
const [retval, hit, endCoords, surfaceNormal, entityHit] = Citizen.invokeNative('0xEDE8AC7C5108FB1D', shapeTestHandle, Citizen.pointerValueInt() /* BOOL* */, Citizen.pointerValueVector(), Citizen.pointerValueVector(), Citizen.pointerValueInt(), Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
var hit = new OutputArgument();
var endCoords = new OutputArgument();
var surfaceNormal = new OutputArgument();
var entityHit = new OutputArgument();
int retval = Function.Call<int>((Hash)0xEDE8AC7C5108FB1D, shapeTestHandle, hit, endCoords, surfaceNormal, entityHit);
// hit.GetResult<bool>()
// endCoords.GetResult<Vector3>()
// surfaceNormal.GetResult<Vector3>()
// entityHit.GetResult<int>()
  • Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.