UNPKG

@citizenfx/server

Version:

Typings for the CitizenFX server JS API.

1,275 lines (1,137 loc) • 156 kB
/** * Adds a rectangular blip for the specified coordinates/area. * It is recommended to use [SET_BLIP_ROTATION](#\_0xF87683CDF73C3F6E) and [SET_BLIP_COLOUR](#\_0x03D7FB09E75D6B7E) to make the blip not rotate along with the camera. * By default, the blip will show as a *regular* blip with the specified color/sprite if it is outside of the minimap view. * (Native name is *likely* to actually be ADD_BLIP_FOR_AREA, but due to the usual reasons this can't be confirmed) * @param x The X coordinate of the center of the blip. * @param y The Y coordinate of the center of the blip. * @param z The Z coordinate of the center of the blip. * @param width The width of the blip. * @param height The height of the blip. * @return A handle to the blip. */ declare function AddBlipForArea(x: number, y: number, z: number, width: number, height: number): number; /** * Adds a rectangular blip for the specified coordinates/area. * It is recommended to use [SET_BLIP_ROTATION](#\_0xF87683CDF73C3F6E) and [SET_BLIP_COLOUR](#\_0x03D7FB09E75D6B7E) to make the blip not rotate along with the camera. * By default, the blip will show as a *regular* blip with the specified color/sprite if it is outside of the minimap view. * (Native name is *likely* to actually be ADD_BLIP_FOR_AREA, but due to the usual reasons this can't be confirmed) * @param x The X coordinate of the center of the blip. * @param y The Y coordinate of the center of the blip. * @param z The Z coordinate of the center of the blip. * @param width The width of the blip. * @param height The height of the blip. * @return A handle to the blip. */ declare function N_0xce5d0e5e315db238(x: number, y: number, z: number, width: number, height: number): number; /** * Creates a blip for the specified coordinates. You can use `SET_BLIP_` natives to change the blip. * @param x The X coordinate to create the blip on. * @param y The Y coordinate. * @param z The Z coordinate. * @return A blip handle. */ declare function AddBlipForCoord(x: number, y: number, z: number): number; /** * Create a blip that by default is red (enemy), you can use [SET_BLIP_AS_FRIENDLY](#\_0xC6F43D0E) to make it blue (friend).\ * Can be used for objects, vehicles and peds. * Example of enemy: * ![enemy](https://i.imgur.com/LIizV6S.png) * Example of friend: * ![friend](https://i.imgur.com/XrCuvZP.png) * @param entity The entity handle to create the blip. * @return A blip handle. */ declare function AddBlipForEntity(entity: number): number; /** * Create a blip with a radius for the specified coordinates (it doesnt create the blip sprite, so you need to use [AddBlipCoords](#\_0xC6F43D0E)) * Example image: * ![example](https://i.imgur.com/fDCmHVD.png) * @param posX The x position of the blip (you can also send a vector3 instead of the bulk coordinates) * @param posY The y position of the blip (you can also send a vector3 instead of the bulk coordinates) * @param posZ The z position of the blip (you can also send a vector3 instead of the bulk coordinates) * @param radius The number that defines the radius of the blip circle * @return The blip handle that can be manipulated with every `SetBlip` natives */ declare function AddBlipForRadius(posX: number, posY: number, posZ: number, radius: number): number; /** * Adds a listener for Console Variable changes. * The function called expects to match the following signature: * ```ts * function ConVarChangeListener(conVarName: string, reserved: any); * ``` * * **conVarName**: The ConVar that changed. * * **reserved**: Currently unused. * @param conVarFilter The Console Variable to listen for, this can be a pattern like "test:\*", or null for any * @param handler The handler function. * @return A cookie to remove the change handler. */ declare function AddConvarChangeListener(conVarFilter: string, handler: Function): number; /** * Applies an Item from a PedDecorationCollection to a ped. These include tattoos and shirt decals. * collection - PedDecorationCollection filename hash * overlay - Item name hash * Example: * Entry inside "mpbeach_overlays.xml" - * <Item> * <uvPos x="0.500000" y="0.500000" /> * <scale x="0.600000" y="0.500000" /> * <rotation value="0.000000" /> * <nameHash>FM_Hair_Fuzz</nameHash> * <txdHash>mp_hair_fuzz</txdHash> * <txtHash>mp_hair_fuzz</txtHash> * <zone>ZONE_HEAD</zone> * <type>TYPE_TATTOO</type> * <faction>FM</faction> * <garment>All</garment> * <gender>GENDER_DONTCARE</gender> * <award /> * <awardLevel /> * </Item> * Code: * PED::_0x5F5D1665E352A839(PLAYER::PLAYER_PED_ID(), MISC::GET_HASH_KEY("mpbeach_overlays"), MISC::GET_HASH_KEY("fm_hair_fuzz")) */ declare function AddPedDecorationFromHashes(ped: number, collection: string | number, overlay: string | number): void; /** * Applies an Item from a PedDecorationCollection to a ped. These include tattoos and shirt decals. * collection - PedDecorationCollection filename hash * overlay - Item name hash * Example: * Entry inside "mpbeach_overlays.xml" - * <Item> * <uvPos x="0.500000" y="0.500000" /> * <scale x="0.600000" y="0.500000" /> * <rotation value="0.000000" /> * <nameHash>FM_Hair_Fuzz</nameHash> * <txdHash>mp_hair_fuzz</txdHash> * <txtHash>mp_hair_fuzz</txtHash> * <zone>ZONE_HEAD</zone> * <type>TYPE_TATTOO</type> * <faction>FM</faction> * <garment>All</garment> * <gender>GENDER_DONTCARE</gender> * <award /> * <awardLevel /> * </Item> * Code: * PED::_0x5F5D1665E352A839(PLAYER::PLAYER_PED_ID(), MISC::GET_HASH_KEY("mpbeach_overlays"), MISC::GET_HASH_KEY("fm_hair_fuzz")) */ declare function ApplyPedOverlay(ped: number, collection: string | number, overlay: string | number): void; /** * Applies an Item from a PedDecorationCollection to a ped. These include tattoos and shirt decals. * collection - PedDecorationCollection filename hash * overlay - Item name hash * Example: * Entry inside "mpbeach_overlays.xml" - * <Item> * <uvPos x="0.500000" y="0.500000" /> * <scale x="0.600000" y="0.500000" /> * <rotation value="0.000000" /> * <nameHash>FM_Hair_Fuzz</nameHash> * <txdHash>mp_hair_fuzz</txdHash> * <txtHash>mp_hair_fuzz</txtHash> * <zone>ZONE_HEAD</zone> * <type>TYPE_TATTOO</type> * <faction>FM</faction> * <garment>All</garment> * <gender>GENDER_DONTCARE</gender> * <award /> * <awardLevel /> * </Item> * Code: * PED::_0x5F5D1665E352A839(PLAYER::PLAYER_PED_ID(), MISC::GET_HASH_KEY("mpbeach_overlays"), MISC::GET_HASH_KEY("fm_hair_fuzz")) */ declare function SetPedDecoration(ped: number, collection: string | number, overlay: string | number): void; /** * Adds a handler for changes to a state bag. * The function called expects to match the following signature: * ```ts * function StateBagChangeHandler(bagName: string, key: string, value: any, reserved: number, replicated: boolean); * ``` * * **bagName**: The internal bag ID for the state bag which changed. This is usually `player:Source`, `entity:NetID` * or `localEntity:Handle`. * * **key**: The changed key. * * **value**: The new value stored at key. The old value is still stored in the state bag at the time this callback executes. * * **reserved**: Currently unused. * * **replicated**: Whether the set is meant to be replicated. * At this time, the change handler can't opt to reject changes. * If bagName refers to an entity, use [GET_ENTITY_FROM_STATE_BAG_NAME](#\_0x4BDF1867) to get the entity handle * If bagName refers to a player, use [GET_PLAYER_FROM_STATE_BAG_NAME](#\_0xA56135E0) to get the player handle * @param keyFilter The key to check for, or null for no filter. * @param bagFilter The bag ID to check for such as `entity:65535`, or null for no filter. * @param handler The handler function. * @return A cookie to remove the change handler. */ declare function AddStateBagChangeHandler(keyFilter: string, bagFilter: string, handler: Function): number; /** * cpp * enum eApplyForceTypes { * APPLY_TYPE_FORCE = 0, * APPLY_TYPE_IMPULSE = 1, * APPLY_TYPE_EXTERNAL_FORCE = 2, * APPLY_TYPE_EXTERNAL_IMPULSE = 3, * APPLY_TYPE_TORQUE = 4, * APPLY_TYPE_ANGULAR_IMPULSE = 5 * } * @param entity The entity handle * @param forceType The force type * @param x The x component of the force to apply * @param y The y component of the force to apply * @param z The z component of the force to apply * @param offX Offset from center of entity (X) * @param offY Offset from center of entity (Y) * @param offZ Offset from center of entity (Z) * @param nComponent Component of the entity to apply the force too. Only matters for breakable or articulated (ragdoll) physics. 0 means the root or parent component * @param bLocalForce Specifies whether the force vector passed in is in local or world coordinates. `true` means the force will get automatically transformed into world space before being applied * @param bLocalOffset Specifies whether the offset passed in is in local or world coordinates * @param bScaleByMass Specifies whether to scale the force by mass * @param bPlayAudio Specifies whether to play audio events related to the force being applied. The audio will depend on the entity type. Currently vehicles are the only entity types supported, and will play a suspension squeal depending on the magnitude of the force * @param bScaleByTimeWarp Specifies whether to scale the force by time warp. Default is `true` */ declare function ApplyForceToEntity(entity: number, forceType: number, x: number, y: number, z: number, offX: number, offY: number, offZ: number, nComponent: number, bLocalForce: boolean, bLocalOffset: boolean, bScaleByMass: boolean, bPlayAudio: boolean, bScaleByTimeWarp: boolean): void; /** * > This native is deprecated and may be removed in a future version. Use the [Tebex API](https://docs.tebex.io/) instead. * Returns whether or not the specified player has enough information to start a commerce session for. * @param playerSrc The player handle * @return True or false. */ declare function CanPlayerStartCommerceSession(playerSrc: string): boolean; /** * Cancels the currently executing event. */ declare function CancelEvent(): void; /** * CLEAR_PED_PROP * @param ped The ped handle. * @param propId The prop id you want to clear from the ped. Refer to [SET_PED_PROP_INDEX](#\_0x93376B65A266EB5F). */ declare function ClearPedProp(ped: number, propId: number): void; /** * CLEAR_PED_SECONDARY_TASK */ declare function ClearPedSecondaryTask(ped: number): void; /** * Clear a ped's tasks. Stop animations and other tasks created by scripts. * @param ped Ped id. Use PlayerPedId() for your own character. */ declare function ClearPedTasks(ped: number): void; /** * Immediately stops the pedestrian from whatever it's doing. The difference between this and [CLEAR_PED_TASKS](#\_0xE1EF3C1216AFF2CD) is that this one teleports the ped but does not change the position of the ped. * @param ped Ped id. */ declare function ClearPedTasksImmediately(ped: number): void; /** * This executes at the same as speed as PLAYER::SET_PLAYER_WANTED_LEVEL(player, 0, false); * PLAYER::GET_PLAYER_WANTED_LEVEL(player); executes in less than half the time. Which means that it's worth first checking if the wanted level needs to be cleared before clearing. However, this is mostly about good code practice and can important in other situations. The difference in time in this example is negligible. */ declare function ClearPlayerWantedLevel(player: string): void; /** * Creates an object (prop) with the specified model at the specified position, offset on the Z axis by the radius of the object's model. * This object will initially be owned by the creating script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL). * @param modelHash The model to spawn. * @param x Spawn coordinate X component. * @param y Spawn coordinate Y component. * @param z Spawn coordinate Z component, 'ground level'. * @param isNetwork Whether to create a network object for the object. If false, the object exists only locally. * @param netMissionEntity Whether to register the object as pinned to the script host in the R\* network model. * @param doorFlag False to create a door archetype (archetype flag bit 26 set) as a door. Required to be set to true to create door models in network mode. * @return A script handle (fwScriptGuid index) for the object, or `0` if the object failed to be created. */ declare function CreateObject(modelHash: string | number, x: number, y: number, z: number, isNetwork: boolean, netMissionEntity: boolean, doorFlag: boolean): number; /** * Creates an object (prop) with the specified model centered at the specified position. * This object will initially be owned by the creating script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL). * @param modelHash The model to spawn. * @param x Spawn coordinate X component. * @param y Spawn coordinate Y component. * @param z Spawn coordinate Z component. * @param isNetwork Whether to create a network object for the object. If false, the object exists only locally. * @param netMissionEntity Whether to register the object as pinned to the script host in the R\* network model. * @param doorFlag False to create a door archetype (archetype flag bit 26 set) as a door. Required to be set to true to create door models in network mode. * @return A script handle (fwScriptGuid index) for the object, or `0` if the object failed to be created. */ declare function CreateObjectNoOffset(modelHash: string | number, x: number, y: number, z: number, isNetwork: boolean, netMissionEntity: boolean, doorFlag: boolean): number; /** * Creates a ped (biped character, pedestrian, actor) with the specified model at the specified position and heading. * This ped will initially be owned by the creating script as a mission entity, and the model should be loaded already * (e.g. using REQUEST_MODEL). * @param pedType Unused. Peds get set to CIVMALE/CIVFEMALE/etc. no matter the value specified. * @param modelHash The model of ped to spawn. * @param x Spawn coordinate X component. * @param y Spawn coordinate Y component. * @param z Spawn coordinate Z component. * @param heading Heading to face towards, in degrees. * @param isNetwork Whether to create a network object for the ped. If false, the ped exists only locally. * @param bScriptHostPed Whether to register the ped as pinned to the script host in the R\* network model. * @return A script handle (fwScriptGuid index) for the ped, or `0` if the ped failed to be created. */ declare function CreatePed(pedType: number, modelHash: string | number, x: number, y: number, z: number, heading: number, isNetwork: boolean, bScriptHostPed: boolean): number; /** * CREATE_PED_INSIDE_VEHICLE * @param pedType See [`CREATE_PED`](#\_0xD49F9B0955C367DE) */ declare function CreatePedInsideVehicle(vehicle: number, pedType: number, modelHash: string | number, seat: number, isNetwork: boolean, bScriptHostPed: boolean): number; /** * Creates a vehicle with the specified model at the specified position. This vehicle will initially be owned by the creating * script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL). * ``` * NativeDB Added Parameter 8: BOOL p7 * ``` * @param modelHash The model of vehicle to spawn. * @param x Spawn coordinate X component. * @param y Spawn coordinate Y component. * @param z Spawn coordinate Z component. * @param heading Heading to face towards, in degrees. * @param isNetwork Whether to create a network object for the vehicle. If false, the vehicle exists only locally. * @param netMissionEntity Whether to register the vehicle as pinned to the script host in the R\* network model. * @return A script handle (fwScriptGuid index) for the vehicle, or `0` if the vehicle failed to be created. */ declare function CreateVehicle(modelHash: string | number, x: number, y: number, z: number, heading: number, isNetwork: boolean, netMissionEntity: boolean): number; /** * Equivalent to CREATE_VEHICLE, but it uses 'server setter' logic (like the former CREATE_AUTOMOBILE) as a workaround for * reliability concerns regarding entity creation RPC. * Unlike CREATE_AUTOMOBILE, this supports other vehicle types as well. * @param modelHash The model of vehicle to spawn. * @param type The appropriate vehicle type for the model info. Can be one of `automobile`, `bike`, `boat`, `heli`, `plane`, `submarine`, `trailer`, and (potentially), `train`. This should be the same type as the `type` field in `vehicles.meta`. * @param x Spawn coordinate X component. * @param y Spawn coordinate Y component. * @param z Spawn coordinate Z component. * @param heading Heading to face towards, in degrees. * @return A script handle for the vehicle, or 0 if the vehicle failed to be created. */ declare function CreateVehicleServerSetter(modelHash: string | number, _type: string, x: number, y: number, z: number, heading: number): number; /** * Deletes the specified entity. * **NOTE**: For trains this will only work if called on the train engine, it will not work on its carriages. * @param entity The entity to delete. */ declare function DeleteEntity(entity: number): void; /** * DELETE_FUNCTION_REFERENCE */ declare function DeleteFunctionReference(referenceIdentity: string): void; /** * DELETE_RESOURCE_KVP * @param key The key to delete */ declare function DeleteResourceKvp(key: string): void; /** * Nonsynchronous [DELETE_RESOURCE_KVP](#\_0x7389B5DF) operation; see [FLUSH_RESOURCE_KVP](#\_0x5240DA5A). * @param key The key to delete */ declare function DeleteResourceKvpNoSync(key: string): void; /** * Deletes the specified `entity` and any carriage its attached to, or that is attached to it. * @param entity The carriage to delete. */ declare function DeleteTrain(entity: number): void; /** * DOES_BOAT_SINK_WHEN_WRECKED * @param vehicle The target vehicle. * @return Returns whether or not the boat sinks when wrecked. */ declare function DoesBoatSinkWhenWrecked(vehicle: number): boolean; /** * DOES_ENTITY_EXIST */ declare function DoesEntityExist(entity: number): boolean; /** * Returns whether or not the player exists * @return True if the player exists, false otherwise */ declare function DoesPlayerExist(playerSrc: string): boolean; /** * > This native is deprecated and may be removed in a future version. Use [`DOES_PLAYER_OWN_SKU_EXT`](#\_0xDEF0480B) instead. * Requests whether or not the player owns the specified SKU. * @param playerSrc The player handle * @param skuId The ID of the SKU. * @return A boolean. */ declare function DoesPlayerOwnSku(playerSrc: string, skuId: number): boolean; /** * Requests whether or not the player owns the specified package. * @param playerSrc The player handle * @param skuId The package ID on Tebex. * @return A boolean. */ declare function DoesPlayerOwnSkuExt(playerSrc: string, skuId: number): boolean; /** * DOES_TRAIN_STOP_AT_STATIONS * @param train The train handle * @return True if the train stops at stations. False otherwise */ declare function DoesTrainStopAtStations(train: number): boolean; /** * DROP_PLAYER */ declare function DropPlayer(playerSrc: string, reason: string): void; /** * DUPLICATE_FUNCTION_REFERENCE */ declare function DuplicateFunctionReference(referenceIdentity: string): string; /** * ENABLE_ENHANCED_HOST_SUPPORT */ declare function EnableEnhancedHostSupport(enabled: boolean): void; /** * END_FIND_KVP * @param handle The KVP find handle returned from [START_FIND_KVP](#\_0xDD379006) * @return None. */ declare function EndFindKvp(handle: number): void; /** * Internal function for ensuring an entity has a state bag. */ declare function EnsureEntityStateBag(entity: number): void; /** * Depending on your use case you may need to use `add_acl resource.<your_resource_name> command.<command_name> allow` to use this native in your resource. */ declare function ExecuteCommand(commandString: string): void; /** * FIND_KVP * @param handle The KVP find handle returned from [START_FIND_KVP](#\_0xDD379006) * @return None. */ declare function FindKvp(handle: number): string; /** * FLAG_SERVER_AS_PRIVATE */ declare function FlagServerAsPrivate(private_: boolean): void; /** * Nonsynchronous operations will not wait for a disk/filesystem flush before returning from a write or delete call. They will be much faster than their synchronous counterparts (e.g., bulk operations), however, a system crash may lose the data to some recent operations. * This native ensures all `_NO_SYNC` operations are synchronized with the disk/filesystem. */ declare function FlushResourceKvp(): void; /** * An internal function for converting a stack trace object to a string. */ declare function FormatStackTrace(traceData: any): string; /** * Freezes or unfreezes an entity preventing its coordinates to change by the player if set to `true`. You can still change the entity position using [`SET_ENTITY_COORDS`](#\_0x06843DA7060A026B). * @param entity The entity to freeze/unfreeze. * @param toggle Freeze or unfreeze entity. */ declare function FreezeEntityPosition(entity: number, toggle: boolean): void; /** * GET_AIR_DRAG_MULTIPLIER_FOR_PLAYERS_VEHICLE * @param playerSrc The player handle */ declare function GetAirDragMultiplierForPlayersVehicle(playerSrc: string): number; /** * Returns all object handles known to the server. * The data returned adheres to the following layout: * ``` * [127, 42, 13, 37] * ``` * @return An object containing a list of object handles. */ declare function GetAllObjects(): any; /** * Returns all peds handles known to the server. * The data returned adheres to the following layout: * ``` * [127, 42, 13, 37] * ``` * @return An object containing a list of peds handles. */ declare function GetAllPeds(): any; /** * Returns all vehicle handles known to the server. * The data returned adheres to the following layout: * ``` * [127, 42, 13, 37] * ``` * @return An object containing a list of vehicle handles. */ declare function GetAllVehicles(): any; declare function GetBlipSprite(self: number): number; /** * Returns the current console output buffer. * @return The most recent game console output, as a string. */ declare function GetConsoleBuffer(): string; /** * Can be used to get a console variable of type `char*`, for example a string. * @param varName The console variable to look up. * @param default_ The default value to set if none is found. * @return Returns the convar value if it can be found, otherwise it returns the assigned `default`. */ declare function GetConvar(varName: string, default_: string): string; /** * Can be used to get a console variable casted back to `bool`. * @param varName The console variable to look up. * @param defaultValue The default value to set if none is found. * @return Returns the convar value if it can be found, otherwise it returns the assigned `default`. */ declare function GetConvarBool(varName: string, defaultValue: boolean): boolean; /** * This will have floating point inaccuracy. * @param varName The console variable to get * @param defaultValue The default value to set, if none are found. * @return Returns the value set in varName, or `default` if none are specified */ declare function GetConvarFloat(varName: string, defaultValue: number): number; /** * Can be used to get a console variable casted back to `int` (an integer value). * @param varName The console variable to look up. * @param default_ The default value to set if none is found (variable not set using [SET_CONVAR](#\_0x341B16D2), or not accessible). * @return Returns the convar value if it can be found, otherwise it returns the assigned `default`. */ declare function GetConvarInt(varName: string, default_: number): number; /** * Returns the hash of weapon the Ped is currently using. * @param ped The target ped. * @return The weapon hash. */ declare function GetCurrentPedWeapon(ped: number): number; /** * Returns the name of the currently executing resource. * @return The name of the resource. */ declare function GetCurrentResourceName(): string; /** * ### Supported types * * \[1] : Peds (including animals) and players. * * \[2] : Vehicles. * * \[3] : Objects (props), doors, and projectiles. * ### Coordinates need to be send unpacked (x,y,z) * ```lua * -- Define the allowed model hashes * local allowedModelHashes = { GetHashKey("p_crate03x"), GetHashKey("p_crate22x") } * -- Get the player's current coordinates * local playerCoords = GetEntityCoords(PlayerPedId()) * -- Retrieve all entities of type Object (type 3) within a radius of 10.0 units * -- that match the allowed model hashes * -- and sort output entities by distance * local entities = GetEntitiesInRadius(playerCoords.x, playerCoords.y, playerCoords.z, 10.0, 3, true, allowedModelHashes) * -- Iterate through the list of entities and print their ids * for i = 1, #entities do * local entity = entities[i] * print(entity) * end * ``` * @param x The X coordinate. * @param y The Y coordinate. * @param z The Z coordinate. * @param radius Max distance from coordinate to entity * @param entityType Entity types see list below * @param sortByDistance Sort output entites by distance from nearest to farthest * @param models List of allowed models its also optional * @return An array containing entity handles for each entity. */ declare function GetEntitiesInRadius(x: number, y: number, z: number, radius: number, entityType: number, sortByDistance: boolean, models: any): any; /** * Gets the entity that this entity is attached to. * @param entity The entity to check. * @return The attached entity handle. 0 returned if the entity is not attached. */ declare function GetEntityAttachedTo(entity: number): number; /** * GET_ENTITY_COLLISION_DISABLED * @param entity The target entity. * @return Returns whether or not entity collisions are disabled. */ declare function GetEntityCollisionDisabled(entity: number): boolean; /** * Gets the current coordinates for a specified entity. This native is used server side when using OneSync. * See [GET_ENTITY_COORDS](#\_0x3FEF770D40960D5A) for client side. * @param entity The entity to get the coordinates from. * @return The current entity coordinates. */ declare function GetEntityCoords(entity: number): number[]; /** * Returns the entity handle for the specified state bag name. For use with [ADD_STATE_BAG_CHANGE_HANDLER](#\_0x5BA35AAF). * @param bagName An internal state bag ID from the argument to a state bag change handler. * @return The entity handle or 0 if the state bag name did not refer to an entity, or the entity does not exist. */ declare function GetEntityFromStateBagName(bagName: string): number; /** * GET_ENTITY_HEADING */ declare function GetEntityHeading(entity: number): number; /** * Only works for vehicle and peds * @param entity The entity to check the health of * @return If the entity is a vehicle it will return 0-1000 If the entity is a ped it will return 0-200 If the entity is an object it will return 0 */ declare function GetEntityHealth(entity: number): number; /** * Currently it only works with peds. */ declare function GetEntityMaxHealth(entity: number): number; /** * GET_ENTITY_MODEL */ declare function GetEntityModel(entity: number): number; /** * GET_ENTITY_ORPHAN_MODE * @param entity The entity to get the orphan mode of * @return Returns the entities current orphan mode, refer to enum in [SET_ENTITY_ORPHAN_MODE](#\_0x489E9162) */ declare function GetEntityOrphanMode(entity: number): number; /** * This native gets an entity's population type. * @param entity the entity to obtain the population type from * @return Returns the population type ID, defined by the below enumeration:```cpp enum ePopulationType { POPTYPE_UNKNOWN = 0, POPTYPE_RANDOM_PERMANENT, POPTYPE_RANDOM_PARKED, POPTYPE_RANDOM_PATROL, POPTYPE_RANDOM_SCENARIO, POPTYPE_RANDOM_AMBIENT, POPTYPE_PERMANENT, POPTYPE_MISSION, POPTYPE_REPLAY, POPTYPE_CACHE, POPTYPE_TOOL }; ``` */ declare function GetEntityPopulationType(entity: number): number; /** * GET_ENTITY_REMOTE_SYNCED_SCENES_ALLOWED * @param entity The entity to get the flag for. * @return Returns if the entity is allowed to participate in network-synchronized scenes initiated by clients that do not own the entity. */ declare function GetEntityRemoteSyncedScenesAllowed(entity: number): boolean; /** * GET_ENTITY_ROTATION */ declare function GetEntityRotation(entity: number): number[]; /** * GET_ENTITY_ROTATION_VELOCITY */ declare function GetEntityRotationVelocity(entity: number): number[]; /** * Gets the routing bucket for the specified entity. * Routing buckets are also known as 'dimensions' or 'virtual worlds' in past echoes, however they are population-aware. * @param entity The entity to get the routing bucket for. * @return The routing bucket ID. */ declare function GetEntityRoutingBucket(entity: number): number; /** * GET_ENTITY_SCRIPT */ declare function GetEntityScript(entity: number): string; /** * Gets the current speed of the entity in meters per second. * ``` * To convert to MPH: speed * 2.236936 * To convert to KPH: speed * 3.6 * ``` * @param entity The entity to get the speed of * @return The speed of the entity in meters per second */ declare function GetEntitySpeed(entity: number): number; /** * Gets the entity type (as an integer), which can be one of the following defined down below: * **The following entities will return type `1`:** * * Ped * * Player * * Animal (Red Dead Redemption 2) * * Horse (Red Dead Redemption 2) * **The following entities will return type `2`:** * * Automobile * * Bike * * Boat * * Heli * * Plane * * Submarine * * Trailer * * Train * * DraftVeh (Red Dead Redemption 2) * **The following entities will return type `3`:** * * Object * * Door * * Pickup * Otherwise, a value of `0` will be returned. * @param entity The entity to get the type of. * @return The entity type returned as an integer value. */ declare function GetEntityType(entity: number): number; /** * GET_ENTITY_VELOCITY */ declare function GetEntityVelocity(entity: number): number[]; /** * Returns the internal build number of the current game being executed. * Possible values: * * FiveM * * 1604 * * 2060 * * 2189 * * 2372 * * 2545 * * 2612 * * 2699 * * 2802 * * 2944 * * 3095 * * 3258 * * 3323 * * 3407 * * 3570 * * 3751 * * 3788 * * RedM * * 1311 * * 1355 * * 1436 * * 1491 * * LibertyM * * 43 * * FXServer * * 0 * @return The build number, or **0** if no build number is known. */ declare function GetGameBuildNumber(): number; /** * Returns the current game being executed. * Possible values: * | Return value | Meaning | * | ------------ | ------------------------------ | * | `fxserver` | Server-side code ('Duplicity') | * | `fivem` | FiveM for GTA V | * | `libertym` | LibertyM for GTA IV | * | `redm` | RedM for Red Dead Redemption 2 | * @return The game the script environment is running in. */ declare function GetGameName(): string; /** * Returns a list of entity handles (script GUID) for all entities in the specified pool - the data returned is an array as * follows: * ```json * [ 770, 1026, 1282, 1538, 1794, 2050, 2306, 2562, 2818, 3074, 3330, 3586, 3842, 4098, 4354, 4610, ...] * ``` * ### Supported pools * * `CPed`: Peds (including animals) and players. * * `CObject`: Objects (props), doors, and projectiles. * * `CNetObject`: Networked objects * * `CVehicle`: Vehicles. * * `CPickup`: Pickups. * @param poolName The pool name to get a list of entities from. * @return An array containing entity handles for each entity in the named pool. */ declare function GetGamePool(poolName: string): any; /** * Gets the current game timer in milliseconds. * @return The game time. */ declare function GetGameTimer(): number; /** * This native converts the passed string to a hash. */ declare function GetHashKey(model: string): number; /** * **Note** This native will always return `1000.0` unless [SET_VEHICLE_BODY_HEALTH](#\_0xB77D05AC8C78AADB), [SET_VEHICLE_ENGINE_HEALTH](#\_0x45F6D8EEF34ABEF1), or [SET_VEHICLE_PETROL_TANK_HEALTH](#\_0x70DB57649FA8D0D8) have been called with a value greater than `1000.0`. * @param heli The helicopter to check * @return Returns the current health of the helicopter's body. */ declare function GetHeliBodyHealth(heli: number): number; /** * This is a getter for [SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE](#\_0xEDBC8405B3895CC9) * @param heli The helicopter to check * @return Returns `true` if the helicopter is set to be protected from exploding due to minor body damage, `false` otherwise. */ declare function GetHeliDisableExplodeFromBodyDamage(heli: number): boolean; /** * **Note** This native will always return `1000.0` unless [SET_VEHICLE_BODY_HEALTH](#\_0xB77D05AC8C78AADB), [SET_VEHICLE_ENGINE_HEALTH](#\_0x45F6D8EEF34ABEF1), or [SET_VEHICLE_PETROL_TANK_HEALTH](#\_0x70DB57649FA8D0D8) have been called with a value greater than `1000.0`. * @param heli The helicopter to check * @return Returns the current health of the helicopter's engine. */ declare function GetHeliEngineHealth(heli: number): number; /** * **Note** This native will always return `1000.0` unless [SET_VEHICLE_BODY_HEALTH](#\_0xB77D05AC8C78AADB), [SET_VEHICLE_ENGINE_HEALTH](#\_0x45F6D8EEF34ABEF1), or [SET_VEHICLE_PETROL_TANK_HEALTH](#\_0x70DB57649FA8D0D8) have been called with a value greater than `1000.0`. * @param heli The helicopter to check * @return Returns the current health of the helicopter's gas tank. */ declare function GetHeliGasTankHealth(heli: number): number; /** * GET_HELI_MAIN_ROTOR_DAMAGE_SCALE * @param heli The helicopter to check * @return Returns a value representing the damage scaling factor applied to the helicopter's main rotor. The value ranges from `0.0` (no damage scaling) to` 1.0 ` (full damage scaling). */ declare function GetHeliMainRotorDamageScale(heli: number): number; /** * GET_HELI_MAIN_ROTOR_HEALTH * @param vehicle The target vehicle. * @return See the client-side [GET_HELI_MAIN_ROTOR_HEALTH](#\_0xE4CB7541F413D2C5) for the return value. */ declare function GetHeliMainRotorHealth(vehicle: number): number; /** * GET_HELI_PITCH_CONTROL * @param heli The helicopter to check. * @return Returns a value representing the pitch control of the helicopter. The values range from `-1.0` (nose down) to `1.0` (nose up), with `0.0` indicating no pitch input. */ declare function GetHeliPitchControl(heli: number): number; /** * GET_HELI_REAR_ROTOR_DAMAGE_SCALE * @param heli The helicopter to check * @return Returns a value representing the damage scaling factor applied to the helicopter's rear rotor. The value ranges from `0.0` (no damage scaling) to` 1.0 ` (full damage scaling). */ declare function GetHeliRearRotorDamageScale(heli: number): number; /** * This native is a getter for [SET_HELI_TAIL_ROTOR_HEALTH](#\_0xFE205F38AAA58E5B) * @param vehicle The target vehicle. * @return Returns the health of the helicopter's rear rotor. The maximum health value is `1000`. */ declare function GetHeliRearRotorHealth(vehicle: number): number; /** * GET_HELI_ROLL_CONTROL * @param heli The helicopter to check. * @return Returns a value representing the roll control of the helicopter. The values range from `-1.0` (roll left) to `1.0` (roll right), with `0.0` indicating no roll input. */ declare function GetHeliRollControl(heli: number): number; /** * GET_HELI_TAIL_ROTOR_DAMAGE_SCALE * @param heli The helicopter to check * @return Returns a value representing the damage scaling factor applied to the helicopter's tail rotor. The value ranges from `0.0` (no damage scaling) to` 1.0 ` (full damage scaling). */ declare function GetHeliTailRotorDamageScale(heli: number): number; /** * **Note**: This native is deprecated, please use [`GET_HELI_REAR_ROTOR_HEALTH`](#\_0x33EE6E2B) instead. * @param vehicle The target vehicle. * @return Return the health of the rear rotor of the helicopter, not the tail rotor. */ declare function GetHeliTailRotorHealth(vehicle: number): number; /** * GET_HELI_THROTTLE_CONTROL * @param heli The helicopter to check. * @return Returns a value representing the throttle control of the helicopter. The value ranges from `0.0` (no throttle) to `2.0` (full throttle). */ declare function GetHeliThrottleControl(heli: number): number; /** * GET_HELI_YAW_CONTROL * @param heli The helicopter to check. * @return Returns a value the yaw control of the helicopter. The value ranges from `-1.0` (yaw left) to `1.0` (yaw right), with `0.0` meaning no yaw input. */ declare function GetHeliYawControl(heli: number): number; /** * GET_HOST_ID */ declare function GetHostId(): string; /** * GET_INSTANCE_ID */ declare function GetInstanceId(): number; /** * GET_INVOKING_RESOURCE */ declare function GetInvokingResource(): string; /** * GET_IS_HELI_ENGINE_RUNNING * @param heli The helicopter to check * @return Returns `true` if the helicopter's engine is running, `false` if it is not. */ declare function GetIsHeliEngineRunning(heli: number): boolean; /** * GET_IS_VEHICLE_ENGINE_RUNNING */ declare function GetIsVehicleEngineRunning(vehicle: number): boolean; /** * GET_IS_VEHICLE_PRIMARY_COLOUR_CUSTOM */ declare function GetIsVehiclePrimaryColourCustom(vehicle: number): boolean; /** * GET_IS_VEHICLE_SECONDARY_COLOUR_CUSTOM */ declare function GetIsVehicleSecondaryColourCustom(vehicle: number): boolean; /** * See the client-side [GET_LANDING_GEAR_STATE](#\_0x9B0F3DCA3DB0F4CD) native for a description of landing gear states. * @param vehicle The vehicle to check. * @return The current state of the vehicles landing gear. */ declare function GetLandingGearState(vehicle: number): number; /** * GET_LAST_PED_IN_VEHICLE_SEAT * @param vehicle The target vehicle. * @param seatIndex See eSeatPosition declared in [`IS_VEHICLE_SEAT_FREE`](#\_0x22AC59A870E6A669). * @return The last ped in the specified seat of the passed vehicle. Returns 0 if the specified seat was never occupied or the last ped does not exist anymore. */ declare function GetLastPedInVehicleSeat(vehicle: number, seatIndex: number): number; /** * GET_MOUNT * @param ped the ped id * @return Returns the entity the `ped` is currently on, or `0` if they're not on a mount. */ declare function GetMount(ped: number): number; /** * Gets the specific entity type (as an integer), which can be one of the following defined down below: * #### FiveM: * ```cpp * enum eNetObjEntityType * { * Automobile = 0, * Bike = 1, * Boat = 2, * Door = 3, * Heli = 4, * Object = 5, * Ped = 6, * Pickup = 7, * PickupPlacement = 8, * Plane = 9, * Submarine = 10, * Player = 11, * Trailer = 12, * Train = 13 * }; * ``` * #### RedM: * ```cpp * enum eNetObjEntityType * { * Animal = 0, * Automobile = 1, * Bike = 2, * Boat = 3, * Door = 4, * Heli = 5, * Object = 6, * Ped = 7, * Pickup = 8, * PickupPlacement = 9, * Plane = 10, * Submarine = 11, * Player = 12, * Trailer = 13, * Train = 14, * DraftVeh = 15, * StatsTracker = 16, * PropSet = 17, * AnimScene = 18, * GroupScenario = 19, * Herd = 20, * Horse = 21, * WorldState = 22, * WorldProjectile = 23, * Incident = 24, * Guardzone = 25, * PedGroup = 26, * CombatDirector = 27, * PedSharedTargeting = 28, * Persistent = 29 * }; * ``` * @param entity The entity to get the specific type of. * @return The specific entity type returned as an integer value or -1 if the entity is invalid. */ declare function GetNetTypeFromEntity(entity: number): number; /** * GET_NUM_PLAYER_IDENTIFIERS */ declare function GetNumPlayerIdentifiers(playerSrc: string): number; /** * GET_NUM_PLAYER_INDICES */ declare function GetNumPlayerIndices(): number; /** * GET_NUM_PLAYER_TOKENS */ declare function GetNumPlayerTokens(playerSrc: string): number; /** * Gets the amount of metadata values with the specified key existing in the specified resource's manifest. * See also: [Resource manifest](https://docs.fivem.net/docs/scripting-reference/resource-manifest/) * @param resourceName The resource name. * @param metadataKey The key to look up in the resource manifest. */ declare function GetNumResourceMetadata(resourceName: string, metadataKey: string): number; /** * GET_NUM_RESOURCES */ declare function GetNumResources(): number; /** * GET_PASSWORD_HASH */ declare function GetPasswordHash(password: string): string; /** * GET_PED_ARMOUR */ declare function GetPedArmour(ped: number): number; /** * GET_PED_CAUSE_OF_DEATH */ declare function GetPedCauseOfDeath(ped: number): number; /** * GET_PED_DESIRED_HEADING * @param ped The target ped * @return Returns ped's desired heading. */ declare function GetPedDesiredHeading(ped: number): number; /** * GET_PED_IN_VEHICLE_SEAT * @param vehicle The target vehicle. * @param seatIndex See eSeatPosition declared in [`IS_VEHICLE_SEAT_FREE`](#\_0x22AC59A870E6A669). * @return The ped in the specified seat of the passed vehicle. Returns 0 if the specified seat is not occupied. */ declare function GetPedInVehicleSeat(vehicle: number, seatIndex: number): number; /** * GET_PED_MAX_HEALTH */ declare function GetPedMaxHealth(ped: number): number; /** * Gets the current relationship group hash of a ped. * @param ped The target ped * @return The relationship group hash. */ declare function GetPedRelationshipGroupHash(ped: number): number; /** * Gets the script task command currently assigned to the ped. * @param ped The target ped. * @return The script task command currently assigned to the ped. A value of 0x811E343C denotes no script task is assigned. */ declare function GetPedScriptTaskCommand(ped: number): number; /** * Gets the stage of the peds scripted task. * @param ped The target ped. * @return The stage of the ped's scripted task. A value of 3 denotes no script task is assigned. */ declare function GetPedScriptTaskStage(ped: number): number; /** * Get the last entity that damaged the ped. This native is used server side when using OneSync. * @param ped The target ped * @return The entity id. Returns 0 if the ped has not been damaged recently. */ declare function GetPedSourceOfDamage(ped: number): number; /** * Get the entity that killed the ped. This native is used server side when using OneSync. * @param ped The target ped * @return The entity id. Returns 0 if the ped has no killer. */ declare function GetPedSourceOfDeath(ped: number): number; /** * Gets the type of a ped's specific task given an index of the CPedTaskSpecificDataNode nodes. * A ped will typically have a task at index 0, if a ped has multiple tasks at once they will be in the order 0, 1, 2, etc. * @param ped The target ped. * @param index A zero-based index with a maximum value of 7. * @return The type of the specific task. 1604: A value of 530 denotes no script task is assigned or an invalid input was given. 2060+: A value of 531 denotes no script task is assigned or an invalid input was given. */ declare function GetPedSpecificTaskType(ped: number, index: number): number; /** * GET_PED_STEALTH_MOVEMENT * @param ped The target ped. * @return Whether or not the ped is stealthy. */ declare function GetPedStealthMovement(ped: number): boolean; /** * Gets the current camera rotation for a specified player. This native is used server side when using OneSync. * @param playerSrc The player handle. * @return The player's camera rotation. Values are in radians. */ declare function GetPlayerCameraRotation(playerSrc: string): number[]; /** * GET_PLAYER_ENDPOINT */ declare function GetPlayerEndpoint(playerSrc: string): string; /** * Gets the current fake wanted level for a specified player. This native is used server side when using OneSync. * @param playerSrc The target player * @return The fake wanted level */ declare function GetPlayerFakeWantedLevel(playerSrc: string): number; /** * Gets the focus position (i.e. the position of the active camera in the game world) of a player. * @param playerSrc The player to get the focus position of * @return Returns a `Vector3` containing the focus position of the player. */ declare function GetPlayerFocusPos(playerSrc: string): number[]; /** * GET_PLAYER_FROM_INDEX */ declare function GetPlayerFromIndex(index: number): string; /** * On the server this will return the players source, on the client it will return the player handle. * @param bagName An internal state bag ID from the argument to a state bag change handler. * @return The player handle or 0 if the state bag name did not refer to a player, or the player does not exist. */ declare function GetPlayerFromStateBagName(bagName: string): number; /** * GET_PLAYER_GUID */ declare function GetPlayerGuid(playerSrc: string): string; /** * To get the number of identifiers, use [GET_NUM_PLAYER_IDENTIFIERS](#\_0xFF7F66AB) * To get a specific type of identifier, use [GET_PLAYER_IDENTIFIER_BY_TYPE](#\_0xA61C8FC6) * @return Returns the identifier at the specific index, if out of bounds returns `null` */ declare function GetPlayerIdentifier(playerSrc: string, identiferIndex: number): string; /** * Get an identifier from a player by the type of the identifier. * Known [Identifiers](https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/GetPlayerIdentifiers/#identifier-types) * @param playerSrc The player to get the identifier for * @param identifierType The string to match in an identifier, this can be `"license"` for example. * @return The identifier that matches the string provided */ declare function GetPlayerIdentifierByType(playerSrc: string, identifierType: string): string; /** * GET_PLAYER_INVINCIBLE * @param playerSrc The player handle * @return A boolean to tell if the player is invincible. */ declare function GetPlayerInvincible(playerSrc: string): boolean; /** * GET_PLAYER_LAST_MSG */ declare function GetPlayerLastMsg(playerSrc: string): number; /** * GET_PLAYER_MAX_ARMOUR * @param playerSrc The player handle */ declare function GetPlayerMaxArmour(playerSrc: string): number; /** * GET_PLAYER_MAX_HEALTH * @param playerSrc The player handle */ declare function GetPlayerMaxHealth(playerSrc: string): number; /** * A getter for [SET_PLAYER_MELEE_WEAPON_DAMAGE_MODIFIER](#\_0x4A3DC7ECCC321032). * @param playerId The player index. * @return Returns player melee weapon damage modifier value. */ declare function GetPlayerMeleeWeaponDamageModifier(playerId: string): number; /** * GET_PLAYER_NAME */ declare function GetPlayerName(playerSrc: string): string; /** * Used to get the player's Ped Entity ID when a valid `playerSrc` is passed. * @param playerSrc The player source, passed as a string. * @return Returns a valid Ped Entity ID if the passed `playerSrc` is valid, `0` if not. */ declare function GetPlayerPed(playerSrc: string): number; /** * ```cpp * const int ENET_PACKET_LOSS_SCALE = 65536; * enum PeerStatistics * { * // PacketLoss will only update once every 10 seconds, use PacketLossEpoch if you want the time * // since the last time the packet loss was updated. * // the amount of packet loss the player has, needs to be scaled with PACKET_LOSS_SCALE * PacketLoss = 0, * // The variance in the packet loss * PacketLossVariance = 1, * // The time since the last packet update in ms, relative to the peers connection time * PacketLossEpoch = 2, * // The mean amount of time it takes for a packet to get to the client (ping) * RoundTripTime = 3, * // The variance in the round trip time * RoundTripTimeVariance = 4, * // Despite their name, these are only updated once every 5 seconds, you can get the last time this was updated with PacketThrottleEpoch * // The last recorded round trip time of a packet * LastRoundTripTime = 5, * // The last round trip time variance * LastRoundTripTimeVariance = 6, * // The time since the last packet throttle update, relative to the peers connection time * PacketThrottleEpoch = 7, * }; * ``` * These statistics only update once every 10 seconds. * @param playerSrc The player to get the stats of * @param peerStatistic The statistic to get, this will error if its out of range * @return See `ENetStatisticT