@nativewrappers/fivem 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/lib/client/Audio.d.ts +17 -0
- package/lib/client/Audio.js +92 -0
- package/lib/client/Blip.d.ts +39 -0
- package/lib/client/Blip.js +104 -0
- package/lib/client/Camera.d.ts +46 -0
- package/lib/client/Camera.js +161 -0
- package/lib/client/Checkpoint.d.ts +18 -0
- package/lib/client/Checkpoint.js +42 -0
- package/lib/client/Events.d.ts +11 -0
- package/lib/client/Events.js +73 -0
- package/lib/client/Game.d.ts +283 -0
- package/lib/client/Game.js +451 -0
- package/lib/client/GameplayCamera.d.ts +102 -0
- package/lib/client/GameplayCamera.js +141 -0
- package/lib/client/Model.d.ts +134 -0
- package/lib/client/Model.js +198 -0
- package/lib/client/NetworkedScene.d.ts +10 -0
- package/lib/client/NetworkedScene.js +17 -0
- package/lib/client/ParticleEffect.d.ts +80 -0
- package/lib/client/ParticleEffect.js +120 -0
- package/lib/client/ParticleEffectAsset.d.ts +54 -0
- package/lib/client/ParticleEffectAsset.js +104 -0
- package/lib/client/Pickup.d.ts +9 -0
- package/lib/client/Pickup.js +18 -0
- package/lib/client/Raycast.d.ts +49 -0
- package/lib/client/Raycast.js +70 -0
- package/lib/client/RelationshipGroup.d.ts +49 -0
- package/lib/client/RelationshipGroup.js +63 -0
- package/lib/client/Rope.d.ts +99 -0
- package/lib/client/Rope.js +125 -0
- package/lib/client/TaskSequence.d.ts +15 -0
- package/lib/client/TaskSequence.js +43 -0
- package/lib/client/Tasks.d.ts +66 -0
- package/lib/client/Tasks.js +236 -0
- package/lib/client/World.d.ts +402 -0
- package/lib/client/World.js +726 -0
- package/lib/client/cfx/StateBagChangeHandler.d.ts +3 -0
- package/lib/client/cfx/StateBagChangeHandler.js +1 -0
- package/lib/client/cfx/index.d.ts +7 -0
- package/lib/client/cfx/index.js +1 -0
- package/lib/client/enums/Alignment.d.ts +5 -0
- package/lib/client/enums/Alignment.js +6 -0
- package/lib/client/enums/AnimationFlags.d.ts +9 -0
- package/lib/client/enums/AnimationFlags.js +10 -0
- package/lib/client/enums/AudioFlag.d.ts +37 -0
- package/lib/client/enums/AudioFlag.js +38 -0
- package/lib/client/enums/BadgeStyle.d.ts +182 -0
- package/lib/client/enums/BadgeStyle.js +183 -0
- package/lib/client/enums/Blip.d.ts +223 -0
- package/lib/client/enums/Blip.js +225 -0
- package/lib/client/enums/Bone.d.ts +101 -0
- package/lib/client/enums/Bone.js +103 -0
- package/lib/client/enums/CameraShake.d.ts +13 -0
- package/lib/client/enums/CameraShake.js +14 -0
- package/lib/client/enums/CameraTypes.d.ts +7 -0
- package/lib/client/enums/CameraTypes.js +8 -0
- package/lib/client/enums/CheckboxStyle.d.ts +4 -0
- package/lib/client/enums/CheckboxStyle.js +5 -0
- package/lib/client/enums/Checkpoint.d.ts +62 -0
- package/lib/client/enums/Checkpoint.js +67 -0
- package/lib/client/enums/ClassTypes.d.ts +11 -0
- package/lib/client/enums/ClassTypes.js +12 -0
- package/lib/client/enums/CloudHat.d.ts +26 -0
- package/lib/client/enums/CloudHat.js +27 -0
- package/lib/client/enums/Control.d.ts +360 -0
- package/lib/client/enums/Control.js +361 -0
- package/lib/client/enums/CursorSprite.d.ts +14 -0
- package/lib/client/enums/CursorSprite.js +15 -0
- package/lib/client/enums/Driving.d.ts +32 -0
- package/lib/client/enums/Driving.js +34 -0
- package/lib/client/enums/ExplosionType.d.ts +44 -0
- package/lib/client/enums/ExplosionType.js +45 -0
- package/lib/client/enums/FiringPattern.d.ts +19 -0
- package/lib/client/enums/FiringPattern.js +20 -0
- package/lib/client/enums/Font.d.ts +7 -0
- package/lib/client/enums/Font.js +8 -0
- package/lib/client/enums/ForceType.d.ts +8 -0
- package/lib/client/enums/ForceType.js +9 -0
- package/lib/client/enums/Gender.d.ts +4 -0
- package/lib/client/enums/Gender.js +5 -0
- package/lib/client/enums/HelmetType.d.ts +5 -0
- package/lib/client/enums/HelmetType.js +6 -0
- package/lib/client/enums/HudColor.d.ts +183 -0
- package/lib/client/enums/HudColor.js +184 -0
- package/lib/client/enums/HudComponent.d.ts +53 -0
- package/lib/client/enums/HudComponent.js +54 -0
- package/lib/client/enums/InputMode.d.ts +4 -0
- package/lib/client/enums/InputMode.js +5 -0
- package/lib/client/enums/IntersectOptions.d.ts +15 -0
- package/lib/client/enums/IntersectOptions.js +16 -0
- package/lib/client/enums/InvertAxis.d.ts +9 -0
- package/lib/client/enums/InvertAxis.js +7 -0
- package/lib/client/enums/Language.d.ts +14 -0
- package/lib/client/enums/Language.js +15 -0
- package/lib/client/enums/LeaveVehicleFlags.d.ts +10 -0
- package/lib/client/enums/LeaveVehicleFlags.js +11 -0
- package/lib/client/enums/LoadingSpinnerType.d.ts +7 -0
- package/lib/client/enums/LoadingSpinnerType.js +8 -0
- package/lib/client/enums/MarkerType.d.ts +49 -0
- package/lib/client/enums/MarkerType.js +50 -0
- package/lib/client/enums/MenuAlignment.d.ts +4 -0
- package/lib/client/enums/MenuAlignment.js +5 -0
- package/lib/client/enums/NotificationType.d.ts +10 -0
- package/lib/client/enums/NotificationType.js +11 -0
- package/lib/client/enums/Parachute.d.ts +13 -0
- package/lib/client/enums/Parachute.js +15 -0
- package/lib/client/enums/PickupType.d.ts +73 -0
- package/lib/client/enums/PickupType.js +74 -0
- package/lib/client/enums/RadioStation.d.ts +24 -0
- package/lib/client/enums/RadioStation.js +25 -0
- package/lib/client/enums/RagdollType.d.ts +6 -0
- package/lib/client/enums/RagdollType.js +7 -0
- package/lib/client/enums/Relationship.d.ts +9 -0
- package/lib/client/enums/Relationship.js +10 -0
- package/lib/client/enums/RopeType.d.ts +5 -0
- package/lib/client/enums/RopeType.js +6 -0
- package/lib/client/enums/ScreenEffect.d.ts +83 -0
- package/lib/client/enums/ScreenEffect.js +84 -0
- package/lib/client/enums/SpeechModifier.d.ts +39 -0
- package/lib/client/enums/SpeechModifier.js +40 -0
- package/lib/client/enums/Vehicle.d.ts +358 -0
- package/lib/client/enums/Vehicle.js +376 -0
- package/lib/client/enums/Weather.d.ts +21 -0
- package/lib/client/enums/Weather.js +22 -0
- package/lib/client/enums/ZoneID.d.ts +94 -0
- package/lib/client/enums/ZoneID.js +95 -0
- package/lib/client/enums/index.d.ts +42 -0
- package/lib/client/enums/index.js +42 -0
- package/lib/client/hashes/MaterialHash.d.ts +216 -0
- package/lib/client/hashes/MaterialHash.js +217 -0
- package/lib/client/hashes/PedHash.d.ts +724 -0
- package/lib/client/hashes/PedHash.js +725 -0
- package/lib/client/hashes/VehicleHash.d.ts +522 -0
- package/lib/client/hashes/VehicleHash.js +523 -0
- package/lib/client/hashes/WeaponHash.d.ts +147 -0
- package/lib/client/hashes/WeaponHash.js +161 -0
- package/lib/client/hashes/WeatherTypeHash.d.ts +21 -0
- package/lib/client/hashes/WeatherTypeHash.js +22 -0
- package/lib/client/hashes/index.d.ts +5 -0
- package/lib/client/hashes/index.js +5 -0
- package/lib/client/index.d.ts +24 -0
- package/lib/client/index.js +25 -0
- package/lib/client/interfaces/Dimensions.d.ts +5 -0
- package/lib/client/interfaces/Dimensions.js +1 -0
- package/lib/client/models/BaseEntity.d.ts +169 -0
- package/lib/client/models/BaseEntity.js +459 -0
- package/lib/client/models/Entity.d.ts +9 -0
- package/lib/client/models/Entity.js +24 -0
- package/lib/client/models/EntityBone.d.ts +12 -0
- package/lib/client/models/EntityBone.js +24 -0
- package/lib/client/models/EntityBoneCollection.d.ts +11 -0
- package/lib/client/models/EntityBoneCollection.js +16 -0
- package/lib/client/models/Ped.d.ts +199 -0
- package/lib/client/models/Ped.js +685 -0
- package/lib/client/models/PedBone.d.ts +6 -0
- package/lib/client/models/PedBone.js +9 -0
- package/lib/client/models/PedBoneCollection.d.ts +8 -0
- package/lib/client/models/PedBoneCollection.js +19 -0
- package/lib/client/models/Player.d.ts +63 -0
- package/lib/client/models/Player.js +174 -0
- package/lib/client/models/Prop.d.ts +11 -0
- package/lib/client/models/Prop.js +26 -0
- package/lib/client/models/Vehicle.d.ts +171 -0
- package/lib/client/models/Vehicle.js +551 -0
- package/lib/client/models/VehicleDoor.d.ts +19 -0
- package/lib/client/models/VehicleDoor.js +42 -0
- package/lib/client/models/VehicleDoorCollection.d.ts +14 -0
- package/lib/client/models/VehicleDoorCollection.js +61 -0
- package/lib/client/models/VehicleMod.d.ts +16 -0
- package/lib/client/models/VehicleMod.js +33 -0
- package/lib/client/models/VehicleModCollection.d.ts +61 -0
- package/lib/client/models/VehicleModCollection.js +227 -0
- package/lib/client/models/VehicleToggleMod.d.ts +14 -0
- package/lib/client/models/VehicleToggleMod.js +27 -0
- package/lib/client/models/VehicleWheel.d.ts +11 -0
- package/lib/client/models/VehicleWheel.js +21 -0
- package/lib/client/models/VehicleWheelCollection.d.ts +13 -0
- package/lib/client/models/VehicleWheelCollection.js +56 -0
- package/lib/client/models/VehicleWindow.d.ts +16 -0
- package/lib/client/models/VehicleWindow.js +33 -0
- package/lib/client/models/VehicleWindowCollection.d.ts +14 -0
- package/lib/client/models/VehicleWindowCollection.js +55 -0
- package/lib/client/models/index.d.ts +18 -0
- package/lib/client/models/index.js +18 -0
- package/lib/client/types/EntityType.d.ts +2 -0
- package/lib/client/types/EntityType.js +1 -0
- package/lib/client/ui/Container.d.ts +11 -0
- package/lib/client/ui/Container.js +28 -0
- package/lib/client/ui/Effects.d.ts +8 -0
- package/lib/client/ui/Effects.js +106 -0
- package/lib/client/ui/Fading.d.ts +41 -0
- package/lib/client/ui/Fading.js +69 -0
- package/lib/client/ui/Hud.d.ts +16 -0
- package/lib/client/ui/Hud.js +39 -0
- package/lib/client/ui/InstructionalButtons.d.ts +33 -0
- package/lib/client/ui/InstructionalButtons.js +53 -0
- package/lib/client/ui/LoadingPrompt.d.ts +27 -0
- package/lib/client/ui/LoadingPrompt.js +45 -0
- package/lib/client/ui/Notification.d.ts +5 -0
- package/lib/client/ui/Notification.js +8 -0
- package/lib/client/ui/Rectangle.d.ts +10 -0
- package/lib/client/ui/Rectangle.js +37 -0
- package/lib/client/ui/Scaleform.d.ts +106 -0
- package/lib/client/ui/Scaleform.js +234 -0
- package/lib/client/ui/Screen.d.ts +16 -0
- package/lib/client/ui/Screen.js +72 -0
- package/lib/client/ui/Sprite.d.ts +17 -0
- package/lib/client/ui/Sprite.js +53 -0
- package/lib/client/ui/Text.d.ts +31 -0
- package/lib/client/ui/Text.js +102 -0
- package/lib/client/ui/Timerbar.d.ts +44 -0
- package/lib/client/ui/Timerbar.js +241 -0
- package/lib/client/ui/index.d.ts +15 -0
- package/lib/client/ui/index.js +15 -0
- package/lib/client/ui/interfaces/IButton.d.ts +5 -0
- package/lib/client/ui/interfaces/IButton.js +1 -0
- package/lib/client/ui/interfaces/IDrawable.d.ts +7 -0
- package/lib/client/ui/interfaces/IDrawable.js +1 -0
- package/lib/client/ui/interfaces/index.d.ts +2 -0
- package/lib/client/ui/interfaces/index.js +1 -0
- package/lib/client/ui/menu/Menu.d.ts +108 -0
- package/lib/client/ui/menu/Menu.js +802 -0
- package/lib/client/ui/menu/MenuControl.d.ts +6 -0
- package/lib/client/ui/menu/MenuControl.js +11 -0
- package/lib/client/ui/menu/MenuControls.d.ts +9 -0
- package/lib/client/ui/menu/MenuControls.js +11 -0
- package/lib/client/ui/menu/MenuSettings.d.ts +20 -0
- package/lib/client/ui/menu/MenuSettings.js +51 -0
- package/lib/client/ui/menu/index.d.ts +6 -0
- package/lib/client/ui/menu/index.js +6 -0
- package/lib/client/ui/menu/items/UIMenuCheckboxItem.d.ts +20 -0
- package/lib/client/ui/menu/items/UIMenuCheckboxItem.js +57 -0
- package/lib/client/ui/menu/items/UIMenuItem.d.ts +78 -0
- package/lib/client/ui/menu/items/UIMenuItem.js +1090 -0
- package/lib/client/ui/menu/items/UIMenuListItem.d.ts +31 -0
- package/lib/client/ui/menu/items/UIMenuListItem.js +110 -0
- package/lib/client/ui/menu/items/UIMenuSeparatorItem.d.ts +11 -0
- package/lib/client/ui/menu/items/UIMenuSeparatorItem.js +29 -0
- package/lib/client/ui/menu/items/UIMenuSliderItem.d.ts +47 -0
- package/lib/client/ui/menu/items/UIMenuSliderItem.js +173 -0
- package/lib/client/ui/menu/items/index.d.ts +6 -0
- package/lib/client/ui/menu/items/index.js +6 -0
- package/lib/client/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +17 -0
- package/lib/client/ui/menu/items/panels/AbstractUIMenuPanel.js +43 -0
- package/lib/client/ui/menu/items/panels/UIMenuColorPanel.d.ts +36 -0
- package/lib/client/ui/menu/items/panels/UIMenuColorPanel.js +211 -0
- package/lib/client/ui/menu/items/panels/UIMenuGridPanel.d.ts +40 -0
- package/lib/client/ui/menu/items/panels/UIMenuGridPanel.js +215 -0
- package/lib/client/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +26 -0
- package/lib/client/ui/menu/items/panels/UIMenuPercentagePanel.js +115 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +16 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanel.js +77 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +13 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +32 -0
- package/lib/client/ui/menu/items/panels/index.d.ts +6 -0
- package/lib/client/ui/menu/items/panels/index.js +6 -0
- package/lib/client/ui/menu/modules/ListItem.d.ts +6 -0
- package/lib/client/ui/menu/modules/ListItem.js +8 -0
- package/lib/client/ui/menu/modules/index.d.ts +1 -0
- package/lib/client/ui/menu/modules/index.js +1 -0
- package/lib/client/utils/Animations.d.ts +19 -0
- package/lib/client/utils/Animations.js +55 -0
- package/lib/client/utils/Color.d.ts +15 -0
- package/lib/client/utils/Color.js +22 -0
- package/lib/client/utils/Crypto.d.ts +3 -0
- package/lib/client/utils/Crypto.js +25 -0
- package/lib/client/utils/LiteEvent.d.ts +13 -0
- package/lib/client/utils/LiteEvent.js +21 -0
- package/lib/client/utils/Maths.d.ts +4 -0
- package/lib/client/utils/Maths.js +10 -0
- package/lib/client/utils/Point.d.ts +9 -0
- package/lib/client/utils/Point.js +28 -0
- package/lib/client/utils/PointF.d.ts +12 -0
- package/lib/client/utils/PointF.js +11 -0
- package/lib/client/utils/Quaternion.d.ts +10 -0
- package/lib/client/utils/Quaternion.js +23 -0
- package/lib/client/utils/Size.d.ts +5 -0
- package/lib/client/utils/Size.js +6 -0
- package/lib/client/utils/String.d.ts +6 -0
- package/lib/client/utils/String.js +25 -0
- package/lib/client/utils/Vector2.d.ts +54 -0
- package/lib/client/utils/Vector2.js +106 -0
- package/lib/client/utils/Vector3.d.ts +69 -0
- package/lib/client/utils/Vector3.js +140 -0
- package/lib/client/utils/Vector4.d.ts +62 -0
- package/lib/client/utils/Vector4.js +124 -0
- package/lib/client/utils/enumValues.d.ts +12 -0
- package/lib/client/utils/enumValues.js +14 -0
- package/lib/client/utils/getStringFromUInt8Array.d.ts +8 -0
- package/lib/client/utils/getStringFromUInt8Array.js +10 -0
- package/lib/client/utils/getUInt32FromUint8Array.d.ts +8 -0
- package/lib/client/utils/getUInt32FromUint8Array.js +8 -0
- package/lib/client/utils/index.d.ts +10 -0
- package/lib/client/utils/index.js +10 -0
- package/lib/client/weapon/DlcWeaponData.d.ts +43 -0
- package/lib/client/weapon/DlcWeaponData.js +44 -0
- package/lib/client/weapon/Mk2WeaponHash.d.ts +18 -0
- package/lib/client/weapon/Mk2WeaponHash.js +25 -0
- package/lib/client/weapon/Weapon.d.ts +169 -0
- package/lib/client/weapon/Weapon.js +267 -0
- package/lib/client/weapon/WeaponAsset.d.ts +55 -0
- package/lib/client/weapon/WeaponAsset.js +83 -0
- package/lib/client/weapon/WeaponCollection.d.ts +90 -0
- package/lib/client/weapon/WeaponCollection.js +186 -0
- package/lib/client/weapon/WeaponDisplayNameByHash.d.ts +6 -0
- package/lib/client/weapon/WeaponDisplayNameByHash.js +75 -0
- package/lib/client/weapon/WeaponGroup.d.ts +18 -0
- package/lib/client/weapon/WeaponGroup.js +19 -0
- package/lib/client/weapon/WeaponHudStats.d.ts +27 -0
- package/lib/client/weapon/WeaponHudStats.js +38 -0
- package/lib/client/weapon/WeaponLivery.d.ts +13 -0
- package/lib/client/weapon/WeaponLivery.js +14 -0
- package/lib/client/weapon/WeaponLiveryColor.d.ts +34 -0
- package/lib/client/weapon/WeaponLiveryColor.js +35 -0
- package/lib/client/weapon/WeaponTint.d.ts +42 -0
- package/lib/client/weapon/WeaponTint.js +43 -0
- package/lib/client/weapon/index.d.ts +8 -0
- package/lib/client/weapon/index.js +8 -0
- package/lib/client/weaponComponent/ComponentAttachmentPoint.d.ts +18 -0
- package/lib/client/weaponComponent/ComponentAttachmentPoint.js +19 -0
- package/lib/client/weaponComponent/ComponentAttachmentPointByHash.d.ts +7 -0
- package/lib/client/weaponComponent/ComponentAttachmentPointByHash.js +309 -0
- package/lib/client/weaponComponent/ComponentDisplayNameByHash.d.ts +6 -0
- package/lib/client/weaponComponent/ComponentDisplayNameByHash.js +280 -0
- package/lib/client/weaponComponent/DlcWeaponComponentData.d.ts +40 -0
- package/lib/client/weaponComponent/DlcWeaponComponentData.js +44 -0
- package/lib/client/weaponComponent/InvalidWeaponComponent.d.ts +12 -0
- package/lib/client/weaponComponent/InvalidWeaponComponent.js +28 -0
- package/lib/client/weaponComponent/WeaponComponent.d.ts +81 -0
- package/lib/client/weaponComponent/WeaponComponent.js +119 -0
- package/lib/client/weaponComponent/WeaponComponentCollection.d.ts +108 -0
- package/lib/client/weaponComponent/WeaponComponentCollection.js +172 -0
- package/lib/client/weaponComponent/WeaponComponentHash.d.ts +671 -0
- package/lib/client/weaponComponent/WeaponComponentHash.js +887 -0
- package/lib/client/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +8 -0
- package/lib/client/weaponComponent/WeaponComponentHashesByWeaponHash.js +823 -0
- package/lib/client/weaponComponent/WeaponComponentHudStats.d.ts +27 -0
- package/lib/client/weaponComponent/WeaponComponentHudStats.js +34 -0
- package/lib/client/weaponComponent/index.d.ts +5 -0
- package/lib/client/weaponComponent/index.js +5 -0
- package/lib/common/Convar.d.ts +8 -0
- package/lib/common/Convar.js +20 -0
- package/lib/common/Kvp.d.ts +91 -0
- package/lib/common/Kvp.js +161 -0
- package/lib/common/Resource.d.ts +14 -0
- package/lib/common/Resource.js +35 -0
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +5 -0
- package/lib/common/types.d.ts +6 -0
- package/lib/common/types.js +1 -0
- package/lib/common/utils/Color.d.ts +10 -0
- package/lib/common/utils/Color.js +17 -0
- package/lib/common/utils/Maths.d.ts +4 -0
- package/lib/common/utils/Maths.js +10 -0
- package/lib/common/utils/PointF.d.ts +12 -0
- package/lib/common/utils/PointF.js +11 -0
- package/lib/common/utils/Quaternion.d.ts +10 -0
- package/lib/common/utils/Quaternion.js +23 -0
- package/lib/common/utils/Vector2.d.ts +58 -0
- package/lib/common/utils/Vector2.js +113 -0
- package/lib/common/utils/Vector3.d.ts +73 -0
- package/lib/common/utils/Vector3.js +147 -0
- package/lib/common/utils/Vector4.d.ts +66 -0
- package/lib/common/utils/Vector4.js +131 -0
- package/lib/common/utils/cleanPlayerName.d.ts +6 -0
- package/lib/common/utils/cleanPlayerName.js +27 -0
- package/lib/common/utils/enumValues.d.ts +12 -0
- package/lib/common/utils/enumValues.js +14 -0
- package/lib/common/utils/getStringFromUInt8Array.d.ts +8 -0
- package/lib/common/utils/getStringFromUInt8Array.js +10 -0
- package/lib/common/utils/getUInt32FromUint8Array.d.ts +8 -0
- package/lib/common/utils/getUInt32FromUint8Array.js +8 -0
- package/lib/common/utils/index.d.ts +12 -0
- package/lib/common/utils/index.js +12 -0
- package/lib/server/Anticheat.d.ts +0 -0
- package/lib/server/Anticheat.js +25 -0
- package/lib/server/Events.d.ts +35 -0
- package/lib/server/Events.js +102 -0
- package/lib/server/Game.d.ts +56 -0
- package/lib/server/Game.js +86 -0
- package/lib/server/cfx/StateBagChangeHandler.d.ts +9 -0
- package/lib/server/cfx/StateBagChangeHandler.js +4 -0
- package/lib/server/cfx/index.d.ts +7 -0
- package/lib/server/cfx/index.js +1 -0
- package/lib/server/entities/BaseEntity.d.ts +115 -0
- package/lib/server/entities/BaseEntity.js +161 -0
- package/lib/server/entities/Entity.d.ts +18 -0
- package/lib/server/entities/Entity.js +22 -0
- package/lib/server/entities/Ped.d.ts +87 -0
- package/lib/server/entities/Ped.js +122 -0
- package/lib/server/entities/Player.d.ts +163 -0
- package/lib/server/entities/Player.js +235 -0
- package/lib/server/entities/Prop.d.ts +32 -0
- package/lib/server/entities/Prop.js +42 -0
- package/lib/server/entities/Vehicle.d.ts +230 -0
- package/lib/server/entities/Vehicle.js +331 -0
- package/lib/server/entities/index.d.ts +5 -0
- package/lib/server/entities/index.js +5 -0
- package/lib/server/enum/ClassTypes.d.ts +11 -0
- package/lib/server/enum/ClassTypes.js +12 -0
- package/lib/server/enum/PopulationType.d.ts +13 -0
- package/lib/server/enum/PopulationType.js +14 -0
- package/lib/server/enum/VehicleLockStatus.d.ts +9 -0
- package/lib/server/enum/VehicleLockStatus.js +10 -0
- package/lib/server/enum/VehicleType.d.ts +10 -0
- package/lib/server/enum/VehicleType.js +11 -0
- package/lib/server/enum/eEntityType.d.ts +5 -0
- package/lib/server/enum/eEntityType.js +6 -0
- package/lib/server/enum/index.d.ts +5 -0
- package/lib/server/enum/index.js +5 -0
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +7 -0
- package/lib/server/type/Anticheat.d.ts +471 -0
- package/lib/server/type/Anticheat.js +160 -0
- package/lib/server/type/Hash.d.ts +3 -0
- package/lib/server/type/Hash.js +2 -0
- package/lib/server/utils/index.d.ts +1 -0
- package/lib/server/utils/index.js +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mk2 weapon hash
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export declare enum Mk2WeaponHash {
|
|
6
|
+
PistolMk2 = 3219281620,
|
|
7
|
+
SNSPistolMk2 = 2285322324,
|
|
8
|
+
RevolverMk2 = 3415619887,
|
|
9
|
+
SMGMk2 = 2024373456,
|
|
10
|
+
PumpShotgunMk2 = 1432025498,
|
|
11
|
+
AssaultRifleMk2 = 961495388,
|
|
12
|
+
CarbineRifleMk2 = 4208062921,
|
|
13
|
+
SpecialCarbineMk2 = 2526821735,
|
|
14
|
+
BullpupRifleMk2 = 2228681469,
|
|
15
|
+
CombatMGMk2 = 3686625920,
|
|
16
|
+
HeavySniperMk2 = 177293209,
|
|
17
|
+
MarksmanRifleMk2 = 1785463520
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mk2 weapon hash
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export var Mk2WeaponHash;
|
|
6
|
+
(function (Mk2WeaponHash) {
|
|
7
|
+
// handguns
|
|
8
|
+
Mk2WeaponHash[Mk2WeaponHash["PistolMk2"] = 3219281620] = "PistolMk2";
|
|
9
|
+
Mk2WeaponHash[Mk2WeaponHash["SNSPistolMk2"] = 2285322324] = "SNSPistolMk2";
|
|
10
|
+
Mk2WeaponHash[Mk2WeaponHash["RevolverMk2"] = 3415619887] = "RevolverMk2";
|
|
11
|
+
// smg
|
|
12
|
+
Mk2WeaponHash[Mk2WeaponHash["SMGMk2"] = 2024373456] = "SMGMk2";
|
|
13
|
+
// shotgun
|
|
14
|
+
Mk2WeaponHash[Mk2WeaponHash["PumpShotgunMk2"] = 1432025498] = "PumpShotgunMk2";
|
|
15
|
+
// assault_rifles
|
|
16
|
+
Mk2WeaponHash[Mk2WeaponHash["AssaultRifleMk2"] = 961495388] = "AssaultRifleMk2";
|
|
17
|
+
Mk2WeaponHash[Mk2WeaponHash["CarbineRifleMk2"] = 4208062921] = "CarbineRifleMk2";
|
|
18
|
+
Mk2WeaponHash[Mk2WeaponHash["SpecialCarbineMk2"] = 2526821735] = "SpecialCarbineMk2";
|
|
19
|
+
Mk2WeaponHash[Mk2WeaponHash["BullpupRifleMk2"] = 2228681469] = "BullpupRifleMk2";
|
|
20
|
+
// machine_guns
|
|
21
|
+
Mk2WeaponHash[Mk2WeaponHash["CombatMGMk2"] = 3686625920] = "CombatMGMk2";
|
|
22
|
+
// sniper_rifles
|
|
23
|
+
Mk2WeaponHash[Mk2WeaponHash["HeavySniperMk2"] = 177293209] = "HeavySniperMk2";
|
|
24
|
+
Mk2WeaponHash[Mk2WeaponHash["MarksmanRifleMk2"] = 1785463520] = "MarksmanRifleMk2";
|
|
25
|
+
})(Mk2WeaponHash || (Mk2WeaponHash = {}));
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { WeaponComponentCollection } from '../weaponComponent/WeaponComponentCollection';
|
|
2
|
+
import { Ped } from '../models';
|
|
3
|
+
import { AmmoType, WeaponHash } from '../hashes';
|
|
4
|
+
import { Model } from '../Model';
|
|
5
|
+
import { WeaponTint } from './WeaponTint';
|
|
6
|
+
import { WeaponGroup } from './WeaponGroup';
|
|
7
|
+
import { WeaponLivery } from './WeaponLivery';
|
|
8
|
+
import { WeaponLiveryColor } from './WeaponLiveryColor';
|
|
9
|
+
import { WeaponHudStats } from './WeaponHudStats';
|
|
10
|
+
import { WeaponComponentHash } from '../weaponComponent';
|
|
11
|
+
/**
|
|
12
|
+
* ped weapon
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare class Weapon {
|
|
16
|
+
private readonly owner;
|
|
17
|
+
private readonly components;
|
|
18
|
+
private readonly hash;
|
|
19
|
+
constructor(owner: Ped, hash: WeaponHash);
|
|
20
|
+
/**
|
|
21
|
+
* weapon components
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
*/
|
|
25
|
+
get Components(): WeaponComponentCollection;
|
|
26
|
+
/**
|
|
27
|
+
* weapon hash
|
|
28
|
+
*
|
|
29
|
+
* @constructor
|
|
30
|
+
*/
|
|
31
|
+
get Hash(): WeaponHash;
|
|
32
|
+
/**
|
|
33
|
+
* check ped is unarmed or not
|
|
34
|
+
*
|
|
35
|
+
* @constructor
|
|
36
|
+
*/
|
|
37
|
+
get IsUnarmed(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check if the ped has the current weapon.
|
|
40
|
+
*
|
|
41
|
+
* @constructor
|
|
42
|
+
*/
|
|
43
|
+
get IsPresent(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* get weapon display name / label
|
|
46
|
+
*
|
|
47
|
+
* @constructor
|
|
48
|
+
*/
|
|
49
|
+
get DisplayName(): string;
|
|
50
|
+
/**
|
|
51
|
+
* get weapon localized name
|
|
52
|
+
*
|
|
53
|
+
* @constructor
|
|
54
|
+
*/
|
|
55
|
+
get LocalizedName(): string;
|
|
56
|
+
/**
|
|
57
|
+
* get weapon model
|
|
58
|
+
*
|
|
59
|
+
* @constructor
|
|
60
|
+
*/
|
|
61
|
+
get Model(): Model;
|
|
62
|
+
/**
|
|
63
|
+
* get weapon tint
|
|
64
|
+
*
|
|
65
|
+
* @constructor
|
|
66
|
+
*/
|
|
67
|
+
get Tint(): WeaponTint;
|
|
68
|
+
/**
|
|
69
|
+
* set weapon tint
|
|
70
|
+
*
|
|
71
|
+
* @param tint
|
|
72
|
+
* @constructor
|
|
73
|
+
*/
|
|
74
|
+
set Tint(tint: WeaponTint);
|
|
75
|
+
/**
|
|
76
|
+
* get weapon group
|
|
77
|
+
*
|
|
78
|
+
* @constructor
|
|
79
|
+
*/
|
|
80
|
+
get Group(): WeaponGroup;
|
|
81
|
+
/**
|
|
82
|
+
* get weapon ammo type
|
|
83
|
+
*
|
|
84
|
+
* @constructor
|
|
85
|
+
*/
|
|
86
|
+
get AmmoType(): AmmoType;
|
|
87
|
+
/**
|
|
88
|
+
* get weapon ammo count
|
|
89
|
+
*
|
|
90
|
+
* @constructor
|
|
91
|
+
*/
|
|
92
|
+
get Ammo(): number;
|
|
93
|
+
/**
|
|
94
|
+
* set weapon ammo count
|
|
95
|
+
*
|
|
96
|
+
* @param count
|
|
97
|
+
* @constructor
|
|
98
|
+
*/
|
|
99
|
+
set Ammo(count: number);
|
|
100
|
+
/**
|
|
101
|
+
* get weapon max ammo
|
|
102
|
+
*
|
|
103
|
+
* @constructor
|
|
104
|
+
*/
|
|
105
|
+
get MaxAmmo(): number;
|
|
106
|
+
/**
|
|
107
|
+
* get weapon max ammo in clip
|
|
108
|
+
*
|
|
109
|
+
* @constructor
|
|
110
|
+
*/
|
|
111
|
+
get MaxAmmoInClip(): number;
|
|
112
|
+
/**
|
|
113
|
+
* get weapon default clip size
|
|
114
|
+
*
|
|
115
|
+
* @constructor
|
|
116
|
+
*/
|
|
117
|
+
get DefaultClipSize(): number;
|
|
118
|
+
/**
|
|
119
|
+
* toggle weapon infinite ammo
|
|
120
|
+
*
|
|
121
|
+
* @param toggle
|
|
122
|
+
* @constructor
|
|
123
|
+
*/
|
|
124
|
+
set InfiniteAmmo(toggle: boolean);
|
|
125
|
+
/**
|
|
126
|
+
* toggle ped infinite ammo clip on all weapons
|
|
127
|
+
*
|
|
128
|
+
* @param toggle
|
|
129
|
+
* @constructor
|
|
130
|
+
*/
|
|
131
|
+
set InfiniteAmmoClip(toggle: boolean);
|
|
132
|
+
/**
|
|
133
|
+
* check weapon can use on parachute
|
|
134
|
+
*
|
|
135
|
+
* @constructor
|
|
136
|
+
*/
|
|
137
|
+
get CanUseOnParachute(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Check weapon is Mk2 or not
|
|
140
|
+
*
|
|
141
|
+
* @constructor
|
|
142
|
+
*/
|
|
143
|
+
get IsMk2(): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* set weapon livery, only work for Mk2 weapon
|
|
146
|
+
*
|
|
147
|
+
* @param liveryId
|
|
148
|
+
* @param colorId
|
|
149
|
+
*/
|
|
150
|
+
setLivery(liveryId: WeaponLivery, colorId: WeaponLiveryColor): void;
|
|
151
|
+
/**
|
|
152
|
+
* get weapon hud stats
|
|
153
|
+
*
|
|
154
|
+
* @constructor
|
|
155
|
+
*/
|
|
156
|
+
get HudStats(): WeaponHudStats | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* get weapon display name / label by hash
|
|
159
|
+
*
|
|
160
|
+
* @param hash
|
|
161
|
+
*/
|
|
162
|
+
static getDisplayNameFromHash(hash: WeaponHash): string;
|
|
163
|
+
/**
|
|
164
|
+
* get component hashes belongs to weapon
|
|
165
|
+
*
|
|
166
|
+
* @param hash
|
|
167
|
+
*/
|
|
168
|
+
static getWeaponComponentHashes(hash: WeaponHash): WeaponComponentHash[];
|
|
169
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { WeaponComponentCollection } from '../weaponComponent/WeaponComponentCollection';
|
|
2
|
+
import { WeaponHash } from '../hashes';
|
|
3
|
+
import { WeaponDisplayNameByHash } from './WeaponDisplayNameByHash';
|
|
4
|
+
import { Game } from '../Game';
|
|
5
|
+
import { Model } from '../Model';
|
|
6
|
+
import { WeaponHudStats } from './WeaponHudStats';
|
|
7
|
+
import { enumValues } from '../utils';
|
|
8
|
+
import { Mk2WeaponHash } from './Mk2WeaponHash';
|
|
9
|
+
import { WeaponComponentHashesByWeaponHash } from '../weaponComponent/WeaponComponentHashesByWeaponHash';
|
|
10
|
+
/**
|
|
11
|
+
* ped weapon
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export class Weapon {
|
|
15
|
+
constructor(owner, hash) {
|
|
16
|
+
this.owner = owner;
|
|
17
|
+
this.hash = hash;
|
|
18
|
+
this.components = new WeaponComponentCollection(this.owner, this);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* weapon components
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
*/
|
|
25
|
+
get Components() {
|
|
26
|
+
return this.components;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* weapon hash
|
|
30
|
+
*
|
|
31
|
+
* @constructor
|
|
32
|
+
*/
|
|
33
|
+
get Hash() {
|
|
34
|
+
return this.hash;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* check ped is unarmed or not
|
|
38
|
+
*
|
|
39
|
+
* @constructor
|
|
40
|
+
*/
|
|
41
|
+
get IsUnarmed() {
|
|
42
|
+
return this.hash === WeaponHash.Unarmed;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if the ped has the current weapon.
|
|
46
|
+
*
|
|
47
|
+
* @constructor
|
|
48
|
+
*/
|
|
49
|
+
get IsPresent() {
|
|
50
|
+
if (this.IsUnarmed) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return HasPedGotWeapon(this.owner.Handle, this.hash, false);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* get weapon display name / label
|
|
57
|
+
*
|
|
58
|
+
* @constructor
|
|
59
|
+
*/
|
|
60
|
+
get DisplayName() {
|
|
61
|
+
return Weapon.getDisplayNameFromHash(this.hash) ?? 'WCT_INVALID';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* get weapon localized name
|
|
65
|
+
*
|
|
66
|
+
* @constructor
|
|
67
|
+
*/
|
|
68
|
+
get LocalizedName() {
|
|
69
|
+
return Game.getGXTEntry(this.DisplayName);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* get weapon model
|
|
73
|
+
*
|
|
74
|
+
* @constructor
|
|
75
|
+
*/
|
|
76
|
+
get Model() {
|
|
77
|
+
return new Model(GetWeapontypeModel(this.hash));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* get weapon tint
|
|
81
|
+
*
|
|
82
|
+
* @constructor
|
|
83
|
+
*/
|
|
84
|
+
get Tint() {
|
|
85
|
+
return GetPedWeaponTintIndex(this.owner.Handle, this.hash);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* set weapon tint
|
|
89
|
+
*
|
|
90
|
+
* @param tint
|
|
91
|
+
* @constructor
|
|
92
|
+
*/
|
|
93
|
+
set Tint(tint) {
|
|
94
|
+
SetPedWeaponTintIndex(this.owner.Handle, this.hash, tint);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* get weapon group
|
|
98
|
+
*
|
|
99
|
+
* @constructor
|
|
100
|
+
*/
|
|
101
|
+
get Group() {
|
|
102
|
+
return GetWeapontypeGroup(this.hash);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* get weapon ammo type
|
|
106
|
+
*
|
|
107
|
+
* @constructor
|
|
108
|
+
*/
|
|
109
|
+
get AmmoType() {
|
|
110
|
+
return GetPedAmmoTypeFromWeapon(this.owner.Handle, this.hash);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* get weapon ammo count
|
|
114
|
+
*
|
|
115
|
+
* @constructor
|
|
116
|
+
*/
|
|
117
|
+
get Ammo() {
|
|
118
|
+
if (this.IsUnarmed) {
|
|
119
|
+
return 1;
|
|
120
|
+
}
|
|
121
|
+
if (!this.IsPresent) {
|
|
122
|
+
return GetPedAmmoByType(this.owner.Handle, this.AmmoType);
|
|
123
|
+
}
|
|
124
|
+
return GetAmmoInPedWeapon(this.owner.Handle, this.hash);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* set weapon ammo count
|
|
128
|
+
*
|
|
129
|
+
* @param count
|
|
130
|
+
* @constructor
|
|
131
|
+
*/
|
|
132
|
+
set Ammo(count) {
|
|
133
|
+
if (this.IsUnarmed) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (this.IsPresent) {
|
|
137
|
+
SetPedAmmo(this.owner.Handle, this.hash, count);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
GiveWeaponToPed(this.owner.Handle, this.hash, count, false, true);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* get weapon max ammo
|
|
145
|
+
*
|
|
146
|
+
* @constructor
|
|
147
|
+
*/
|
|
148
|
+
get MaxAmmo() {
|
|
149
|
+
if (this.IsUnarmed) {
|
|
150
|
+
return 1;
|
|
151
|
+
}
|
|
152
|
+
// GetMaxAmmo
|
|
153
|
+
// https://docs.fivem.net/natives/?_0xDC16122C7A20C933
|
|
154
|
+
// noinspection UnnecessaryLocalVariableJS
|
|
155
|
+
const amount = Citizen.invokeNative('0xDC16122C7A20C933', this.owner.Handle, this.hash, Citizen.pointerValueInt(), Citizen.resultAsInteger());
|
|
156
|
+
return amount;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* get weapon max ammo in clip
|
|
160
|
+
*
|
|
161
|
+
* @constructor
|
|
162
|
+
*/
|
|
163
|
+
get MaxAmmoInClip() {
|
|
164
|
+
if (this.IsUnarmed) {
|
|
165
|
+
return 1;
|
|
166
|
+
}
|
|
167
|
+
if (!this.IsPresent) {
|
|
168
|
+
return 0;
|
|
169
|
+
}
|
|
170
|
+
return GetMaxAmmoInClip(this.owner.Handle, this.hash, true);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* get weapon default clip size
|
|
174
|
+
*
|
|
175
|
+
* @constructor
|
|
176
|
+
*/
|
|
177
|
+
get DefaultClipSize() {
|
|
178
|
+
return GetWeaponClipSize(this.hash);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* toggle weapon infinite ammo
|
|
182
|
+
*
|
|
183
|
+
* @param toggle
|
|
184
|
+
* @constructor
|
|
185
|
+
*/
|
|
186
|
+
set InfiniteAmmo(toggle) {
|
|
187
|
+
if (this.IsUnarmed) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
SetPedInfiniteAmmo(this.owner.Handle, toggle, this.hash);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* toggle ped infinite ammo clip on all weapons
|
|
194
|
+
*
|
|
195
|
+
* @param toggle
|
|
196
|
+
* @constructor
|
|
197
|
+
*/
|
|
198
|
+
set InfiniteAmmoClip(toggle) {
|
|
199
|
+
SetPedInfiniteAmmoClip(this.owner.Handle, toggle);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* check weapon can use on parachute
|
|
203
|
+
*
|
|
204
|
+
* @constructor
|
|
205
|
+
*/
|
|
206
|
+
get CanUseOnParachute() {
|
|
207
|
+
return CanUseWeaponOnParachute(this.hash);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Check weapon is Mk2 or not
|
|
211
|
+
*
|
|
212
|
+
* @constructor
|
|
213
|
+
*/
|
|
214
|
+
get IsMk2() {
|
|
215
|
+
return Array.from(enumValues(Mk2WeaponHash)).some(x => x === this.hash);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* set weapon livery, only work for Mk2 weapon
|
|
219
|
+
*
|
|
220
|
+
* @param liveryId
|
|
221
|
+
* @param colorId
|
|
222
|
+
*/
|
|
223
|
+
setLivery(liveryId, colorId) {
|
|
224
|
+
if (!this.IsMk2) {
|
|
225
|
+
console.log(`[ERROR]${this.setLivery.name} failed. Reason: non-Mk2 weapon`);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const component = this.Components.getMk2CamoComponent(liveryId);
|
|
229
|
+
if (component.IsInvalid) {
|
|
230
|
+
console.log(`[ERROR]${this.setLivery.name} failed. Reason: invalid liveryId/Component`);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
component.Active = true;
|
|
234
|
+
SetPedWeaponLiveryColor(this.owner.Handle, this.hash, component.ComponentHash, colorId);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* get weapon hud stats
|
|
238
|
+
*
|
|
239
|
+
* @constructor
|
|
240
|
+
*/
|
|
241
|
+
get HudStats() {
|
|
242
|
+
return WeaponHudStats.get(this.hash);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* get weapon display name / label by hash
|
|
246
|
+
*
|
|
247
|
+
* @param hash
|
|
248
|
+
*/
|
|
249
|
+
static getDisplayNameFromHash(hash) {
|
|
250
|
+
if (!hash) {
|
|
251
|
+
return 'WT_INVALID';
|
|
252
|
+
}
|
|
253
|
+
return WeaponDisplayNameByHash.get(hash) ?? 'WCT_INVALID';
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* get component hashes belongs to weapon
|
|
257
|
+
*
|
|
258
|
+
* @param hash
|
|
259
|
+
*/
|
|
260
|
+
static getWeaponComponentHashes(hash) {
|
|
261
|
+
const hashes = WeaponComponentHashesByWeaponHash.get(hash);
|
|
262
|
+
if (!hashes) {
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
return [...hashes];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { WeaponHash } from '../hashes';
|
|
2
|
+
/**
|
|
3
|
+
* weapon asset
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class WeaponAsset {
|
|
7
|
+
private readonly hash;
|
|
8
|
+
constructor(hash: WeaponHash);
|
|
9
|
+
/**
|
|
10
|
+
* get weapon hash
|
|
11
|
+
*
|
|
12
|
+
* @constructor
|
|
13
|
+
*/
|
|
14
|
+
get Hash(): WeaponHash;
|
|
15
|
+
/**
|
|
16
|
+
* check weapon is valid
|
|
17
|
+
*
|
|
18
|
+
* @constructor
|
|
19
|
+
*/
|
|
20
|
+
get IsValid(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* check weapon assets is loaded
|
|
23
|
+
*
|
|
24
|
+
* @constructor
|
|
25
|
+
*/
|
|
26
|
+
get IsLoaded(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* request weapon asset
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
request(): void;
|
|
32
|
+
/**
|
|
33
|
+
* request weapon asset async
|
|
34
|
+
*
|
|
35
|
+
* @param timeout
|
|
36
|
+
*/
|
|
37
|
+
requestAsync(timeout: number): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* unload weapon asset
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
dismiss(): void;
|
|
43
|
+
/**
|
|
44
|
+
* get weapon display name / label
|
|
45
|
+
*
|
|
46
|
+
* @constructor
|
|
47
|
+
*/
|
|
48
|
+
get DisplayName(): string;
|
|
49
|
+
/**
|
|
50
|
+
* get weapon localized name
|
|
51
|
+
*
|
|
52
|
+
* @constructor
|
|
53
|
+
*/
|
|
54
|
+
get LocalizedName(): string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Weapon } from './Weapon';
|
|
2
|
+
import { Game } from '../Game';
|
|
3
|
+
import { Wait } from '../utils';
|
|
4
|
+
/**
|
|
5
|
+
* weapon asset
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export class WeaponAsset {
|
|
9
|
+
constructor(hash) {
|
|
10
|
+
this.hash = hash;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* get weapon hash
|
|
14
|
+
*
|
|
15
|
+
* @constructor
|
|
16
|
+
*/
|
|
17
|
+
get Hash() {
|
|
18
|
+
return this.hash;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* check weapon is valid
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
*/
|
|
25
|
+
get IsValid() {
|
|
26
|
+
return IsWeaponValid(this.hash);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* check weapon assets is loaded
|
|
30
|
+
*
|
|
31
|
+
* @constructor
|
|
32
|
+
*/
|
|
33
|
+
get IsLoaded() {
|
|
34
|
+
return HasWeaponAssetLoaded(this.hash);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* request weapon asset
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
request() {
|
|
41
|
+
RequestWeaponAsset(this.hash, 31, 0);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* request weapon asset async
|
|
45
|
+
*
|
|
46
|
+
* @param timeout
|
|
47
|
+
*/
|
|
48
|
+
async requestAsync(timeout) {
|
|
49
|
+
this.request();
|
|
50
|
+
const start = GetGameTimer();
|
|
51
|
+
while (!this.IsLoaded) {
|
|
52
|
+
await Wait(100);
|
|
53
|
+
const now = GetGameTimer();
|
|
54
|
+
if (now - start >= timeout) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* unload weapon asset
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
dismiss() {
|
|
65
|
+
RemoveWeaponAsset(this.hash);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* get weapon display name / label
|
|
69
|
+
*
|
|
70
|
+
* @constructor
|
|
71
|
+
*/
|
|
72
|
+
get DisplayName() {
|
|
73
|
+
return Weapon.getDisplayNameFromHash(this.hash);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* get weapon localized name
|
|
77
|
+
*
|
|
78
|
+
* @constructor
|
|
79
|
+
*/
|
|
80
|
+
get LocalizedName() {
|
|
81
|
+
return Game.getGXTEntry(this.DisplayName);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Weapon } from './Weapon';
|
|
2
|
+
import { Ped, Prop } from '../models';
|
|
3
|
+
import { WeaponHash } from '../hashes';
|
|
4
|
+
/**
|
|
5
|
+
* ped weapons
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class WeaponCollection implements Iterable<Weapon> {
|
|
9
|
+
private readonly owner;
|
|
10
|
+
private readonly weapons;
|
|
11
|
+
constructor(owner: Ped);
|
|
12
|
+
[Symbol.iterator](): Iterator<Weapon>;
|
|
13
|
+
/**
|
|
14
|
+
* get weapon by hash
|
|
15
|
+
*
|
|
16
|
+
* @param hash
|
|
17
|
+
*/
|
|
18
|
+
get(hash: WeaponHash): Weapon | null;
|
|
19
|
+
/**
|
|
20
|
+
* get ped current weapon
|
|
21
|
+
*
|
|
22
|
+
* @constructor
|
|
23
|
+
*/
|
|
24
|
+
get Current(): Weapon;
|
|
25
|
+
/**
|
|
26
|
+
* get ped current weapon object
|
|
27
|
+
*
|
|
28
|
+
* @constructor
|
|
29
|
+
*/
|
|
30
|
+
get CurrentWeaponObject(): Prop | null;
|
|
31
|
+
/**
|
|
32
|
+
* get ped best weapon
|
|
33
|
+
*
|
|
34
|
+
* @constructor
|
|
35
|
+
*/
|
|
36
|
+
get BestWeapon(): Weapon;
|
|
37
|
+
/**
|
|
38
|
+
* check ped has weapon
|
|
39
|
+
*
|
|
40
|
+
* @param hash
|
|
41
|
+
*/
|
|
42
|
+
hasWeapon(hash: WeaponHash): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* check weapon is valid
|
|
45
|
+
*
|
|
46
|
+
* @param hash
|
|
47
|
+
*/
|
|
48
|
+
isWeaponValid(hash: WeaponHash): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* give weapon to ped
|
|
51
|
+
*
|
|
52
|
+
* @param hash
|
|
53
|
+
* @param ammoCount
|
|
54
|
+
* @param equipNow
|
|
55
|
+
* @param isAmmoLoaded
|
|
56
|
+
*/
|
|
57
|
+
give(hash: WeaponHash, ammoCount: number, equipNow: boolean, isAmmoLoaded: boolean): Weapon;
|
|
58
|
+
/**
|
|
59
|
+
* set ped current weapon on hand
|
|
60
|
+
*
|
|
61
|
+
* @param weapon
|
|
62
|
+
*/
|
|
63
|
+
select(weapon: Weapon | WeaponHash): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* remove weapon from ped
|
|
66
|
+
*
|
|
67
|
+
* @param weapon
|
|
68
|
+
*/
|
|
69
|
+
remove(weapon: Weapon | WeaponHash): void;
|
|
70
|
+
/**
|
|
71
|
+
* remove all weapons from ped
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
removeAll(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Drop ped current weapon?
|
|
77
|
+
* todo: this native seems does not work as expected, need to investigate
|
|
78
|
+
* refer1: https://docs.fivem.net/natives/?_0x6B7513D9966FBEC0
|
|
79
|
+
* refer2: https://forum.cfx.re/t/release-weapondrop/49856/8
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
drop(): void;
|
|
83
|
+
/**
|
|
84
|
+
* create weapon object and add to collection
|
|
85
|
+
*
|
|
86
|
+
* @param hash
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
private createAndAddWeapon;
|
|
90
|
+
}
|