From af460e34aa0f47a86e667d224f4eb6143a54bb47 Mon Sep 17 00:00:00 2001 From: Till Schreiber Date: Tue, 14 Jan 2025 12:29:32 +0100 Subject: [PATCH 1/2] update runtime --- runtime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime b/runtime index 88ddfab1..238e0e46 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit 88ddfab1931105741c27789f83fa7a620184e11c +Subproject commit 238e0e46b7b56c24b1ba6a563279985c65c69704 From f31862c6e5694d38b0306ff65bd92309353440f5 Mon Sep 17 00:00:00 2001 From: Till Schreiber Date: Tue, 14 Jan 2025 14:13:13 +0100 Subject: [PATCH 2/2] ALTV-643 - add IsInWater getter --- api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs | 12 ++++++++++++ api/AltV.Net.CApi/Libraries/ClientLibrary.cs | 2 +- api/AltV.Net.CApi/Libraries/ServerLibrary.cs | 2 +- api/AltV.Net.CApi/Libraries/SharedLibrary.cs | 7 ++++++- api/AltV.Net.Client/Elements/Entities/Player.cs | 12 ++++++++++++ .../Elements/Entities/ISharedPlayer.cs | 2 ++ api/AltV.Net/Elements/Entities/Player.cs | 12 ++++++++++++ runtime | 2 +- 8 files changed, 47 insertions(+), 4 deletions(-) diff --git a/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs b/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs index c5ef7985..cac11ae8 100644 --- a/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs +++ b/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs @@ -899,6 +899,18 @@ public bool IsParachuting } } + public bool IsInWater + { + get + { + lock (Player) + { + if (!AsyncContext.CheckIfExistsOrCachedNullable(Player)) return default; + return Player.IsInWater; + } + } + } + public void SetWeaponTintIndex(uint weapon, byte tintIndex) { lock (Player) diff --git a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs index 46b6978a..066082cf 100644 --- a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs @@ -939,7 +939,7 @@ public unsafe interface IClientLibrary public unsafe class ClientLibrary : IClientLibrary { - public readonly uint Methods = 1812; + public readonly uint Methods = 1813; public delegate* unmanaged[Cdecl] Audio_AddOutput { get; } public delegate* unmanaged[Cdecl] Audio_GetBaseObject { get; } public delegate* unmanaged[Cdecl] Audio_GetCurrentTime { get; } diff --git a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs index 1a55c66a..3e341608 100644 --- a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs @@ -490,7 +490,7 @@ public unsafe interface IServerLibrary public unsafe class ServerLibrary : IServerLibrary { - public readonly uint Methods = 1812; + public readonly uint Methods = 1813; public delegate* unmanaged[Cdecl] BaseObject_DeleteSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetMultipleSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetSyncedMetaData { get; } diff --git a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs index 31b99f13..9e6010de 100644 --- a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs @@ -348,6 +348,7 @@ public unsafe interface ISharedLibrary public delegate* unmanaged[Cdecl] Player_IsInMelee { get; } public delegate* unmanaged[Cdecl] Player_IsInRagdoll { get; } public delegate* unmanaged[Cdecl] Player_IsInVehicle { get; } + public delegate* unmanaged[Cdecl] Player_IsInWater { get; } public delegate* unmanaged[Cdecl] Player_IsJumping { get; } public delegate* unmanaged[Cdecl] Player_IsLeavingVehicle { get; } public delegate* unmanaged[Cdecl] Player_IsOnLadder { get; } @@ -426,7 +427,7 @@ public unsafe interface ISharedLibrary public unsafe class SharedLibrary : ISharedLibrary { - public readonly uint Methods = 1812; + public readonly uint Methods = 1813; public delegate* unmanaged[Cdecl] Audio_GetID { get; } public delegate* unmanaged[Cdecl] AudioAttachedOutput_GetID { get; } public delegate* unmanaged[Cdecl] AudioFilter_GetID { get; } @@ -764,6 +765,7 @@ public unsafe class SharedLibrary : ISharedLibrary public delegate* unmanaged[Cdecl] Player_IsInMelee { get; } public delegate* unmanaged[Cdecl] Player_IsInRagdoll { get; } public delegate* unmanaged[Cdecl] Player_IsInVehicle { get; } + public delegate* unmanaged[Cdecl] Player_IsInWater { get; } public delegate* unmanaged[Cdecl] Player_IsJumping { get; } public delegate* unmanaged[Cdecl] Player_IsLeavingVehicle { get; } public delegate* unmanaged[Cdecl] Player_IsOnLadder { get; } @@ -1512,6 +1514,8 @@ public unsafe class SharedLibrary : ISharedLibrary private static byte Player_IsInRagdollFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_IsInRagdoll", "Player_IsInRagdoll SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_IsInVehicleDelegate(nint _player); private static byte Player_IsInVehicleFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_IsInVehicle", "Player_IsInVehicle SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_IsInWaterDelegate(nint _player); + private static byte Player_IsInWaterFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_IsInWater", "Player_IsInWater SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_IsJumpingDelegate(nint _player); private static byte Player_IsJumpingFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_IsJumping", "Player_IsJumping SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_IsLeavingVehicleDelegate(nint _player); @@ -2007,6 +2011,7 @@ public SharedLibrary(Dictionary funcTable) Player_IsInMelee = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9656359974229471670UL, Player_IsInMeleeFallback); Player_IsInRagdoll = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13866510163503569909UL, Player_IsInRagdollFallback); Player_IsInVehicle = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3966288765716642074UL, Player_IsInVehicleFallback); + Player_IsInWater = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12569204323936167181UL, Player_IsInWaterFallback); Player_IsJumping = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8318404148061760703UL, Player_IsJumpingFallback); Player_IsLeavingVehicle = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7801590821162478013UL, Player_IsLeavingVehicleFallback); Player_IsOnLadder = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3159353707403506220UL, Player_IsOnLadderFallback); diff --git a/api/AltV.Net.Client/Elements/Entities/Player.cs b/api/AltV.Net.Client/Elements/Entities/Player.cs index 0b285344..95a30c17 100644 --- a/api/AltV.Net.Client/Elements/Entities/Player.cs +++ b/api/AltV.Net.Client/Elements/Entities/Player.cs @@ -225,6 +225,18 @@ public bool IsParachuting } } + public bool IsInWater + { + get + { + unsafe + { + CheckIfEntityExistsOrCached(); + return this.Core.Library.Shared.Player_IsInWater(this.PlayerNativePointer) == 1; + } + } + } + ISharedEntity ISharedPlayer.EntityAimingAt => EntityAimingAt!; public bool IsFlashlightActive diff --git a/api/AltV.Net.Shared/Elements/Entities/ISharedPlayer.cs b/api/AltV.Net.Shared/Elements/Entities/ISharedPlayer.cs index 7dc0fb11..3e9ebb41 100644 --- a/api/AltV.Net.Shared/Elements/Entities/ISharedPlayer.cs +++ b/api/AltV.Net.Shared/Elements/Entities/ISharedPlayer.cs @@ -150,5 +150,7 @@ public interface ISharedPlayer : ISharedEntity void GetCurrentWeaponComponents(out uint[] weaponComponents); bool IsParachuting { get; } + + bool IsInWater { get; } } } \ No newline at end of file diff --git a/api/AltV.Net/Elements/Entities/Player.cs b/api/AltV.Net/Elements/Entities/Player.cs index df148ff2..995a5785 100644 --- a/api/AltV.Net/Elements/Entities/Player.cs +++ b/api/AltV.Net/Elements/Entities/Player.cs @@ -1753,5 +1753,17 @@ public bool IsParachuting } } } + + public bool IsInWater + { + get + { + unsafe + { + CheckIfEntityExistsOrCached(); + return this.Core.Library.Shared.Player_IsInWater(this.PlayerNativePointer) == 1; + } + } + } } } diff --git a/runtime b/runtime index 238e0e46..d84e3c52 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit 238e0e46b7b56c24b1ba6a563279985c65c69704 +Subproject commit d84e3c52143c110c78e2ef1e71fcd09bd5d4c9e2