### Lua Example for CREATE_VEHICLE_SERVER_SETTER Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/server/CreateVehicleServerSetter.md Example demonstrating how to use CREATE_VEHICLE_SERVER_SETTER in Lua to spawn a helicopter. It retrieves player coordinates for positioning and prints the vehicle's coordinates after creation. ```lua local heli = CreateVehicleServerSetter(`seasparrow`, 'heli', GetEntityCoords(GetPlayerPed(GetPlayers()[1])) + vector3(0, 0, 15), 0.0) print(GetEntityCoords(heli)) -- should return correct coordinates ``` -------------------------------- ### Get Resource KVP String Example Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpString.md Demonstrates how to retrieve a string value from the resource KVP store using the GetResourceKvpString function. It checks if a value was returned before proceeding. ```lua local kvpValue = GetResourceKvpString('codfish') if kvpValue then -- do something! end ``` -------------------------------- ### Lua Example for SetResourceKvp Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpInt.md Demonstrates setting a resource KVP value using Lua. This function is a wrapper for the native SET_RESOURCE_KVP_INT. ```lua local lickMy = 42 SetResourceKvp('bananabread', lickMy) ``` -------------------------------- ### Find External KVP Example Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/StartFindExternalKvp.md Demonstrates how to find and retrieve KVPs from an external resource using START_FIND_EXTERNAL_KVP, FIND_KVP, and END_FIND_KVP. It iterates through all matching keys and prints their values. ```lua local kvpHandle = StartFindExternalKvp('drugs', 'mollis:') if kvpHandle ~= -1 then local key repeat key = FindKvp(kvpHandle) if key then print(('%s: %s'):format(key, GetResourceKvpString(key))) end until not key EndFindKvp(kvpHandle) else print('No KVPs found') end ``` -------------------------------- ### Get External KVP Float Example Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/GetExternalKvpFloat.md Fetches a float value from a specified resource's KVP store. Check if the returned value is not nil before using it. ```lua local kvpValue = GetExternalKvpFloat('drugs', 'mollis') if kvpValue then -- do something! end ``` -------------------------------- ### START_FIND_EXTERNAL_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/StartFindExternalKvp.md Starts finding Key-Value Pairs (KVPs) in an external resource. This function is equivalent to `START_FIND_KVP` but operates on a different resource. ```APIDOC ## START_FIND_EXTERNAL_KVP ### Description Initiates a search for Key-Value Pairs (KVPs) in an external resource. ### Signature ```c int START_FIND_EXTERNAL_KVP(char* resourceName, char* prefix); ``` ### Parameters * **resourceName** (string) - Required - The name of the resource to search for KVPs within. * **prefix** (string) - Required - A prefix to filter the KVP keys. ### Return Value An integer representing a KVP find handle. This handle is used with `FIND_KVP` and must be closed with `END_FIND_KVP`. Returns -1 if the operation fails. ### Example ```lua local kvpHandle = StartFindExternalKvp('drugs', 'mollis:') if kvpHandle ~= -1 then local key repeat key = FindKvp(kvpHandle) if key then print(('%s: %s'):format(key, GetResourceKvpString(key))) end until not key EndFindKvp(kvpHandle) else print('No KVPs found') end ``` ``` -------------------------------- ### SetResourceKvpInt Example Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpInt.md Sets an integer value for a specified key in the resource KVP store. Ensure the key is a string and the value is an integer. ```c void SET_RESOURCE_KVP_INT(char* key, int value); ``` -------------------------------- ### Find KVPs by Prefix in Lua Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/StartFindKvp.md Demonstrates how to find and print all KVPs starting with a specific prefix. Ensure to close the KVP handle after use to prevent resource leaks. ```lua SetResourceKvp('mollis:2', 'should be taken with alcohol') SetResourceKvp('mollis:1', 'vesuvius citrate') SetResourceKvp('mollis:manufacturer', 'Betta Pharmaceuticals') local kvpHandle = StartFindKvp('mollis:') if kvpHandle ~= -1 then local key repeat key = FindKvp(kvpHandle) if key then print(('%s: %s'):format(key, GetResourceKvpString(key))) end until not key EndFindKvp(kvpHandle) else print('No KVPs found') end ``` -------------------------------- ### Example: Bulk Write and Flush KVP Data Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/FlushResourceKvp.md Demonstrates writing many key-value pairs using SetResourceKvpNoSync and then ensuring all data is synchronized to the filesystem using FlushResourceKvp. ```lua local key = "bug_%d" local value = "unintended_feature_%d" for i=1,10000 do SetResourceKvpNoSync(key:format(i), value:format(i)) end -- Ensure all data is synchronized to the filesystem FlushResourceKvp() ``` -------------------------------- ### Lua Example: Using GetResourceKvpInt Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpInt.md Demonstrates how to retrieve an integer value using GetResourceKvpInt in Lua and check if it was found. The function returns 0 if the key does not exist. ```lua local kvpValue = GetResourceKvpInt('bananabread') if kvpValue ~= 0 then -- do something! end ``` -------------------------------- ### SetResourceKvpFloat Example Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpFloat.md Sets a float value for a given key using the SetResourceKvpFloat native. Ensure the key is a string and the value is a float. ```lua local lickMy = 42.5 SetResourceKvpFloat('bananabread', lickMy) ``` -------------------------------- ### Get Resource KVP Integer Value Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpInt.md Fetches an integer value from the resource's key-value store. Returns 0 if the key is not found. This is useful for retrieving configuration settings or game state information stored as integers. ```c int GET_RESOURCE_KVP_INT(char* key); ``` -------------------------------- ### Get Resource KVP Float Value (Lua) Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpFloat.md Use this snippet to retrieve a float value from the resource KVP store. Check if the returned value is not the default 0.0 to confirm if the key existed. ```lua local kvpValue = GetResourceKvpFloat('mollis') if kvpValue ~= 0.0 then -- do something! end ``` -------------------------------- ### Get Entity Index From Mapdata Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetEntityIndexFromMapdata.md Use this function to get the transient entity index for a mapdata/entity pair. This function is not intended for direct use in your code. ```c int GET_ENTITY_INDEX_FROM_MAPDATA(int mapdata, int entity); ``` -------------------------------- ### Get External KVP Integer Value (Lua) Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/GetExternalKvpInt.md Use this snippet to retrieve an integer KVP value from a specified resource. Check the return value to ensure the key existed before proceeding. ```lua local kvpValue = GetExternalKvpInt('food', 'bananabread') if kvpValue then -- do something! end ``` -------------------------------- ### Get Map Data Entity Handle Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetMapdataEntityHandle.md Retrieves the handle for a map data entity. This function is part of the SDK infrastructure and not meant for direct use in game scripts. ```c BOOL GET_MAPDATA_ENTITY_HANDLE(int mapDataHash, int entityInternalIdx, int* entityHandle); ``` -------------------------------- ### Get External KVP String Value (Lua) Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/GetExternalKvpString.md Fetches a string value from a specified resource's KVP. Use this when you need to retrieve data previously set by SET_RESOURCE_KVP in another resource. ```lua local kvpValue = GetExternalKvpString('food', 'codfish') if kvpValue then -- do something! end ``` -------------------------------- ### Get Selected Entity at Mouse Position Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SelectEntityAtPos.md Retrieves the entity under the mouse cursor at the specified screen coordinates. This function is part of the SDK infrastructure and not meant for direct use in game scripts. ```c Entity SELECT_ENTITY_AT_POS(float fracX, float fracY, int hitFlags, BOOL precise); ``` -------------------------------- ### Get Entity Map Data Owner Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetEntityMapdataOwner.md Retrieves the map data and entity handles from a specific entity. This function supports SDK infrastructure and is not intended for direct use. ```c BOOL GET_ENTITY_MAPDATA_OWNER(Entity entity, int* mapdataHandle, int* entityHandle); ``` -------------------------------- ### SELECT_ENTITY_AT_CURSOR Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SelectEntityAtCursor.md Gets the selected entity at the current mouse cursor position, and changes the current selection depth. This function supports SDK infrastructure and is not intended to be used directly from your code. ```APIDOC ## SELECT_ENTITY_AT_CURSOR ### Description Gets the selected entity at the current mouse cursor position, and changes the current selection depth. This function supports SDK infrastructure and is not intended to be used directly from your code. ### Parameters #### Path Parameters * **hitFlags** (int) - Required - A bit mask of entity types to match. * **precise** (BOOL) - Required - Whether to do a _precise_ test, i.e. of visual coordinates, too. ### Return value An entity handle, or zero. ``` -------------------------------- ### Get Entity at Cursor Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SelectEntityAtCursor.md Retrieves the entity under the cursor. Use hitFlags to specify entity types and precise to enable visual coordinate testing. This native is part of the SDK and not intended for direct use. ```c Entity SELECT_ENTITY_AT_CURSOR(int hitFlags, BOOL precise); ``` -------------------------------- ### SELECT_ENTITY_AT_POS Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SelectEntityAtPos.md Gets the selected entity at the specified mouse cursor position, and changes the current selection depth. This function supports SDK infrastructure and is not intended to be used directly from your code. ```APIDOC ## SELECT_ENTITY_AT_POS ### Description Gets the selected entity at the specified mouse cursor position, and changes the current selection depth. This function supports SDK infrastructure and is not intended to be used directly from your code. ### Parameters * **fracX** (float) - Mouse cursor X fraction. * **fracY** (float) - Mouse cursor Y fraction. * **hitFlags** (int) - A bit mask of entity types to match. * **precise** (BOOL) - Whether to do a _precise_ test, i.e. of visual coordinates, too. ### Return value An entity handle, or zero. ``` -------------------------------- ### Get Mapdata Entity Matrix - C# Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetMapdataEntityMatrix.md Retrieves the entity matrix for map data. This function is part of the SDK infrastructure and not meant for direct use. It requires a mutable buffer for the matrix. ```csharp BOOL GET_MAPDATA_ENTITY_MATRIX(int mapDataHash, int entityInternalIdx, long matrixPtr); ``` -------------------------------- ### Get Map Data Index from Hash Key Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetMapdataFromHashKey.md Retrieves the transient map data index for a specified hash. This function is part of the SDK infrastructure and not meant for direct use in your code. Returns -1 if the map data is not found. ```c int GET_MAPDATA_FROM_HASH_KEY(Hash mapdataHandle); ``` -------------------------------- ### START_FIND_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/StartFindKvp.md Initiates a search for Key-Value Pairs (KVPs) that match a given prefix. It returns a handle that can be used with subsequent FIND_KVP calls to iterate through the matching KVPs. The search should be closed using END_FIND_KVP. ```APIDOC ## START_FIND_KVP ### Description Initiates a search for Key-Value Pairs (KVPs) that match a given prefix. It returns a handle that can be used with subsequent FIND_KVP calls to iterate through the matching KVPs. The search should be closed using END_FIND_KVP. ### Signature ```c int START_FIND_KVP(char* prefix); ``` ### Parameters #### Path Parameters * **prefix** (char*) - The prefix string to match against KVP keys. ### Return Value Returns an integer KVP find handle. Returns -1 if no matching KVPs are found or an error occurs. ### Example ```lua -- Example of using START_FIND_KVP, FIND_KVP, and END_FIND_KVP local kvpHandle = StartFindKvp('mollis:') if kvpHandle ~= -1 then local key repeat key = FindKvp(kvpHandle) if key then print(('%s: %s'):format(key, GetResourceKvpString(key))) end until not key EndFindKvp(kvpHandle) else print('No KVPs found') end ``` ``` -------------------------------- ### C++ Signature for CREATE_VEHICLE_SERVER_SETTER Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/server/CreateVehicleServerSetter.md This is the C++ signature for the CREATE_VEHICLE_SERVER_SETTER native function. It outlines the parameters required and the return type. ```c Vehicle CREATE_VEHICLE_SERVER_SETTER(Hash modelHash, char* type, float x, float y, float z, float heading); ``` -------------------------------- ### Set Resource KVP String Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvp.md Use this function to set a string value for a given key. This is useful for storing configuration or state information for a resource. ```c void SET_RESOURCE_KVP(char* key, char* value); ``` ```lua SetResourceKvp('mollis', 'vesuvius citrate') ``` -------------------------------- ### GetResourceKvpInt Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpInt.md Fetches an integer value from the resource's key-value store. ```APIDOC ## GET_RESOURCE_KVP_INT ### Description A getter for [SET_RESOURCE_KVP_INT](#_0x6A2B1E8). ### Parameters #### Path Parameters * **key** (string) - Required - The key to fetch ### Return value The integer value stored under the specified key, or 0 if not found. ### Examples ```lua local kvpValue = GetResourceKvpInt('bananabread') if kvpValue ~= 0 then -- do something! end ``` ``` -------------------------------- ### SET_RESOURCE_KVP_NO_SYNC C++ Signature Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpNoSync.md This is the C++ signature for the SET_RESOURCE_KVP_NO_SYNC native function. It takes a key and a value as C-style strings. ```c void SET_RESOURCE_KVP_NO_SYNC(char* key, char* value); ``` -------------------------------- ### GET_RESOURCE_KVP_STRING Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpString.md Fetches a string value from the resource's key-value pair store using a specified key. This is a getter for `SET_RESOURCE_KVP`. ```APIDOC ## GET_RESOURCE_KVP_STRING ### Description A getter for [SET_RESOURCE_KVP](#_0x21C7A35B). ### Parameters #### Path Parameters * **key** (string) - Required - The key to fetch ### Return value The string value stored under the specified key, or nil/null if not found. ### Examples ```lua local kvpValue = GetResourceKvpString('codfish') if kvpValue then -- do something! end ``` ``` -------------------------------- ### Enable Editor Runtime Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/EnableEditorRuntime.md This function enables the editor runtime mode, which changes game behavior to track entity metadata. It is part of the SDK infrastructure and not intended for direct use. ```c void ENABLE_EDITOR_RUNTIME(); ``` -------------------------------- ### CREATE_VEHICLE_SERVER_SETTER Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/server/CreateVehicleServerSetter.md Creates a vehicle with specified parameters using server-side logic. This is a workaround for potential reliability issues with standard entity creation RPCs and supports a wider range of vehicle types than CREATE_AUTOMOBILE. ```APIDOC ## CREATE_VEHICLE_SERVER_SETTER ### Description Creates a vehicle on the server using 'server setter' logic, equivalent to CREATE_VEHICLE but with enhanced reliability for entity creation. ### Parameters * **modelHash** (Hash) - The model hash of the vehicle to spawn. * **type** (char*) - The type of vehicle. Accepted values include `automobile`, `bike`, `boat`, `heli`, `plane`, `submarine`, `trailer`, and `train`. * **x** (float) - The X coordinate for spawning the vehicle. * **y** (float) - The Y coordinate for spawning the vehicle. * **z** (float) - The Z coordinate for spawning the vehicle. * **heading** (float) - The heading (in degrees) the vehicle should face upon spawning. ### Return Value Returns a script handle for the created vehicle, or 0 if the creation failed. ### Example ```lua local heli = CreateVehicleServerSetter(`seasparrow`, 'heli', GetEntityCoords(GetPlayerPed(GetPlayers()[1])) + vector3(0, 0, 15), 0.0) print(GetEntityCoords(heli)) -- Example output: vector3(x, y, z) ``` ``` -------------------------------- ### GET_RESOURCE_KVP_FLOAT Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/GetResourceKvpFloat.md Fetches a float value from the resource's key-value store. This is the counterpart to `SET_RESOURCE_KVP_FLOAT`. ```APIDOC ## GET_RESOURCE_KVP_FLOAT ### Description A getter for [SET_RESOURCE_KVP_FLOAT](#_0x9ADD2938). ### Parameters #### Path Parameters * **key** (string) - Required - The key to fetch ### Return value The floating-point value stored under the specified key, or 0.0 if not found. ### Examples ```lua local kvpValue = GetResourceKvpFloat('mollis') if kvpValue ~= 0.0 then -- do something! end ``` ``` -------------------------------- ### PRINT_STRUCTURED_TRACE Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/server/PrintStructuredTrace.md Prints 'structured trace' data to the server file descriptor 3 channel. This is not generally useful outside of server monitoring utilities. ```APIDOC ## PRINT_STRUCTURED_TRACE ### Description Prints 'structured trace' data to the server `file descriptor 3` channel. This is not generally useful outside of server monitoring utilities. ### Parameters #### Path Parameters * **jsonString** (string) - Required - JSON data to submit as `payload` in the `script_structured_trace` event. ``` -------------------------------- ### Flush Resource KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/FlushResourceKvp.md This native ensures all _NO_SYNC operations are synchronized with the disk/filesystem. Use this after performing multiple non-synchronous writes or deletes to prevent data loss. ```c void FLUSH_RESOURCE_KVP(); ``` -------------------------------- ### Set Entity Outline Render Technique Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutlineRenderTechnique.md Sets the render technique for drawing an entity's outline. Use this function to specify a technique group name to control how the entity's outline is rendered. Refer to the provided list for available technique group names. ```c void SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE(char* techniqueGroup); ``` -------------------------------- ### FIND_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/FindKvp.md Retrieves the value associated with a key from a KVP store using a find handle. This function is typically used after initiating a search with START_FIND_KVP. ```APIDOC ## FIND_KVP ### Description Retrieves the value associated with a key from a KVP store using a find handle. This function is typically used after initiating a search with START_FIND_KVP. ### Parameters #### Path Parameters * **handle** (int) - Required - The KVP find handle returned from [START_FIND_KVP](#_0xDD379006) ### Return value None. ### Example See [START_FIND_KVP](#_0xDD379006) ``` -------------------------------- ### SCAN_RESOURCE_ROOT Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/server/ScanResourceRoot.md Scans the resources in the specified resource root. This function is only available in the 'monitor mode' process and is not available for user resources. ```APIDOC ## SCAN_RESOURCE_ROOT ### Description Scans the resources in the specified resource root. This function is only available in the 'monitor mode' process and is not available for user resources. ### Parameters #### Path Parameters * **rootPath** (string) - Required - The resource directory to scan. * **callback** (function) - Required - A callback that will receive an object with results. ``` -------------------------------- ### GetExternalKvpInt Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/GetExternalKvpInt.md Fetches an integer value associated with a specific key from a given resource's KVP store. This is an external getter, similar to `SET_RESOURCE_KVP_INT` but for a specified resource. ```APIDOC ## GET_EXTERNAL_KVP_INT ### Description A getter for [SET_RESOURCE_KVP_INT](#_0x6A2B1E8), but for a specified resource. ### Parameters * **resource**: The resource to fetch from. * **key**: The key to fetch ### Return value A int that contains the value stored in the Kvp or nil/null if none. ### Examples ```lua local kvpValue = GetExternalKvpInt('food', 'bananabread') if kvpValue then -- do something! end ``` ``` -------------------------------- ### Enter Cursor Mode (C++) Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/EnterCursorMode.md Enters cursor mode, suppressing mouse movement to the game and displaying a mouse cursor. This function supports SDK infrastructure and is not intended to be used directly from your code. ```cpp void ENTER_CURSOR_MODE(); ``` -------------------------------- ### Print Structured Trace Data Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/server/PrintStructuredTrace.md Use this function to send JSON data as a payload in the script_structured_trace event. This is mainly for server monitoring and not general use. ```c void PRINT_STRUCTURED_TRACE(char* jsonString); ``` -------------------------------- ### Set Resource KVP Float Asynchronously Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpFloatNoSync.md Use this function to set a float value for a specified key in the resource's KVP store without waiting for synchronization. This is a nonsynchronous operation. ```c void SET_RESOURCE_KVP_FLOAT_NO_SYNC(char* key, float value); ``` -------------------------------- ### FLUSH_RESOURCE_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/FlushResourceKvp.md This native ensures all `_NO_SYNC` operations are synchronized with the disk/filesystem. It is useful after performing multiple `SetResourceKvpNoSync` operations to guarantee data persistence. ```APIDOC ## FLUSH_RESOURCE_KVP ### Description Ensures all non-synchronous KVP operations are synchronized with the disk/filesystem. ### Method ```c void FLUSH_RESOURCE_KVP(); ``` ### Usage Example (Lua) ```lua -- Bulk write many pairs to the resource KVP. local key = "bug_%d" local value = "unintended_feature_%d" for i=1,10000 do SetResourceKvpNoSync(key:format(i), value:format(i)) end -- Ensure all data is synchronized to the filesystem FlushResourceKvp() ``` ``` -------------------------------- ### SET_RESOURCE_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvp.md Sets a string value for a given key in the resource's key-value store. This is often used in conjunction with GET_RESOURCE_KVP_STRING. ```APIDOC ## SET_RESOURCE_KVP ### Description Sets a string value for a given key in the resource's key-value store. This is often used in conjunction with GET_RESOURCE_KVP_STRING. ### Parameters * **key** (string) - The key to set. * **value** (string) - The value to write. ### Example ```lua SetResourceKvp('mollis', 'vesuvius citrate') ``` ``` -------------------------------- ### GET_EXTERNAL_KVP_FLOAT Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/GetExternalKvpFloat.md A getter for SET_RESOURCE_KVP_FLOAT, but for a specified resource. ```APIDOC ## GET_EXTERNAL_KVP_FLOAT ### Description A getter for [SET_RESOURCE_KVP_FLOAT](#_0x9ADD2938), but for a specified resource. ### Parameters * **resource**: The resource to fetch from. * **key**: The key to fetch ### Return value A float that contains the value stored in the Kvp or nil/null if none. ### Examples ```lua local kvpValue = GetExternalKvpFloat('drugs', 'mollis') if kvpValue then -- do something! end ``` ``` -------------------------------- ### GetExternalKvpString Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/external/GetExternalKvpString.md Fetches a string value from a specified resource's KVP store. This function is a getter for SET_RESOURCE_KVP. ```APIDOC ## GET_EXTERNAL_KVP_STRING ### Description A getter for [SET_RESOURCE_KVP](#_0x21C7A35B), but for a specified resource. ### Parameters #### Path Parameters * **resource** (string) - The resource to fetch from. * **key** (string) - The key to fetch ### Return value A string that contains the value stored in the Kvp or nil/null if none. ### Examples ```lua local kvpValue = GetExternalKvpString('food', 'codfish') if kvpValue then -- do something! end ``` ``` -------------------------------- ### SET_RESOURCE_KVP_FLOAT Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpFloat.md Sets a float value for a specified resource KVP key. This function is a setter for GET_RESOURCE_KVP_FLOAT. ```APIDOC ## SET_RESOURCE_KVP_FLOAT ### Description Sets a float value for a specified resource KVP key. This function is a setter for GET_RESOURCE_KVP_FLOAT. ### Parameters #### Path Parameters * **key** (string) - The key to set * **value** (float) - The value to write ### Request Example ```lua local lickMy = 42.5 SetResourceKvpFloat('bananabread', lickMy) ``` ``` -------------------------------- ### Reset Entity Outline Render Technique Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/ResetEntityDrawOutlineRenderTechnique.md Call this function to restore the default outline rendering behavior for an entity. This is useful after customizing outline appearance with SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE. ```c void RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE(); ``` -------------------------------- ### SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutlineRenderTechnique.md Sets the render technique for drawing an entity's outline. This function allows you to specify a technique group name to control how the entity's outline is rendered in the game. ```APIDOC ## SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE ### Description Sets the render technique for drawing an entity's outline. This function allows you to specify a technique group name to control how the entity's outline is rendered in the game. ### Parameters #### Path Parameters * **techniqueGroup** (string) - Required - The name of the technique group to apply for rendering the entity's outline. Refer to the list of known technique groups for valid options. ``` -------------------------------- ### DRAW_GIZMO Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/DrawGizmo.md Draws a gizmo in the game world. This function is part of the SDK infrastructure and not intended for direct use from your code. It is best utilized from languages supporting mutable buffers like ArrayBuffer. ```APIDOC ## DRAW_GIZMO ### Description Draws a gizmo. This function supports SDK infrastructure and is not intended to be used directly from your code. This should be used from JavaScript or another language supporting mutable buffers like ArrayBuffer. Matrix layout is as follows: - Element [0], [1] and [2] should represent the right vector. - Element [4], [5] and [6] should represent the forward vector. - Element [8], [9] and [10] should represent the up vector. - Element [12], [13] and [14] should represent X, Y and Z translation coordinates. - All other elements should be [0, 0, 0, 1]. ### Parameters * **matrixPtr**: A mutable pointer to a 64-byte buffer of floating-point values, representing an XMFLOAT4X4 in layout. * **id**: A unique identifier of what the gizmo is affecting. ### Return value Whether or not the matrix was modified. ``` -------------------------------- ### SET_RESOURCE_KVP_NO_SYNC Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpNoSync.md Sets a resource key-value pair asynchronously. This operation does not immediately synchronize the data. Refer to FLUSH_RESOURCE_KVP for synchronization. ```APIDOC ## SET_RESOURCE_KVP_NO_SYNC ### Description Sets a resource key-value pair asynchronously. This operation does not immediately synchronize the data. Refer to FLUSH_RESOURCE_KVP for synchronization. ### Signature ```c void SET_RESOURCE_KVP_NO_SYNC(char* key, char* value); ``` ### Parameters #### Parameters - **key** (char*) - The key to set. - **value** (char*) - The value to write. ``` -------------------------------- ### RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/ResetEntityDrawOutlineRenderTechnique.md This function undoes changes made by `SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE`, restoring the original outline rendering behavior. The default render technique group is `unlit`. ```APIDOC ## RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE ### Description Resets the draw outline render technique for an entity, restoring its original outline rendering behavior. The default render technique group is `unlit`. ### Syntax ```c void RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE(); ``` ### Remarks This function is the counterpart to `SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE` and is used to revert any custom outline rendering settings applied to an entity. ``` -------------------------------- ### SET_RESOURCE_KVP_INT_NO_SYNC Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpIntNoSync.md Sets an integer value for a resource key-value pair without immediate synchronization. This operation is asynchronous and should be used in conjunction with FLUSH_RESOURCE_KVP for persistence. ```APIDOC ## SET_RESOURCE_KVP_INT_NO_SYNC ### Description Sets an integer value for a resource key-value pair without immediate synchronization. This operation is asynchronous and should be used in conjunction with FLUSH_RESOURCE_KVP for persistence. ### Signature ```c void SET_RESOURCE_KVP_INT_NO_SYNC(char* key, int value); ``` ### Parameters #### Parameters - **key** (string) - The key to set. - **value** (integer) - The integer value to write. ``` -------------------------------- ### Delete Resource KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/DeleteResourceKvp.md Use this function to delete a specific key-value pair from the resource's KVP store. Ensure the key exists before attempting deletion. ```c void DELETE_RESOURCE_KVP(char* key); ``` ```lua DeleteResourceKvp('liberty_city') ``` -------------------------------- ### Draw Gizmo Native Function Signature Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/DrawGizmo.md This is the native function signature for DRAW_GIZMO. It is not intended for direct use from C++ code. Use JavaScript or other languages supporting mutable buffers like ArrayBuffer. ```c BOOL DRAW_GIZMO(long matrixPtr, char* id); ``` -------------------------------- ### Set Entity Matrix (C++) Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityMatrix.md Sets an entity's transformation matrix. Arguments correspond to the forward, right, and up vectors, followed by the position. Ensure all parameters are valid. ```c++ void SET_ENTITY_MATRIX(Entity entity, float forwardX, float forwardY, float forwardZ, float rightX, float rightY, float rightZ, float upX, float upY, float upZ, float atX, float atY, float atZ); ``` -------------------------------- ### SET_RESOURCE_KVP_INT Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpInt.md Sets an integer value for a resource KVP key. ```APIDOC ## SET_RESOURCE_KVP_INT ### Description Sets an integer value for a given resource KVP key. This is the setter for GET_RESOURCE_KVP_INT. ### Parameters * **key** (string) - The key to set. * **value** (integer) - The integer value to write. ### Example ```lua local myValue = 123 SetResourceKvpInt('myKey', myValue) ``` ``` -------------------------------- ### Leave Cursor Mode Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/LeaveCursorMode.md This function exits cursor mode. It is part of the SDK infrastructure and not intended for direct use in your code. ```c void LEAVE_CURSOR_MODE(); ``` -------------------------------- ### SET_RESOURCE_KVP_FLOAT_NO_SYNC Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/SetResourceKvpFloatNoSync.md Sets a float value for a resource KVP without synchronization. This is a nonsynchronous operation. Refer to FLUSH_RESOURCE_KVP for more details on flushing. ```APIDOC ## SET_RESOURCE_KVP_FLOAT_NO_SYNC ### Description Sets a float value for a given key in the resource's Key-Value Pair (KVP) store without performing synchronization. ### Parameters #### Parameters * **key** (string) - The key for the KVP entry. * **value** (float) - The float value to associate with the key. ``` -------------------------------- ### SET_ENTITY_MATRIX Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityMatrix.md Sets an entity's matrix. Arguments are in the same order as with GET_ENTITY_MATRIX. ```APIDOC ## SET_ENTITY_MATRIX ### Description Sets an entity's matrix. Arguments are in the same order as with GET_ENTITY_MATRIX. ### Signature ```c void SET_ENTITY_MATRIX(Entity entity, float forwardX, float forwardY, float forwardZ, float rightX, float rightY, float rightZ, float upX, float upY, float upZ, float atX, float atY, float atZ); ``` ### Parameters * **entity**: A valid entity handle. * **forwardX**: * **forwardY**: * **forwardZ**: * **rightX**: * **rightY**: * **rightZ**: * **upX**: * **upY**: * **upZ**: * **atX**: * **atY**: * **atZ**: ``` -------------------------------- ### DELETE_RESOURCE_KVP_NO_SYNC Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/DeleteResourceKvpNoSync.md Nonsynchronous operation to delete a resource key-value pair. This is similar to DELETE_RESOURCE_KVP but operates asynchronously. Refer to FLUSH_RESOURCE_KVP for more details on flushing operations. ```APIDOC ## DELETE_RESOURCE_KVP_NO_SYNC ### Description Nonsynchronous operation to delete a resource key-value pair. ### Parameters #### Path Parameters * **key** (string) - Required - The key to delete ``` -------------------------------- ### SetEntityDrawOutlineShader Native Function Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutlineShader.md Sets the shader variant used for drawing entity outlines. Use 0 for the default gauss shader, 1 for a 2px solid color outline, or 2 for a solid color outline that excludes the entity itself. ```c void SET_ENTITY_DRAW_OUTLINE_SHADER(int shader); ``` -------------------------------- ### Draw Entity Outline Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutline.md Enables or disables drawing an outline around an entity. This function is intended for SDK use and not direct script implementation. ```c void SET_ENTITY_DRAW_OUTLINE(Entity entity, BOOL enabled); ``` -------------------------------- ### SET_ENTITY_DRAW_OUTLINE_SHADER Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutlineShader.md Sets the shader variant used for drawing entity outlines. Developers can choose from predefined variants to customize the appearance of outlines. ```APIDOC ## SET_ENTITY_DRAW_OUTLINE_SHADER ### Description Sets the variant of shader that will be used to draw the entity outline. This allows for customization of the outline's appearance. ### Parameters * **shader** (int) - Required - An outline shader variant. Possible values are: * 0: Default value, gauss shader. * 1: 2px wide solid color outline. * 2: Fullscreen solid color except for the entity. ``` -------------------------------- ### GET_MAPDATA_ENTITY_MATRIX Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetMapdataEntityMatrix.md Retrieves an entity's matrix from map data. This function is part of the SDK infrastructure and not intended for direct use from your code. It should be used from JavaScript or another language supporting mutable buffers like ArrayBuffer. The matrix layout is defined as follows: Elements [0], [1], [2] for the right vector; [4], [5], [6] for the forward vector; [8], [9], [10] for the up vector; and [12], [13], [14] for translation coordinates. All other elements should be [0, 0, 0, 1]. ```APIDOC ## GET_MAPDATA_ENTITY_MATRIX ### Description Retrieves an entity's matrix from map data. This function is part of the SDK infrastructure and not intended for direct use from your code. It should be used from JavaScript or another language supporting mutable buffers like ArrayBuffer. Matrix layout is as follows: - Element [0], [1] and [2] should represent the right vector. - Element [4], [5] and [6] should represent the forward vector. - Element [8], [9] and [10] should represent the up vector. - Element [12], [13] and [14] should represent X, Y and Z translation coordinates. - All other elements should be [0, 0, 0, 1]. ### Parameters #### Path Parameters * **mapDataHash** (int) - A mapdata hash from `mapDataLoaded` event. * **entityInternalIdx** (int) - An internal entity's index. * **matrixPtr** (long) - A mutable pointer to a 64-byte buffer of floating-point values, representing an XMFLOAT4X4 in layout. ### Return value * **BOOL** - Whether or not the matrix was retrieved. ``` -------------------------------- ### SET_ENTITY_DRAW_OUTLINE Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutline.md Draws an outline around a given entity. This function supports SDK infrastructure and is not intended to be used directly from your code. ```APIDOC ## SET_ENTITY_DRAW_OUTLINE ### Description Draws an outline around a given entity. ### Parameters * **entity** (Entity) - A valid entity handle. * **enabled** (BOOL) - Whether or not to draw an outline. ``` -------------------------------- ### DELETE_RESOURCE_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/DeleteResourceKvp.md Deletes a key-value pair associated with the resource. This function is part of the shared API set. ```APIDOC ## DELETE_RESOURCE_KVP ### Description Deletes a key-value pair from the resource's key-value store. ### Parameters #### Path Parameters * **key** (string) - Required - The key of the key-value pair to delete. ### Request Example ```lua DeleteResourceKvp('liberty_city') ``` ``` -------------------------------- ### END_FIND_KVP Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/kvp/EndFindKvp.md Closes a KVP find operation, releasing associated resources. This should be called after you are finished iterating through the results of a START_FIND_KVP operation. ```APIDOC ## END_FIND_KVP ### Description Closes a KVP find operation. ### Parameters * **handle**: The KVP find handle returned from [START_FIND_KVP](#_0xDD379006) ### Return value None. ### Example See [START_FIND_KVP](#_0xDD379006) ``` -------------------------------- ### GET_ENTITY_INDEX_FROM_MAPDATA Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/GetEntityIndexFromMapdata.md Returns the transient entity index for a specified mapdata/entity pair. This function is part of the SDK infrastructure and not meant for direct use. ```APIDOC ## GET_ENTITY_INDEX_FROM_MAPDATA ### Description Returns the transient entity index for a specified mapdata/entity pair. This function supports SDK infrastructure and is not intended to be used directly from your code. ### Parameters * **mapdata**: The input map data index from GET_MAPDATA_FROM_HASH_KEY. * **entity**: The input entity handle from GET_ENTITY_MAPDATA_OWNER. ### Return value A transient (non-persistable) index to the requested entity, or -1. ``` -------------------------------- ### Set Entity Draw Outline Color Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutlineColor.md Sets the color for an entity's outline. The default color is `255, 0, 255, 255`. The alpha component is ignored for shaders. ```c void SET_ENTITY_DRAW_OUTLINE_COLOR(int red, int green, int blue, int alpha); ``` -------------------------------- ### Disable Editor Runtime Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/DisableEditorRuntime.md Disables the editor runtime mode. This function is part of the SDK infrastructure and not intended for direct use in your code. ```c void DISABLE_EDITOR_RUNTIME(); ``` -------------------------------- ### SET_ENTITY_DRAW_OUTLINE_COLOR Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/SetEntityDrawOutlineColor.md Sets the color for an entity's outline. The default color is `255, 0, 255, 255`. ```APIDOC ## SET_ENTITY_DRAW_OUTLINE_COLOR ### Description Sets color for entity outline. `255, 0, 255, 255` by default. ### Parameters #### Path Parameters * **red** (int) - Description: Red component of color. * **green** (int) - Description: Green component of color. * **blue** (int) - Description: Blue component of color. * **alpha** (int) - Description: Alpha component of color, ignored for shader `0`. ``` -------------------------------- ### UPDATE_MAPDATA_ENTITY Native Function Signature Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/UpdateMapdataEntity.md This function is part of the SDK infrastructure and should not be used directly in your code. It updates an entity with mapdata and a new entity definition. ```c void UPDATE_MAPDATA_ENTITY(int mapdata, int entity, object entityDef); ``` -------------------------------- ### Reset Mapdata Entity Matrix Source: https://github.com/elduderino420/cfx-docs/blob/main/cfx-natives/sdk/ResetMapdataEntityMatrix.md Resets a mapdata entity's transform matrix to its original state. This function is part of the SDK infrastructure and not meant for direct use in your code. It requires a mapdata hash and an internal entity index. ```c BOOL RESET_MAPDATA_ENTITY_MATRIX(int mapDataHash, int entityInternalIdx); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.