### Example Usage of START_NEW_SCRIPT Source: https://github.com/citizenfx/natives/blob/master/SYSTEM/StartNewScript.md Demonstrates various ways to call the START_NEW_SCRIPT native with different script names and stack sizes. These examples show direct calls to start scripts. ```c g_384A = SYSTEM::START_NEW_SCRIPT("cellphone_flashhand", 1424); l_10D = SYSTEM::START_NEW_SCRIPT("taxiService", 1828); SYSTEM::START_NEW_SCRIPT("AM_MP_YACHT", 5000); SYSTEM::START_NEW_SCRIPT("emergencycall", 512); SYSTEM::START_NEW_SCRIPT("emergencycall", 512); SYSTEM::START_NEW_SCRIPT("FM_maintain_cloud_header_data", 1424); SYSTEM::START_NEW_SCRIPT("FM_Mission_Controller", 31000); SYSTEM::START_NEW_SCRIPT("tennis_family", 3650); SYSTEM::START_NEW_SCRIPT("Celebrations", 3650); ``` -------------------------------- ### Setup Fake Cone Data Example Source: https://github.com/citizenfx/natives/blob/master/HUD/N_0xf83d0febe75e62c9.md Example demonstrating how to set up a fake cone for a blip using the _0xF83D0FEBE75E62C9 native function and then making the cone visible. ```lua local ped = PlayerPedId() local blip = AddBlipForEntity(ped) Citizen.InvokeNative(0xF83D0FEBE75E62C9, blip, -1.0, 1.0, 0.36, 1.0, 8.2, (0.5 * math.pi), 0, 11) SetBlipShowCone(blip, true, 11) ``` -------------------------------- ### Example: Heli Transition Camera Setup Source: https://github.com/citizenfx/natives/blob/master/CAM/SetCamParams.md Recreates a helicopter transition camera effect. This example demonstrates creating a camera, activating it, rendering it, and then setting its parameters with specific values for position, rotation, and field of view. ```lua local cam = CreateCameraWithParams('DEFAULT_SCRIPTED_CAMERA', -1659.574, -707.8544, 29.23778, -7.422939, 0.059666, -117.3886, 43.0557, false, 2) SetCamActive(cam, true) RenderScriptCams(true, false, 3000, true, false, false) SetCamParams(cam, -1660.919, -710.7487, 28.88381, -7.50235, 0.059666, -111.7328, 43.0557, 9100, 0, 0, 2); ``` -------------------------------- ### Example: Heli Transition Camera Setup (JavaScript) Source: https://github.com/citizenfx/natives/blob/master/CAM/SetCamParams.md Recreates a helicopter transition camera effect using JavaScript. This example demonstrates creating a camera, activating it, rendering it, and then setting its parameters with specific values for position, rotation, and field of view. ```javascript let cam = CreateCameraWithParams('DEFAULT_SCRIPTED_CAMERA', -1659.574, -707.8544, 29.23778, -7.422939, 0.059666, -117.3886, 43.0557, false, 2) SetCamActive(cam, true) RenderScriptCams(true, false, 3000, true, false, false) SetCamParams(cam, -1660.919, -710.7487, 28.88381, -7.50235, 0.059666, -111.7328, 43.0557, 9100, 0, 0, 2); ``` -------------------------------- ### C++: GetLineCount Function Example Source: https://github.com/citizenfx/natives/blob/master/HUD/BeginTextCommandLineCount.md Example of how to use _BEGIN_TEXT_COMMAND_LINE_COUNT to get the line count of a string. ```c++ int GetLineCount(char *text, float x, float y) { _BEGIN_TEXT_COMMAND_LINE_COUNT("STRING"); ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); return _END_TEXT_COMMAND_GET_LINE_COUNT(x, y); } ``` -------------------------------- ### Example: Set Vehicle Dirt Level to 0.0 Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/SetVehicleDirtLevel.md Example of how to get the player's current vehicle and set its dirt level to 0.0 using Lua. ```lua local Vehicle = GetVehiclePedIsUsing(PlayerPedId()) SetVehicleDirtLevel(Vehicle, 0.0) -- set the vehicle dirt level to 0.0 ``` -------------------------------- ### Example Usage of Loading Message with Busy Spinner Source: https://github.com/citizenfx/natives/blob/master/HUD/BeginTextCommandBusyspinnerOn.md Demonstrates how to display a custom loading message with a busy spinner. This example shows the setup using _SET_LOADING_PROMPT_TEXT_ENTRY, ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, and _SHOW_LOADING_PROMPT. ```c void StartLoadingMessage(char *text, int spinnerType = 3) { _SET_LOADING_PROMPT_TEXT_ENTRY("STRING"); ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); _SHOW_LOADING_PROMPT(spinnerType); } ``` ```c void ShowLoadingMessage(char *text, int spinnerType = 3, int timeMs = 10000) { _SET_LOADING_PROMPT_TEXT_ENTRY("STRING"); ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); _SHOW_LOADING_PROMPT(spinnerType); WAIT(timeMs); _REMOVE_LOADING_PROMPT(); } ``` -------------------------------- ### Get Player Network Handle Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkHandleFromPlayer.md This example demonstrates how to use NETWORK_HANDLE_FROM_PLAYER to get a player's network handle. It allocates a buffer, calls the native function, and logs the contents of the buffer. ```c++ std::vector GetPlayerNetworkHandle(Player player) { const int size = 13; uint64_t *buffer = std::make_unique(size).get(); NETWORK::NETWORK_HANDLE_FROM_PLAYER(player, reinterpret_cast(buffer), 13); for (int i = 0; i < size; i++) { Log::Msg("networkhandle[%i]: %llx", i, buffer[i]); } std::vector result(buffer, buffer + sizeof(buffer)); return result; } ``` -------------------------------- ### Get Player Ped Lua Example Source: https://github.com/citizenfx/natives/blob/master/PLAYER/GetPlayerPed.md Example of how to get a player's ped using their server ID and then act on it. ```lua local playerIdx = GetPlayerFromServerId(source) local ped = GetPlayerPed(playerIdx) -- act on the ped ``` -------------------------------- ### NETWORK_START_SOLO_TUTORIAL_SESSION Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkStartSoloTutorialSession.md Initiates a solo tutorial session. This function does not take any arguments. ```APIDOC ## NETWORK_START_SOLO_TUTORIAL_SESSION ### Description Starts a solo tutorial session. This function is part of the NETWORK namespace and is used to prepare a session for a single player tutorial. ### Signature ```c void NETWORK_START_SOLO_TUTORIAL_SESSION(); ``` ### Alias `0x17E0198B3882C2CB` ``` -------------------------------- ### Example: Get and Print Convertible Roof State Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/GetConvertibleRoofState.md This Lua example demonstrates how to get the current vehicle a player is in and then print its convertible roof state to the console. ```lua local vehicle = GetVehiclePedIsIn(PlayerPedId()) print(GetConvertibleRoofState(vehicle)) ``` -------------------------------- ### Create Camera Example Source: https://github.com/citizenfx/natives/blob/master/CAM/CreateCamera.md This example demonstrates how to create a camera using the 'DEFAULT_SCRIPTED_CAMERA' type and then renders it. Ensure RENDER_SCRIPT_CAMS is called to display the created camera. ```lua -- creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type local cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true) RenderScriptCams(true, false, 0, true, true) ``` ```js // creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type const cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true); RenderScriptCams(true, false, 0, true, true) ``` ```cs using static CitizenFX.Core.Native.API; // creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type int cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true); RenderScriptCams(true, false, 0, true, true); ``` -------------------------------- ### Get Weapon Type Group Examples (JavaScript) Source: https://github.com/citizenfx/natives/blob/master/WEAPON/GetWeapontypeGroup.md These examples demonstrate how to use the GetWeapontypeGroup function in JavaScript to get the group hash for various weapons, including the currently selected weapon. ```javascript console.log(GetWeapontypeGroup(`WEAPON_PISTOL`)); // Outputs the hash of GROUP_PISTOL console.log(GetWeapontypeGroup(`WEAPON_RPG`)); // Outputs the hash of GROUP_HEAVY console.log(GetWeapontypeGroup(`WEAPON_SNOWBALL`)); // Outputs the hash of GROUP_THROWN console.log(GetWeapontypeGroup(`WEAPON_MUSKET`)); // Outputs the hash of GROUP_SNIPER console.log(GetWeapontypeGroup(GetSelectedPedWeapon(PlayerPedId()))); // Outputs the hash of the currently selected weapon ``` -------------------------------- ### Get Weapon Type Group Examples (Lua) Source: https://github.com/citizenfx/natives/blob/master/WEAPON/GetWeapontypeGroup.md These examples demonstrate how to use the GetWeapontypeGroup function in Lua to get the group hash for various weapons, including the currently selected weapon. ```lua print(GetWeapontypeGroup(`WEAPON_PISTOL`)) -- Outputs the hash of GROUP_PISTOL print(GetWeapontypeGroup(`WEAPON_RPG`)) -- Outputs the hash of GROUP_HEAVY print(GetWeapontypeGroup(`WEAPON_SNOWBALL`)) -- Outputs the hash of GROUP_THROWN print(GetWeapontypeGroup(`WEAPON_MUSKET`)) -- Outputs the hash of GROUP_SNIPER print(GetWeapontypeGroup(GetSelectedPedWeapon(PlayerPedId()))) -- Outputs the hash of the currently selected weapon ``` -------------------------------- ### Get Frame Time Example Source: https://github.com/citizenfx/natives/blob/master/MISC/GetFrameTime.md This Lua example demonstrates how to use GET_FRAME_TIME to get the precise frame time. It also shows a less accurate method using GetGameTimer for comparison. ```lua local time1 = GetGameTimer() Citizen.Wait(0) -- Prints for example 0.01253530010581 at around 90 FPS print(GetFrameTime()) -- This would print about the same as above, but is less accurate, ie: 0.012 print((GetGameTimer() - time1) / 1000) ``` -------------------------------- ### Example Usage of NETWORK_JOIN_TRANSITION Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkJoinTransition.md This example demonstrates how to use NETWORK_JOIN_TRANSITION. It first retrieves a player handle from a friend, then converts it to a player object, and finally initiates the network transition. ```c int handle[76]; NETWORK_HANDLE_FROM_FRIEND(iSelectedPlayer, &handle[0], 13); Player uVar2 = NETWORK_GET_PLAYER_FROM_GAMER_HANDLE(&handle[0]); NETWORK_JOIN_TRANSITION(uVar2); nothing doin. ``` -------------------------------- ### Get Vehicle Class Name Example Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/GetVehicleClass.md This example demonstrates how to use GET_VEHICLE_CLASS to get the integer class ID, format it into a string, and then retrieve the human-readable class name using UI::_GET_LABEL_TEXT. ```c char buffer[128]; std::sprintf(buffer, "VEH_CLASS_%i", VEHICLE::GET_VEHICLE_CLASS(vehicle)); char* className = UI::_GET_LABEL_TEXT(buffer); ``` -------------------------------- ### Start Solo Tutorial Session Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkStartSoloTutorialSession.md Initiates a solo tutorial session. This function is part of the NETWORK namespace. ```c // 0x17E0198B3882C2CB 0x408A9436 void NETWORK_START_SOLO_TUTORIAL_SESSION(); ``` -------------------------------- ### Get Friend Count - C# Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkGetFriendCount.md Call this native to get the number of friends the player has. No setup is required. ```c // 0x203F1CFD823B27A4 0xA396ACDE int NETWORK_GET_FRIEND_COUNT(); ``` -------------------------------- ### Get Absolute Value of Float Source: https://github.com/citizenfx/natives/blob/master/MISC/Absf.md Use this native to get the absolute value of a float. No setup is required. ```c // 0x73D57CFFDD12C355 0xAF6F6E0B float ABSF(float value); ``` -------------------------------- ### Create Camera with Parameters Example (C#) Source: https://github.com/citizenfx/natives/blob/master/CAM/CreateCamWithParams.md Example of creating a camera using the CREATE_CAM_WITH_PARAMS native in C#. This creates a default scripted camera at the specified coordinates and rotation. ```csharp int cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", 561.3f, 301.3f, 63.0f, 0.0f, 0.0f, 0.0f, 90.0f); ``` -------------------------------- ### Get Ammo in Ped Weapon Example (Lua) Source: https://github.com/citizenfx/natives/blob/master/WEAPON/GetAmmoInPedWeapon.md This Lua example demonstrates how to use the GET_AMMO_IN_PED_WEAPON native function to get the ammo count for the player's current weapon. Ensure the weapon hash is correctly defined. ```lua WEAPON::GET_AMMO_IN_PED_WEAPON(PLAYER::PLAYER_PED_ID(), a_0) From decompiled scripts Returns total ammo in weapon GTALua Example : natives.WEAPON.GET_AMMO_IN_PED_WEAPON(plyPed, WeaponHash) ``` -------------------------------- ### Start New Script with Name Hash and Args Source: https://github.com/citizenfx/natives/blob/master/SYSTEM/StartNewScriptWithNameHashAndArgs.md Initiates a new script using its hash and provides arguments. Ensure correct script hash, argument count, and stack size are provided. ```c int START_NEW_SCRIPT_WITH_NAME_HASH_AND_ARGS(Hash scriptHash, Any* args, int argCount, int stackSize); ``` -------------------------------- ### Check if Game Started for First Time Source: https://github.com/citizenfx/natives/blob/master/MISC/N_0x6fddf453c0c756ec.md This C++ function likely returns a boolean indicating if the game is being launched for the very first time. Use this to trigger initial setup or tutorials. ```c // 0x6FDDF453C0C756EC 0xC3C10FCC BOOL _0x6FDDF453C0C756EC(); ``` ```text HAS_* Probably something like "has game been started for the first time". ``` -------------------------------- ### Get Number of Streaming Requests Source: https://github.com/citizenfx/natives/blob/master/STREAMING/GetNumberOfStreamingRequests.md Call this native to get the current number of active streaming requests. No setup is required. ```c // 0x4060057271CEBC89 0xC2EE9A02 int GET_NUMBER_OF_STREAMING_REQUESTS(); ``` -------------------------------- ### BEGIN_TEXT_COMMAND_DISPLAY_HELP Source: https://github.com/citizenfx/natives/blob/master/HUD/BeginTextCommandDisplayHelp.md Initializes a text command to display help text. This function is used to set up the text that will be displayed to the player, often in response to an action or context. ```APIDOC ## BEGIN_TEXT_COMMAND_DISPLAY_HELP ### Description Initializes a text command to display help text. This function is used to set up the text that will be displayed to the player, often in response to an action or context. ### Method ```c void BEGIN_TEXT_COMMAND_DISPLAY_HELP(char* inputType); ``` ### Parameters #### Path Parameters - **inputType** (char*) - Description of the input type for the help text. ``` -------------------------------- ### Get Hash Of Map Area At Coords C# Example Source: https://github.com/citizenfx/natives/blob/master/ZONE/GetHashOfMapAreaAtCoords.md This C# example demonstrates how to use GET_HASH_OF_MAP_AREA_AT_COORDS to get the map area hash for the player's current location. Possible return values include hashes for city and countryside. ```csharp Ped player = Game.Player.Character; Hash h = Function.Call(Hash.GET_HASH_OF_MAP_AREA_AT_COORDS, player.Position.X, player.Position.Y, player.Position.Z); ``` -------------------------------- ### Start Recording - C++ Source: https://github.com/citizenfx/natives/blob/master/RECORDING/StartRecording.md Starts recording a replay. If already recording, this function does nothing. Use mode 0 for action replay and mode 1 to start recording. ```cpp // 0xC3AC2FFF9612AC81 void _START_RECORDING(int mode); ``` -------------------------------- ### Show Notification Example (C++) Source: https://github.com/citizenfx/natives/blob/master/HUD/BeginTextCommandThefeedPost.md Example of how to show a notification using BEGIN_TEXT_COMMAND_THEFEED_POST and other HUD natives. Requires the text to be set using ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME. ```cpp int ShowNotification(char *text) { BEGIN_TEXT_COMMAND_THEFEED_POST("STRING"); ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); return _DRAW_NOTIFICATION(1, 1); } ``` -------------------------------- ### Example Usage of SET_VEHICLE_COLOUR_COMBINATION Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/SetVehicleColourCombination.md This example demonstrates how to get the player's current vehicle and set its color combination to a random index. ```lua local vehicle = GetVehiclePedIsIn(PlayerPedId(), false) local index = math.random(0, 16) SetVehicleColourCombination(vehicle, index) ``` -------------------------------- ### Example Usage of AUDIO::_B4BBFD9CD8B3922B Source: https://github.com/citizenfx/natives/blob/master/AUDIO/RemovePortalSettingsOverride.md These examples demonstrate how to call the AUDIO::_B4BBFD9CD8B3922B native with different portal settings names. This function is used to remove portal setting overrides, such as for broken windows. ```csharp AUDIO::_B4BBFD9CD8B3922B("V_CARSHOWROOM_PS_WINDOW_UNBROKEN"); AUDIO::_B4BBFD9CD8B3922B("V_CIA_PS_WINDOW_UNBROKEN"); AUDIO::_B4BBFD9CD8B3922B("V_DLC_HEIST_APARTMENT_DOOR_CLOSED"); AUDIO::_B4BBFD9CD8B3922B("V_FINALEBANK_PS_VAULT_INTACT"); AUDIO::_B4BBFD9CD8B3922B("V_MICHAEL_PS_BATHROOM_WITH_WINDOW"); ``` -------------------------------- ### Get Player Switch Interpolation Out Duration Source: https://github.com/citizenfx/natives/blob/master/STREAMING/GetPlayerSwitchInterpOutDuration.md Call this native function to get the duration of the player switch interpolation out. No setup is required. ```c // 0x08C2D6C52A3104BB 0x569847E3 int GET_PLAYER_SWITCH_INTERP_OUT_DURATION(); ``` -------------------------------- ### Open Matchmaking Transition Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkOpenTransitionMatchmaking.md Call this native to open the matchmaking transition screen. No setup or imports are required. ```c // 0x2B3A8F7CA3A38FDE 0xC71E607B void NETWORK_OPEN_TRANSITION_MATCHMAKING(); ``` -------------------------------- ### Get Total Number of Players Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkGetTotalNumPlayers.md Use this function to get the total number of players connected to the server. No setup or imports are required. ```c // 0xCF61D4B4702EE9EB 0xF4F13B06 int NETWORK_GET_TOTAL_NUM_PLAYERS(); ``` -------------------------------- ### Start Benchmark Recording (C) Source: https://github.com/citizenfx/natives/blob/master/MISC/StartBenchmarkRecording.md Initiates benchmark recording. Related functions begin with START_* followed by D or E. ```c // 0x92790862E36C2ADA void _START_BENCHMARK_RECORDING(); ``` -------------------------------- ### Get Cutscene Elapsed Time Source: https://github.com/citizenfx/natives/blob/master/CUTSCENE/GetCutsceneTime.md Use this function to get the current elapsed time of a cutscene in milliseconds. No setup or imports are required. ```c // 0xE625BEABBAFFDAB9 0x53F5B5AB int GET_CUTSCENE_TIME(); ``` -------------------------------- ### Create Camera with Parameters Example (JavaScript) Source: https://github.com/citizenfx/natives/blob/master/CAM/CreateCamWithParams.md Example of creating a camera using the CREATE_CAM_WITH_PARAMS native in JavaScript. This creates a default scripted camera at the specified coordinates and rotation. ```javascript const cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", 561.3, 301.3, 63.0, 0.0, 0.0, 0.0, 90.0); ``` -------------------------------- ### Get Max Free Camera Range Source: https://github.com/citizenfx/natives/blob/master/CAM/ReplayFreeCamGetMaxRange.md Call this function to get the maximum distance the free camera can be from its target. No setup is required. ```c // 0x8BFCEB5EA1B161B6 float _REPLAY_FREE_CAM_GET_MAX_RANGE(); ``` -------------------------------- ### Example Usage of IsVehicleSirenOn Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/IsVehicleSirenOn.md This Lua example demonstrates how to get the player's current vehicle and then check if its siren is on, printing the result to the console. ```lua local veh = GetVehiclePedIsIn(PlayerPedId()) print(tostring(IsVehicleSirenOn(veh))) ``` -------------------------------- ### Create Camera with Parameters Example (Lua) Source: https://github.com/citizenfx/natives/blob/master/CAM/CreateCamWithParams.md Example of creating a camera using the CREATE_CAM_WITH_PARAMS native in Lua. This creates a default scripted camera at the specified coordinates and rotation. ```lua local cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", 561.3, 301.3, 63.0, 0.0, 0.0, 0.0, 90.0) ``` -------------------------------- ### Get Index of Current Level (C) Source: https://github.com/citizenfx/natives/blob/master/MISC/GetIndexOfCurrentLevel.md Use this native function to get the index of the current level. No specific setup or imports are required. ```c // 0xCBAD6729F7B1F4FC 0x6F203C6E int GET_INDEX_OF_CURRENT_LEVEL(); ``` -------------------------------- ### End Tutorial Session Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkEndTutorialSession.md Call this native to end the current tutorial session. No specific setup or imports are required. ```c // 0xD0AFAFF5A51D72F7 0xBA57E53E void NETWORK_END_TUTORIAL_SESSION(); ``` -------------------------------- ### Get Number of Active Blips (C) Source: https://github.com/citizenfx/natives/blob/master/HUD/GetNumberOfActiveBlips.md Call this function to get the current count of active blips on the map. No setup or imports are required. ```c // 0x9A3FF3DE163034E8 0x144020FA int GET_NUMBER_OF_ACTIVE_BLIPS(); ``` -------------------------------- ### Example: Rendering and Clearing a Scripted Camera Source: https://github.com/citizenfx/natives/blob/master/CAM/RenderScriptCams.md This example demonstrates how to create, configure, render, and then clear a scripted camera. It includes setting camera coordinates and rotation, rendering with a smooth transition, and resetting focus. ```lua local casino = vector3(881.31, 74.71, 94.43) -- Create the camera that will be used for RenderScriptCams local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) -- Set the camera coordinates to be in front of the Casino SetCamCoord(cam, casino.x, casino.y, casino.z) -- Rotate the camera towards the casino SetCamRot(cam, -25.0, 0.0, -124.22) -- Render the camera and so a smooth transition for 2000ms RenderScriptCams(true, true, 2000, false, true) -- tell the game to load maps, collisions, objects, etc around the casino. SetFocusPosAndVel(casino.x, casino.y, casino.z, 0.0, 0.0, 0.0) -- We wait 5 seconds + 2 extra for the transition Wait(7000) -- Remove the cam, we no longer need it DestroyCam(cam) -- reset streaming focus to be at the local player ped ClearFocus() -- Stop rendering the script camera and interpolate back to their player ped RenderScriptCams(false, true, 2000, false, false) ``` -------------------------------- ### Get Lock-on Distance of Current Ped Weapon Source: https://github.com/citizenfx/natives/blob/master/WEAPON/GetLockonDistanceOfCurrentPedWeapon.md Use this function to get the lock-on distance of the ped's current weapon. No setup is required. ```c float GET_LOCKON_DISTANCE_OF_CURRENT_PED_WEAPON(Ped ped); ``` -------------------------------- ### Lua Example: Play and Display BINK Movie Source: https://github.com/citizenfx/natives/blob/master/GRAPHICS/SetBinkMovie.md This Lua script demonstrates how to initialize, seek, play, and draw a BINK movie. It includes a loop to print the playback progress as a percentage and plays/draws the movie in fullscreen, centered on the screen. ```lua Citizen.CreateThread(function() local binkint = SetBinkMovie("casino_trailer") SetBinkMovieTime(binkint, 0.0) -- Seeks to 0% while (GetBinkMovieTime(binkint) < 100.0) do -- Very Basic Idea That Works? print(math.floor(GetBinkMovieTime(binkint) * 100)/100 .. "%" ) -- Prints current playtime (as percentage). PlayBinkMovie(binkint) DrawBinkMovie(binkint, 0.5, 0.5, 1.0, 1.0, 0.0, 255, 255, 255, 255) -- This example draws and plays in Fullscreen and in the center of screen (no matter the resolution). Citizen.Wait(0) end end) ``` -------------------------------- ### Cleanup Async Install Native Source: https://github.com/citizenfx/natives/blob/master/MISC/CleanupAsyncInstall.md This native function is used to clean up resources associated with an asynchronous installation process. It does not require any specific setup or imports. ```c // 0xC79AE21974B01FB2 void _CLEANUP_ASYNC_INSTALL(); ``` -------------------------------- ### Start Saving File to Cloud (C) Source: https://github.com/citizenfx/natives/blob/master/DATAFILE/DatafileStartSaveToCloud.md Use this native to initiate the cloud save process for a file. Ensure the filename is correctly formatted. ```c // 0x83BCCE3224735F05 0x768CBB35 BOOL DATAFILE_START_SAVE_TO_CLOUD(char* filename); ``` -------------------------------- ### CreateObject Example in JavaScript Source: https://github.com/citizenfx/natives/blob/master/OBJECT/CreateObject.md This JavaScript example shows how to create an object, including loading the model if necessary. It uses `GetHashKey` and `CreateObject`. ```javascript async function Main() { const modelHash = GetHashKey("prop_weed_01"); if (!HasModelLoaded(modelHash)) { // If the model isnt loaded we request the loading of the model and wait that the model is loaded RequestModel(modelHash); do { new Promise(resolve => setTimeout(resolve, 100)); } while (!HasModelLoaded(modelHash)); } // At this moment the model its loaded, so now we can create the object let [x, y, z] = GetEntityCoords(PlayerPedId()); const obj = CreateObject(modelHash, x, y, z, true); } Main(); ``` -------------------------------- ### Invite Function Example Source: https://github.com/citizenfx/natives/blob/master/HUD/EndTextCommandThefeedPostCrewtagWithGameName.md This C++ example demonstrates how to use related HUD functions to send invites to network players. It handles player names, notification settings, and clan information. Note that the original comment mentions this may crash the game. ```cpp p0 = 1 or 0 crashes my game... this is for sending invites to network players - jobs/apartment/ect... return notification handle int invite(Player player) { networkHandleMgr netHandle; networkClanMgr clan; char *playerName = GET_PLAYER_NAME(player); _SET_NOTIFICATION_TEXT_ENTRY("STRING"); _SET_NOTIFACTION_COLOR_NEXT(1); ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(playerName); NETWORK_HANDLE_FROM_PLAYER(player, &netHandle.netHandle, 13); if (NETWORK_CLAN_PLAYER_IS_ACTIVE(&netHandle.netHandle)) { NETWORK_CLAN_PLAYER_GET_DESC(&clan.clanHandle, 35, &netHandle.netHandle); _DRAW_NOTIFICATION_CLAN_INVITE(0, _0x54E79E9C(&clan.clanHandle, 35), &clan.unk17, clan.isLeader, 0, 0, clan.clanHandle, playerName, 0, 0, 0); } } ``` -------------------------------- ### Open Sequence Task Example in C# Source: https://github.com/citizenfx/natives/blob/master/TASK/OpenSequenceTask.md Demonstrates opening a sequence task, performing animations, and then closing and clearing the sequence. Ensure CLOSE_SEQUENCE_TASK and CLEAR_SEQUENCE_TASK are called to prevent the sequence system from getting stuck. ```cs using CitizenFX.Core; using static CitizenFX.Core.Native.API; string animDict = "timetable@ron@ig_5_p3"; RequestAnimDict(animDict); while (!HasAnimDictLoaded(animDict)) { await BaseScript.Delay(0); } int ped = PlayerPedId(); Vector3 pos = GetEntityCoords(ped, false); // you can change the model, but you might have to change the offsets below. uint hash = Game.GenerateHashASCII("prop_bench_01a"); int obj = GetClosestObjectOfType(pos.X, pos.Y, pos.Z, 5.0f, hash, false, false, false); if (obj == 0) { Debug.WriteLine("No valid object within range!"); return; } Vector3 tgtPos = GetOffsetFromEntityInWorldCoords(obj, 0.0f, -0.7f, 0.0f); int sequenceId = 0; // open the task sequence so we can get our sequence id OpenSequenceTask(ref sequenceId); float desiredHeading = GetEntityHeading(obj) - 180.0f; // go to the entities offset TaskGoStraightToCoord(0, tgtPos.X, tgtPos.Y, tgtPos.Z, 1.0f, 4000, desiredHeading, 1.0f); // sit on the bench indefinitely (you can change -1 here to however long you want to sit) TaskPlayAnim(0, animDict, "ig_5_p3_base", 8.0f, 8.0f, -1, 1, 1.0f, false, false, false); // close the sequence so we can perform it CloseSequenceTask(sequenceId); // perform the sequence, this will not work if the sequence is still open. TaskPerformSequence(ped, sequenceId); // free the sequence slot so it can be re-used ClearSequenceTask(ref sequenceId); // cleanup the animation dict so the engine can remove it when its no longer needed RemoveAnimDict(animDict); ``` -------------------------------- ### Script Loading and Starting Pattern Source: https://github.com/citizenfx/natives/blob/master/SYSTEM/StartNewScript.md This pattern shows a common workflow for starting a new script: request it, wait for it to load, start it, and then mark it as no longer needed. Ensure the script is loaded before attempting to start it. ```c SCRIPT::REQUEST_SCRIPT(a_0); if (SCRIPT::HAS_SCRIPT_LOADED(a_0)) { SYSTEM::START_NEW_SCRIPT(a_0, v_3); SCRIPT::SET_SCRIPT_AS_NO_LONGER_NEEDED(a_0); return 1; } ``` -------------------------------- ### GET_PAUSE_MENU_POSITION Source: https://github.com/citizenfx/natives/blob/master/HUD/GetPauseMenuPosition.md Gets the starting position (top-left) of the Pause Menu's body. ```APIDOC ## GET_PAUSE_MENU_POSITION ### Description This function returns the starting position (Top left) of the Pause Menu's body. ### Method NATIVE ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response - **Return Value** (Vector3) - The top-left coordinates of the pause menu. ``` -------------------------------- ### Example: Dynamically Set Follow Ped Camera Source: https://github.com/citizenfx/natives/blob/master/CAM/SetFollowPedCamThisUpdate.md This example demonstrates how to continuously set a specific follow ped camera, 'FOLLOW_PED_ATTACHED_TO_ROPE_CAMERA', with a 500ms ease-in time. This can be used to create dynamic camera effects during gameplay. ```lua CreateThread(function() while true do SetFollowPedCamThisUpdate("FOLLOW_PED_ATTACHED_TO_ROPE_CAMERA", 500) -- Zoomed out the ped camera Wait(0) end end) ``` -------------------------------- ### Get Time Since Player Drove on Pavement Source: https://github.com/citizenfx/natives/blob/master/PLAYER/GetTimeSincePlayerDroveOnPavement.md Use this native to get the time in milliseconds since the player last drove on pavement. No specific setup is required. ```c // 0xD559D2BE9E37853B 0x8836E732 int GET_TIME_SINCE_PLAYER_DROVE_ON_PAVEMENT(Player player); ``` -------------------------------- ### Example Usage of PointCamAtEntity Source: https://github.com/citizenfx/natives/blob/master/CAM/PointCamAtEntity.md This Lua example demonstrates creating a camera, pointing it at the player's ped, and then rendering the script cameras. ```lua local cam = CreateCameraWithParams("DEFAULT_SCRIPTED_CAMERA", GetEntityCoords(PlayerPedId()), 0.0, 0.0, 0.0, 90.0, true, 2) PointCamAtEntity(cam, PlayerPedId(), 0.0, 0.0, 0.0, true) RenderScriptCams(true, false, 0, true, true) ``` -------------------------------- ### Example Usage of GET_WEAPON_CLIP_SIZE Source: https://github.com/citizenfx/natives/blob/master/WEAPON/GetWeaponClipSize.md This example demonstrates how to get the clip size of the player's current weapon and display it. It first checks if a weapon is equipped and valid before calling GET_WEAPON_CLIP_SIZE. ```c // Returns the size of the default weapon component clip. Use it like this: char cClipSize[32]; Hash cur; if (WEAPON::GET_CURRENT_PED_WEAPON(playerPed, &cur, 1)) { if (WEAPON::IS_WEAPON_VALID(cur)) { int iClipSize = WEAPON::GET_WEAPON_CLIP_SIZE(cur); sprintf_s(cClipSize, "ClipSize: %.d", iClipSize); vDrawString(cClipSize, 0.5f, 0.5f); } } ``` -------------------------------- ### Example Usage of PAD::_0xE1615EC03B3BB4FD Source: https://github.com/citizenfx/natives/blob/master/PAD/N_0xe1615ec03b3bb4fd.md This example demonstrates how PAD::_0xE1615EC03B3BB4FD can be used in conjunction with other input checks to modify camera look behavior. ```c if (PAD::_GET_LAST_INPUT_METHOD(2)) { if (a_5) { if (PAD::IS_LOOK_INVERTED()) { a_3 *= -1; } if (PAD::_E1615EC03B3BB4FD()) { a_3 *= -1; } } } ``` -------------------------------- ### Example: Disable Explosion from Body Damage on Collision (JavaScript) Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/SetDisableExplodeFromBodyDamageOnCollision.md This JavaScript example shows how to get the player's vehicle and disable its explosion property upon collision damage. ```javascript // Retrieve the player ped const playerPed = PlayerPedId(); // Retrieve the vehicle the player is currently in const vehicle = GetVehiclePedIsIn(playerPed, false); // Disable explosion from body damage on collision for the vehicle SetDisableExplodeFromBodyDamageOnCollision(vehicle, true); ``` -------------------------------- ### Example Usage of TASK_FOLLOW_POINT_ROUTE with Route Extension Source: https://github.com/citizenfx/natives/blob/master/TASK/TaskFollowPointRoute.md Demonstrates how to use TASK_FLUSH_ROUTE, TASK_EXTEND_ROUTE, and TASK_FOLLOW_POINT_ROUTE to make a player ped follow a defined route. ```lua TaskFlushRoute() TaskExtendRoute(0.0, 0.0, 70.0) TaskExtendRoute(10.0, 0.0, 70.0) TaskExtendRoute(10.0, 10.0, 70.0) TaskFollowPointRoute(PlayerPedId(), 1.0, 0) ``` -------------------------------- ### Example Usage of GET_MODEL_DIMENSIONS Source: https://github.com/citizenfx/natives/blob/master/MISC/GetModelDimensions.md This example demonstrates how to use GET_MODEL_DIMENSIONS to get the dimensions of the player's current model. The size is calculated by subtracting the minimum vector from the maximum vector. ```plaintext Gets the dimensions of a model. Calculate (maximum - minimum) to get the size, in which case, Y will be how long the model is. Example from the scripts: MISC::GET_MODEL_DIMENSIONS(ENTITY::GET_ENTITY_MODEL(PLAYER::PLAYER_PED_ID()), &v_1A, &v_17); ``` -------------------------------- ### _START_RECORDING Source: https://github.com/citizenfx/natives/blob/master/RECORDING/StartRecording.md Starts recording a replay. If already recording, this function does nothing. ```APIDOC ## _START_RECORDING ### Description Starts recording a replay. If already recording a replay, does nothing. ### Method Native Function Call ### Parameters #### Path Parameters - **mode** (int) - Required - 0 turns on action replay, 1 starts recording ``` -------------------------------- ### Check if Ped is Getting Up Source: https://github.com/citizenfx/natives/blob/master/TASK/IsPedGettingUp.md Use this native to determine if a ped is currently in an animation of getting up from a prone or seated position. No specific setup is required beyond having a valid ped handle. ```c // 0x2A74E1D5F2F00EEC 0x320813E6 BOOL IS_PED_GETTING_UP(Ped ped); ``` -------------------------------- ### Displaying Help Text and Setting Style in Lua Source: https://github.com/citizenfx/natives/blob/master/HUD/SetFloatingHelpTextStyle.md This Lua example demonstrates how to display custom help text and configure the floating help text style. It must be called every frame. ```lua function DisplayHelpText(string) BeginTextCommandDisplayHelp("STRING") AddTextComponentSubstringPlayerName(string) EndTextCommandDisplayHelp(1, false, false, 0) end CreateThread(function() while true do Wait(0) local Ped = PlayerPedId() DisplayHelpText('Example Text') SetFloatingHelpTextStyle(0, 2, 2, 0, 3, 0) SetFloatingHelpTextToEntity(0, Ped, 0, 0) end end) ``` -------------------------------- ### Draw Bink Movie Example Source: https://github.com/citizenfx/natives/blob/master/GRAPHICS/DrawBinkMovie.md This example demonstrates how to play and draw a Bink movie in fullscreen. It initializes the movie, seeks to the beginning, and then enters a loop to play and draw the movie frame by frame until it completes. ```lua Citizen.CreateThread(function() local binkint = SetBinkMovie("casino_trailer") -- BINK movie, list can be found at https://gist.github.com/ItsJunction/8046f28c29ea8ff2821e9e4f933f595f SetBinkMovieTime(binkint, 0.0) -- Seeks to 0%, just incase of errors. while (GetBinkMovieTime(binkint) < 100.0) do print(math.floor(GetBinkMovieTime(binkint) * 100)/100 .. "%" ) -- Prints current playtime (as percentage). PlayBinkMovie(binkint) DrawBinkMovie(binkint, 0.5, 0.5, 1.0, 1.0, 0.0, 255, 255, 255, 255) -- This example draws and plays in fullscreen in the center (no matter the resolution). Citizen.Wait(0) end end) ``` -------------------------------- ### Example: Create a Local Ped Duplicate Source: https://github.com/citizenfx/natives/blob/master/PED/ClonePed.md This example demonstrates how to create a locally visible duplicate of the local player for presentation purposes. Ensure the ped handle is used correctly after cloning. ```lua -- makes a locally visible duplicate of the local player for presentation local playerDummy = ClonePed(PlayerPedId(), false, false, true) SetEntityCoords(playerDummy, pos.x, pos.y, pos.z) ``` -------------------------------- ### GetClockDayOfMonth - C# Source: https://github.com/citizenfx/natives/blob/master/CLOCK/GetClockDayOfMonth.md Use this native to get the current day of the month. No setup is required. ```csharp int day = GET_CLOCK_DAY_OF_MONTH(); ``` -------------------------------- ### Alternative Script Loading and Starting Pattern with Wait Loop Source: https://github.com/citizenfx/natives/blob/master/SYSTEM/StartNewScript.md An alternative method for starting a script that includes a wait loop to ensure the script is loaded. This approach polls for script loading status and uses a small wait interval. ```c v_2 = "MrsPhilips2"; SCRIPT::REQUEST_SCRIPT(v_2); while (!SCRIPT::HAS_SCRIPT_LOADED(v_2)) { SCRIPT::REQUEST_SCRIPT(v_2); SYSTEM::WAIT(0); } sub_8792(36); SYSTEM::START_NEW_SCRIPT(v_2, 17000); SCRIPT::SET_SCRIPT_AS_NO_LONGER_NEEDED(v_2); ``` -------------------------------- ### Get Entity Animation Current Time Source: https://github.com/citizenfx/natives/blob/master/ENTITY/GetEntityAnimCurrentTime.md Use this function to get the current playback time of an animation on an entity. The value ranges from 0.0 (start) to 1.0 (end) and wraps around. ```c float GET_ENTITY_ANIM_CURRENT_TIME(Entity entity, char* animDict, char* animName); ``` -------------------------------- ### PrefetchSrl Usage Example Source: https://github.com/citizenfx/natives/blob/master/STREAMING/PrefetchSrl.md Example demonstrating how to use PrefetchSrl to load a specific SRL, wait for it to load, and then begin it. This is useful for pre-loading map areas for cinematics. ```lua PrefetchSrl('GTAO_INTRO_MALE') while not IsSrlLoaded() do Citizen.Wait(100) end BeginSrl() ``` -------------------------------- ### Lua: Display and Test Help Message Source: https://github.com/citizenfx/natives/blob/master/HUD/BeginTextCommandIsThisHelpMessageBeingDisplayed.md This Lua example demonstrates how to create a text entry, display a help message using `BeginTextCommandDisplayHelp`, and then test if that message has been displayed using `BeginTextCommandIsThisHelpMessageBeingDisplayed` and `EndTextCommandIsThisHelpMessageBeingDisplayed`. ```lua -- Create new text entry AddTextEntry('TEST_LABEL', 'Hello world.') -- Draw help message BeginTextCommandDisplayHelp('TEST_LABEL') EndTextCommandDisplayHelp(0, false, true, -1) -- Test if the message has been displayed BeginTextCommandIsThisHelpMessageBeingDisplayed("TEST_LABEL") local isDisplayed = EndTextCommandIsThisHelpMessageBeingDisplayed(0) ``` -------------------------------- ### Example: Suppress Vehicle Spawning Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/SetVehicleModelIsSuppressed.md This example demonstrates how to suppress the spawning of a specific vehicle model, in this case, 'taco', from appearing in traffic. Use GAMEPLAY::GET_HASH_KEY to get the model hash. ```c++ VEHICLE::SET_VEHICLE_MODEL_IS_SUPPRESSED(GAMEPLAY::GET_HASH_KEY("taco"), true); ``` -------------------------------- ### Begin Replay Statistics Source: https://github.com/citizenfx/natives/blob/master/MISC/BeginReplayStats.md Call this native to begin recording statistics for a replay. Parameters p0 and p1 are currently undocumented. ```c // 0xE0E500246FF73D66 0x17F4F44D void BEGIN_REPLAY_STATS(Any p0, Any p1); ``` -------------------------------- ### Get Substring Slice in C++ Source: https://github.com/citizenfx/natives/blob/master/HUD/GetTextSubstringSlice.md Use this function to extract a portion of a string between specified start and end indices. The length of the resulting substring is determined by the difference between the end and start positions. ```c char* _GET_TEXT_SUBSTRING_SLICE(char* text, int startPosition, int endPosition); ``` ```c // Get "STRING" text from "MY_STRING" subStr = HUD::_GET_TEXT_SUBSTRING_SLICE("MY_STRING", 3, 9); ``` ```c // Overflows are possibly replaced with underscores (needs verification) subStr = HUD::_GET_TEXT_SUBSTRING_SLICE("MY_STRING", 3, 10); // "STRING_"? ``` -------------------------------- ### Show or Hide Start Mission Instructional Button Source: https://github.com/citizenfx/natives/blob/master/HUD/ShowStartMissionInstructionalButton.md Use this native to control the display of the instructional button for mission starts. Pass `true` to show the button and `false` to hide it. ```c // 0xF1A6C18B35BCADE6 0xA2CAAB4F void SHOW_START_MISSION_INSTRUCTIONAL_BUTTON(BOOL p0); ``` -------------------------------- ### Get Random Integer Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkGetRandomInt.md Call this native to obtain a random integer. No setup or arguments are required. ```c // 0x599E4FA1F87EB5FF 0x208DD848 int NETWORK_GET_RANDOM_INT(); ``` -------------------------------- ### Lua Example: Implementing Depth of Field with Camera Source: https://github.com/citizenfx/natives/blob/master/CAM/SetCamDofStrength.md This example demonstrates how to create a camera, set its position, configure shallow depth of field with specific near and far focus distances, and apply the maximum DoF strength. It also shows how to continuously use the DoF effect within a thread. ```lua CreateThread(function() local camera = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true) -- Set the cam coordinates to the player coords local playerCoords = GetEntityCoords(PlayerPedId()) SetCamCoord(camera, playerCoords) -- Render the camera we just created RenderScriptCams(true) -- Use a shallow depth of field SetCamUseShallowDofMode(camera, true) -- Set at what distance your camera should start to focus (Example: 0.7 meters) SetCamNearDof(camera, 0.7) -- Set at what distance your camera should stop focusing (Example: 1.3 meters) SetCamFarDof(camera, 1.3) -- Apply 100% of the DoF effect (The native you're reading documentation on) SetCamDofStrength(camera, 1.0) while DoesCamExist(camera) do -- Use DoF effect (needs to be called every tick) SetUseHiDof() Citizen.Wait(0) end end) ``` -------------------------------- ### Examples of Setting Radio Station Music Only Source: https://github.com/citizenfx/natives/blob/master/AUDIO/SetRadioStationMusicOnly.md These examples demonstrate how to use SET_RADIO_STATION_MUSIC_ONLY with a specific station name or by dynamically getting the station name. Use '1' to enable music-only and '0' to disable it. ```c AUDIO::SET_RADIO_STATION_MUSIC_ONLY("RADIO_01_CLASS_ROCK", 1); ``` ```c AUDIO::SET_RADIO_STATION_MUSIC_ONLY(AUDIO::GET_RADIO_STATION_NAME(10), 0); ``` ```c AUDIO::SET_RADIO_STATION_MUSIC_ONLY(AUDIO::GET_RADIO_STATION_NAME(10), 1); ``` -------------------------------- ### START_CUTSCENE Source: https://github.com/citizenfx/natives/blob/master/CUTSCENE/StartCutscene.md Starts a cutscene with specified flags. ```APIDOC ## START_CUTSCENE ### Description Starts a cutscene with specified flags. ### Signature ```c void START_CUTSCENE(int flags); ``` ### Parameters #### Path Parameters * **flags** (int) - Required - Usually 0. Specifies flags for the cutscene. ### Notes This function is part of the CUTSCENE namespace. ``` -------------------------------- ### Get Fake Wanted Level Source: https://github.com/citizenfx/natives/blob/master/MISC/GetFakeWantedLevel.md Retrieves the current fake wanted level. No setup or imports are required. ```c // 0x4C9296CBCD1B971E 0x0022A430 int GET_FAKE_WANTED_LEVEL(); ``` -------------------------------- ### NETWORK_DO_TRANSITION_TO_NEW_GAME Source: https://github.com/citizenfx/natives/blob/master/NETWORK/NetworkDoTransitionToNewGame.md Initiates a transition to a new game session. Use this function to start a new game instance, potentially with a specified maximum number of players. ```c BOOL NETWORK_DO_TRANSITION_TO_NEW_GAME(BOOL p0, int maxPlayers, BOOL p2); ``` -------------------------------- ### Get Current Month - C# Source: https://github.com/citizenfx/natives/blob/master/CLOCK/GetClockMonth.md Retrieves the current month from the game's clock. No setup is required. ```c // 0xBBC72712E80257A1 0x3C48A3D5 int GET_CLOCK_MONTH(); ``` -------------------------------- ### Get Deleted File Status Source: https://github.com/citizenfx/natives/blob/master/APP/AppGetDeletedFileStatus.md Use this function to check the status of a deleted file. No setup is required. ```c // 0xC9853A2BE3DED1A6 0x784D550B int APP_GET_DELETED_FILE_STATUS(); ``` -------------------------------- ### Example Usage of SET_TAXI_LIGHTS Source: https://github.com/citizenfx/natives/blob/master/VEHICLE/SetTaxiLights.md This example demonstrates how to set taxi lights. It checks if the lights are already on before attempting to set them. Note: The original author indicated this function might not work as expected. ```c if (!VEHICLE::IS_TAXI_LIGHT_ON(l_115)) { VEHICLE::SET_TAXI_LIGHTS(l_115, 1); } ``` -------------------------------- ### TASK_DRIVE_BY Usage Example Source: https://github.com/citizenfx/natives/blob/master/TASK/TaskDriveBy.md An example demonstrating the usage of the TASK_DRIVE_BY native. Note that the example provided in the source indicates it may not be functional and requires further testing. ```c TASK::TASK_DRIVE_BY(l_467[1/*22*/], PLAYER::PLAYER_PED_ID(), 0, 0.0, 0.0, 2.0, 300.0, 100, 0, ${firing_pattern_burst_fire_driveby}); Needs working example. Doesn't seem to do anything. I marked p2 as targetVehicle as all these shooting related tasks seem to have that in common. I marked p6 as distanceToShoot as if you think of GTA's Logic with the native SET_VEHICLE_SHOOT natives, it won't shoot till it gets within a certain distance of the target. I marked p7 as pedAccuracy as it seems it's mostly 100 (Completely Accurate), 75, 90, etc. Although this could be the ammo count within the gun, but I highly doubt it. I will change this comment once I find out if it's ammo count or not. ``` -------------------------------- ### Get Time Since Last Death Source: https://github.com/citizenfx/natives/blob/master/PLAYER/GetTimeSinceLastDeath.md Use this function to get the time in milliseconds since the player last died. If the player has not died, it returns -1. The example shows how to call the native and display the result. ```c // 0xC7034807558DDFCA 0x24BC5AC0 int GET_TIME_SINCE_LAST_DEATH(); ``` ```csharp var time = Function.call(Hash.GET_TIME_SINCE_LAST_DEATH); UI.DrawSubtitle(time.ToString()); ```