import type { eAddItemReason } from '../enums/eAddItemReason'; import type { eAmmoType } from '../enums/eAmmoType'; import type { eRemoveItemReason } from '../enums/eRemoveItemReason'; import type { eWeaponHash } from '../enums/eWeaponHash'; import type { Entity } from '../classes/Entity'; import type { Prop } from '../classes/Prop'; import { Vector3 } from '../types/Vector3'; import type { Ped } from './Ped'; import { int, float } from '../types/NativeAliases'; export declare class Weapon { protected ped: Ped; constructor(ped: Ped); /** * @param ammoType * @returns */ getPedAmmoByType(ammoType: string | number): int; /** * @param p1 * @param p2 * @returns */ getBestPedWeapon(p1: boolean, p2: boolean): number; /** * @param toggle * @param weaponHash * @returns The instance for method chaining */ setPedInfiniteAmmo(toggle: boolean, weaponHash: eWeaponHash): this; /** * @param weaponHash * @param ammoHash Refer to {@link eWeaponHash} * @returns The instance for method chaining */ setAmmoTypeForPedWeapon(weaponHash: eWeaponHash, ammoHash: eAmmoType): this; /** * *GET_BEST** - *GET_CLOSEST** * * @returns weaponGuid */ get CorrectKitEmoteTwirlGun(): [boolean, number]; /** * @param weaponHash * @returns */ setCurrentPedVehicleWeapon(weaponHash: eWeaponHash): boolean; /** * Returns whether the ped has a rifle p1: 0 or 1 * * @param p1 * @returns */ doesPedHaveRifle(p1: int): boolean; /** * Puts the gun visibly in your horse's holster without having to be close to the horse. Use `_SEND_WEAPON_TO_INVENTORY` before using this native * _A* or _B* * * @param weaponHash * @param ped Refer to {@link eWeaponHash} */ N_0x14FF0C2545527F9B(weaponHash: eWeaponHash, ped: Ped): void; /** * Returns iSpinHash / iVariationSpin * * @param weaponEmoteVariation * @returns */ getPedGunSpinningHashFromWeaponEmoteVariation(weaponEmoteVariation: int): number; /** * Returns whether the ped has a repeater p1: 0 or 1 * * @param p1 * @returns */ doesPedHaveRepeater(p1: int): boolean; /** * @param weaponCollection */ giveWeaponCollectionToPed(weaponCollection: string | number): void; /** * @returns */ get IsPedWeaponReadyToShoot(): boolean; /** * @param componentHash * @param weaponHash */ removeWeaponComponentFromPed(componentHash: string | number, weaponHash: eWeaponHash): void; /** * @param visible * @param deselectWeapon * @param p3 * @param p4 * @returns The instance for method chaining */ setPedCurrentWeaponVisible(visible: boolean, deselectWeapon: boolean, p3: boolean, p4: boolean): this; /** * Old name: _DROP_CURRENT_PED_WEAPON * * @param p1 * @param attachPoint * @param p3 Refer to {@link eWeaponAttachPoint} * @param p4 * @returns */ makePedDropWeapon(p1: boolean, attachPoint: int, p3: boolean, p4: boolean): Entity | null; removeAllPedAmmo(): void; /** * @param allow */ set AllowDualWield(allow: boolean); /** * @param allow * @returns The instance for method chaining */ setAllowDualWield(allow: boolean): this; /** * Returns weaponEmoteVariation WEAPON_EMOTE_VARIATION_INVALID = -2, * WEAPON_EMOTE_VARIATION_BASE, * WEAPON_EMOTE_VARIATION_A, * WEAPON_EMOTE_VARIATION_B, * WEAPON_EMOTE_VARIATION_C, * WEAPON_EMOTE_VARIATION_D, * WEAPON_EMOTE_VARIATION_PREVIEW, * WEAPON_EMOTE_NUM_VARIATIONS * * @param variation * @returns */ getWeaponEmoteVariation(variation: int): int; /** * @param weaponHash * @returns */ isPedCarryingWeapon(weaponHash: eWeaponHash): boolean; /** * @returns */ refillAmmoInCurrentPedWeapon(): any; /** * Unequip current weapon and set current weapon to WEAPON_UNARMED. * p0 usually 2 in R* scripts. Doesn't seem to have any effect if changed.... * immediately: if true it will instantly switch to unarmed * * @param p0 * @param immediately */ hidePedWeapons(p0: int, immediately: boolean): void; /** * @param weaponHash * @returns ammo */ getAmmoInClip(weaponHash: eWeaponHash): [boolean, number]; /** * @param toggle */ N_0x16D9841A85FA627E(toggle: boolean): void; /** * @param weaponHash * @param offset Refer to {@link eWeaponHash} * @param ammoCount * @returns The instance for method chaining */ setPedDropsInventoryWeapon(weaponHash: eWeaponHash, offset: Vector3, ammoCount: int): this; /** * spinHash can be -1, 0 to disable * * @param weaponEmoteTrickType * @param spin * @returns The instance for method chaining */ setActiveGunSpinningKitEmoteTwirl(weaponEmoteTrickType: int, spin: string | number): this; /** * Appears to just send specified weapon to your horse holster without having to be close * However, the weapon is not visible on the horse holster, but you can reach the weapon on the weapon wheel * * @param weaponHash */ sendWeaponToInventory(weaponHash: eWeaponHash): void; /** * If near your horse when called, weapons stored on your horse will be considered * Returns weaponHash * * @param weaponGroup * @param p2 * @param p3 * @returns */ getBestPedWeaponInGroup(weaponGroup: string | number, p2: boolean, p3: boolean): number; /** * Only used in R* SP Scripts native_son2, native_son3 and smuggler2 * Params: p2 = -1 * * @param p1 * @param p2 */ N_0x8A779706DA5CA3DD(p1: boolean, p2: int): void; /** * @param weaponHash * @param ammoHash Refer to {@link eWeaponHash} */ disableAmmoTypeForPedWeapon(weaponHash: eWeaponHash, ammoHash: eAmmoType): void; /** * @returns data; outData */ giveWeaponToPedWithOptions(): [boolean, number, number]; /** * @returns */ get MaxLockonDistanceOfCurrentPedWeapon(): float; /** * Stores longarms to your horse on dismount * Params: p2 = 0 * SET_[I - M]* * * @param storeLongarms * @param p2 * @returns The instance for method chaining */ setInstantlyStoreLongarmsOnDismount(storeLongarms: boolean, p2: int): this; /** * @param removeReason * @returns weaponGuid */ removeWeaponFromPedByGuid(removeReason: eRemoveItemReason): number; /** * attachPoint: * * @param weaponHash * @param equipNow Refer to {@link eWeaponHash} * @param attachPoint * @param p4 Refer to {@link eWeaponAttachPoint} * @param p5 * @returns The instance for method chaining */ setCurrentPedWeapon(weaponHash: eWeaponHash, equipNow: boolean, attachPoint: int, p4: boolean, p5: boolean): this; /** * Equips a weapon from a weaponItem, similar to GIVE_WEAPON_TO_PED * * @param p2 * @param p3 * @param p4 * @param p5 * @returns weaponUid */ setCurrentPedWeaponByGuid(p2: boolean, p3: boolean, p4: boolean, p5: boolean): number; /** * @param componentHash * @param weaponHash * @returns */ hasPedGotWeaponComponent(componentHash: string | number, weaponHash: eWeaponHash): any; /** * @param weaponHash The ped to give the ammo, this cannot be a remote player. * @param amount Refer to {@link eWeaponHash} * @param addReason The amount of ped to add to the ammo */ addAmmoToPed(weaponHash: eWeaponHash, amount: int, addReason: eAddItemReason): void; /** * @param ammoType * @param amount * @param addReason */ addAmmoToPedByType(ammoType: string | number, amount: int, addReason: eAddItemReason): void; /** * @param targetPed * @returns */ isTargetPedConstrainedByPedUsingBolas(targetPed: Ped): boolean; /** * @param p1 * @returns guidPrimary */ getBestPedWeaponInInventory(p1: any): [any, number]; /** * @param toggle */ N_0xF08D8FEB455F2C8C(toggle: boolean): void; /** * @returns ammo; inventoryUid */ get AmmoInClipByInventoryUid(): [any, number, number]; /** * removeReason must be REMOVE_REASON_USED, REMOVE_REASON_GIVEN, REMOVE_REASON_DROPPED or REMOVE_REASON_DEBUG, unless amount is -1 * * @param ammoHash * @param amount Refer to {@link eAmmoType} * @param removeReason */ removeAmmoFromPedByType(ammoHash: eAmmoType, amount: int, removeReason: eRemoveItemReason): void; /** * Holster the holded shoulder weapon. Precisions: 0 means with anim while 1 means direct holster * * @param disableAnim */ set PedWeaponOnBack(disableAnim: boolean); /** * Holster the holded shoulder weapon. Precisions: 0 means with anim while 1 means direct holster * * @param disableAnim * @returns The instance for method chaining */ setPedWeaponOnBack(disableAnim: boolean): this; /** * @param ammoType * @param ammo * @returns The instance for method chaining */ setPedAmmoByType(ammoType: string | number, ammo: int): this; /** * @param p1 * @returns */ getPedBackupWeapon(p1: boolean): number; /** * @param attachPoint */ set ForceCurrentWeaponIntoCockedState(attachPoint: int); /** * @param attachPoint * @returns The instance for method chaining */ setForceCurrentWeaponIntoCockedState(attachPoint: int): this; /** * @returns */ get PedHogtieWeapon(): number; /** * Returns whether the ped has a pistol p1: 0 or 1 * * @param p1 * @returns */ doesPedHavePistol(p1: int): boolean; /** * *STOP** - *TEST** * * @param emoteType */ set GunSpinningInventorySlotIdActivate(emoteType: int); /** * *STOP** - *TEST** * * @param emoteType * @returns The instance for method chaining */ setGunSpinningInventorySlotIdActivate(emoteType: int): this; /** * @returns weaponHash: Refer to {@link eWeaponHash} */ get CurrentPedVehicleWeapon(): [boolean, number]; /** * @param attachPoint * @param visible Refer to {@link eWeaponAttachPoint} * @returns The instance for method chaining */ setPedWeaponAttachPointVisibility(attachPoint: int, visible: boolean): this; /** * @param p1 * @param p2 * @param p3 * @param immediately */ holsterPedWeapons(p1: boolean, p2: boolean, p3: boolean, immediately: boolean): void; /** * onlyCheckPlayerInventory: If true, it will only check the players current inventory. If false, it also checks your horse inventory * * @param weaponHash * @param p2 Refer to {@link eWeaponHash} * @param onlyCheckPlayerInventory * @returns */ hasPedGotWeapon(weaponHash: eWeaponHash, p2: int, onlyCheckPlayerInventory: boolean): boolean; /** * @returns */ get AllowDualWield(): any; /** * Returns eCurrentHeldWeapon * _GET_R* - _GET_T* * * @returns */ get PedCurrentHeldWeapon(): number; /** * @param toggle */ set ForceAutoEquip(toggle: boolean); /** * @param toggle * @returns The instance for method chaining */ setForceAutoEquip(toggle: boolean): this; /** * @param weaponHash * @param ammo Refer to {@link eWeaponHash} * @returns The instance for method chaining */ setPedAmmo(weaponHash: eWeaponHash, ammo: int): this; /** * Gives the ped the weapon. * List: https://github.com/femga/rdr3_discoveries/blob/master/weapons/weapons.lua Params: p7 is 0.5f, and p8 is 1.0f. p11 and p12 are both 0 in R* Scripts * permanentDegradation: default 0.5, any higher than 0 it will automatically make the weapon worn, you can also adjust the value to change the weapons maximum cleanliness * * @param weaponHash * @param ammoCount Refer to {@link eWeaponHash} * @param bForceInHand * @param bForceInHolster * @param attachPoint * @param bAllowMultipleCopies Refer to {@link eWeaponAttachPoint} * @param p7 * @param p8 * @param addReason * @param bIgnoreUnlocks Refer to {@link eAddItemReason} * @param permanentDegradation * @param p12 * @returns */ giveWeaponToPed(weaponHash: eWeaponHash, ammoCount: int, bForceInHand: boolean, bForceInHolster: boolean, attachPoint: int, bAllowMultipleCopies: boolean, p7: float, p8: float, addReason: eAddItemReason, bIgnoreUnlocks: boolean, permanentDegradation: float, p12: boolean): number; /** * @param weaponHash * @returns */ getAmmoInPedWeapon(weaponHash: eWeaponHash): int; /** * @param attachPoint * @returns weaponGuid */ getPedWeaponGuidAtAttachPoint(attachPoint: int): [any, number]; /** * emote hashes: KIT_EMOTE_TWIRL_GUN, KIT_EMOTE_TWIRL_GUN_LEFT_HOLSTER, KIT_EMOTE_TWIRL_GUN_DUAL, 0 (to unequip) * * @param emote */ set ActiveGunSpinningEquipKitEmoteTwirl(emote: string | number); /** * emote hashes: KIT_EMOTE_TWIRL_GUN, KIT_EMOTE_TWIRL_GUN_LEFT_HOLSTER, KIT_EMOTE_TWIRL_GUN_DUAL, 0 (to unequip) * * @param emote * @returns The instance for method chaining */ setActiveGunSpinningEquipKitEmoteTwirl(emote: string | number): this; /** * @param weaponHash * @param ammoHash Refer to {@link eWeaponHash} */ enableAmmoTypeForPedWeapon(weaponHash: eWeaponHash, ammoHash: eAmmoType): void; /** * @param toggle */ N_0x431240A58484D5D0(toggle: boolean): void; /** * @param p2 * @param p3 * @returns outGUID */ getBestPedShortarmGuid(p2: boolean, p3: boolean): number; /** * @returns coords */ get PedLastWeaponImpactCoord(): [boolean, Vector3]; /** * Returns WeaponAttachPoint * * @param attachPoint * @returns */ getWeaponAttachPoint(attachPoint: int): int; /** * @param p2 * @param attachPoint * @param p4 Refer to {@link eWeaponAttachPoint} * @returns weaponHash: Refer to {@link eWeaponHash} */ getCurrentPedWeapon(p2: boolean, attachPoint: int, p4: boolean): [boolean, number]; /** * Returns whether the ped has a revolver p1: 0 or 1 * * @param p1 * @returns */ doesPedHaveRevolver(p1: int): boolean; /** * Returns emote Hash * * @returns */ get PedGunSpinningEquippedKitEmoteTwirl(): number; /** * @param weaponHash */ enableAmmoTypeForPed(weaponHash: eWeaponHash): void; /** * Detaches the weapon from the ped and actually removes the ped's weapon * * @param p1 * @returns */ getWeaponObjectFromPed(p1: boolean): Prop | null; /** * @returns */ get IsPedCurrentWeaponHolstered(): boolean; /** * @param toggle */ set InstantlyEquipWeaponPickups(toggle: boolean); /** * @param toggle * @returns The instance for method chaining */ setInstantlyEquipWeaponPickups(toggle: boolean): this; /** * Hides the ped's weapon during a cutscene. * * @param toggle */ hidePedWeaponForScriptedCutscene(toggle: boolean): void; /** * @returns guidPrimary; guidSecondary */ setPlayerPedQuickSwapWeaponByGuid(): [number, number]; /** * @returns Returns the total ammo in the ped weapon from it's guid, or `0`.; guid * @example * ```lua * -- Example: * local ped = PlayerPedId() * local weaponGuid = DataView.ArrayBuffer(16 * 8) * * for attachPoint = 0, 3 do * -- GET_PED_WEAPON_GUID_AT_ATTACH_POINT * if (Citizen.InvokeNative(0x6929E22158E52265, ped, attachPoint, weaponGuid:Buffer())) then * -- This will return the total ammo of each of the player weapon slots * local ammo = Citizen.InvokeNative(0x4823F13A21F51964, ped, weaponGuid:Buffer(), Citizen.ResultAsInteger()) or 0 * print(string.format("You have %s ammo in the weapon at attach point #%s", ammo, attachPoint)) * end * end * ``` */ get AmmoInPedWeaponFromGuid(): [int, number]; /** * @param p1 * @param p2 */ removeAllPedWeapons(p1: boolean, p2: boolean): void; /** * Returns ammoHash from weaponObject (Returned by 0x6CA484C9A7377E4F) * * @param weaponObject * @returns */ getCurrentPedWeaponAmmoType(weaponObject: Prop): number; /** * @param p1 * @param p2 * @param p3 * @returns */ getPedWorstWeapon(p1: boolean, p2: boolean, p3: boolean): number; /** * @param toggle */ set PedDropsWeaponsWhenDead(toggle: boolean); /** * @param toggle * @returns The instance for method chaining */ setPedDropsWeaponsWhenDead(toggle: boolean): this; /** * Returns ammoHash * * @returns Returns the {@link eAmmoType}; weaponGuid */ get CurrentAmmoTypeFromGuid(): [number, number]; /** * @param toggle */ set PedInfiniteAmmoClip(toggle: boolean); /** * @param toggle * @returns The instance for method chaining */ setPedInfiniteAmmoClip(toggle: boolean): this; /** * returns the amount of peds that were restrained with the weapon thrown bolas * * @returns */ get NumPedsRestrainedFromWeaponBolas(): any; /** * @param toggle */ set AllowAnyWeaponDrop(toggle: boolean); /** * @param toggle * @returns The instance for method chaining */ setAllowAnyWeaponDrop(toggle: boolean): this; /** * @returns */ makePedReload(): any; /** * @param weaponHash * @param ammoCount Refer to {@link eWeaponHash} * @param p3 * @param addReason */ giveDelayedWeaponToPed(weaponHash: eWeaponHash, ammoCount: int, p3: boolean, addReason: eAddItemReason): void; /** * @param toggle */ N_0x45E57FDD531C9477(toggle: boolean): void; /** * @param ammoHash * @returns weaponInventoryUid */ setAmmoTypeForPedWeaponInventory(ammoHash: eAmmoType): number; /** * @param weaponHash * @param p2 Refer to {@link eWeaponHash} * @param removeReason */ removeWeaponFromPed(weaponHash: eWeaponHash, p2: boolean, removeReason: eRemoveItemReason): void; /** * @param visible */ set PedAllWeaponsVisibility(visible: boolean); /** * @param visible * @returns The instance for method chaining */ setPedAllWeaponsVisibility(visible: boolean): this; /** * @param weaponHash * @param ammo Refer to {@link eWeaponHash} * @returns */ setAmmoInClip(weaponHash: eWeaponHash, ammo: int): boolean; /** * _GET_M* - _GET_PED_A* * * @param p1 * @returns */ getPedWeaponObject(p1: boolean): Prop | null; /** * slotHash is usually just the weaponHash name, but WEAPON_* is replaced with SLOT_* * * @param slotHash * @returns */ getPedWeaponInSlot(slotHash: string | number): number; /** * Outputs cached guids * * @returns guidPrimary; guidSecondary */ get PlayerPedQuickSwapWeaponByGuid(): [number, number]; /** * Returns true if the ped is currently holstering or unholstering a weapon * * @returns */ get IsWeaponHolsterStateChanging(): boolean; /** * @param ammoHash * @returns */ N_0x44C8F4908F1B2622(ammoHash: eAmmoType): boolean; /** * @param p2 * @returns clipInventoryUid */ refillAmmoInClip(p2: int): [any, number]; /** * _SET_A* - _SET_B* * * @param p1 */ N_0x2EBF70E1D8C06683(p1: string | number): void; /** * @param ammoHash */ disableAmmoTypeForPed(ammoHash: eAmmoType): void; /** * Returns whether the ped has a shotgun p1: 0 or 1 * * @param p1 * @returns */ doesPedHaveShotgun(p1: int): boolean; clearPedLastWeaponDamage(): void; /** * Returns true if ped is on a horse while inside of a town * Params: p1 = 0 * GET_L* - GET_MA* * * @param p1 * @returns */ N_0x5A695BD328586B44(p1: int): any; /** * @param weaponHash * @param amount Refer to {@link eWeaponHash} * @param removeReason */ removeAmmoFromPed(weaponHash: eWeaponHash, amount: int, removeReason: eRemoveItemReason): void; /** * @param p1 * @param p2 * @returns The instance for method chaining */ setPedAmmoToDrop(p1: int, p2: int): this; /** * Returns the current ammo type of the specified ped's specified weapon. * * @param weaponHash * @returns */ getPedAmmoTypeFromWeapon(weaponHash: eWeaponHash): number; /** * @param weaponHash * @returns ammo */ getMaxAmmo(weaponHash: eWeaponHash): [boolean, number]; /** * @returns */ enableWeaponRestore(): any; /** * Returns whether the specified ped is holding a weapon with the given hash. * only these weapons below return true * WEAPON_BOW, WEAPON_KIT_METAL_DETECTOR, WEAPON_MELEE_CLEAVER, WEAPON_MELEE_DAVY_LANTERN, WEAPON_MELEE_HATCHET, WEAPON_MELEE_HATCHET_HUNTER, WEAPON_MELEE_KNIFE_JAWBONE, WEAPON_MELEE_LANTERN WEAPON_MELEE_TORCH, WEAPON_MOONSHINEJUG_MP, WEAPON_RIFLE_BOLTACTION, WEAPON_SHOTGUN_PUMP, WEAPON_THROWN_BOLAS, WEAPON_THROWN_MOLOTOV * * @param weapon * @returns */ isPedHoldingWeapon(weapon: string | number): boolean; /** * _GET_D* - _GET_L* * * @returns */ N_0x0DE0944ECCB3DF5D(): boolean; /** * @param flags * @returns */ isPedArmed(flags: int): boolean; /** * Returns whether the ped has a sniper p1: 0 or 1 * * @param p1 * @returns */ doesPedHaveSniper(p1: int): boolean; /** * Returns the ped's default unarmed weapon hash as defined in CPedModelInfo (DefaultUnarmedWeapon). * Falls back to WEAPON_UNARMED if the ped doesn't have a valid model info pointer, or 0 if the ped doesn't exist. * * @returns */ get DefaultUnarmedWeaponHash(): number; /** * @param weaponHash * @param p2 Refer to {@link eWeaponHash} * @returns */ getMaxAmmoInClip(weaponHash: eWeaponHash, p2: boolean): int; /** * @param attachPoint * @returns Returns the weapon entity */ getCurrentPedWeaponEntityIndex(attachPoint: int): Entity | null; } //# sourceMappingURL=Weapon.d.ts.map