Skip to content

Commit 54ceed7

Browse files
committed
update to latest sdk changes
1 parent ad8ef3a commit 54ceed7

File tree

18 files changed

+208
-15
lines changed

18 files changed

+208
-15
lines changed

api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,35 @@ public string SocialClubName
12501250
}
12511251
}
12521252

1253+
public string CloudAuthHash
1254+
{
1255+
get
1256+
{
1257+
lock (Player)
1258+
{
1259+
if (!AsyncContext.CheckIfExistsOrCachedNullable(Player)) return default;
1260+
return Player.CloudAuthHash;
1261+
}
1262+
}
1263+
}
1264+
public ushort GetAmmo(uint ammoHash)
1265+
{
1266+
lock (Player)
1267+
{
1268+
if (!AsyncContext.CheckIfExistsNullable(Player)) return default;
1269+
return Player.GetAmmo(ammoHash);
1270+
}
1271+
}
1272+
1273+
public ushort GetWeaponAmmo(uint weaponHash)
1274+
{
1275+
lock (Player)
1276+
{
1277+
if (!AsyncContext.CheckIfExistsNullable(Player)) return default;
1278+
return Player.GetWeaponAmmo(weaponHash);
1279+
}
1280+
}
1281+
12531282
[Obsolete("Use new async API instead")]
12541283
public IPlayer ToAsync(IAsyncContext asyncContext)
12551284
{

api/AltV.Net.CApi.Generator/TypeRegistry.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public static class TypeRegistry
197197
{ "alt::IConnectionInfo*", "IntPtr" },
198198
{ "ClrVehicleModelInfo*", "nint" },
199199
{ "ClrPedModelInfo*", "nint" },
200+
{ "ClrWeaponModelInfo*", "nint" },
200201
{ "ClrDiscordUser*", "nint" },
201202
{ "ClrConfigNodeData*", "nint" }
202203
};

api/AltV.Net.CApi/Events/Events.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ namespace AltV.Net.CApi.ClientEvents
6262
public delegate void DiscordOAuth2TokenResultModuleDelegate(bool success, string token);
6363

6464
public delegate void WeaponDamageModuleDelegate(IntPtr eventPointer, IntPtr entityPointer,
65-
BaseObjectType entityType, uint weapon, ushort damage, Position shotOffset, BodyPart bodyPart);
65+
BaseObjectType entityType, uint weapon, ushort damage, Position shotOffset, BodyPart bodyPart, IntPtr sourceEntityPointer,
66+
BaseObjectType sourceEntityType);
6667

6768
public delegate void CreateBaseObjectModuleDelegate(IntPtr baseObject, BaseObjectType type, uint id);
6869

@@ -72,4 +73,10 @@ public delegate void ColShapeModuleDelegate(IntPtr colShapePointer, IntPtr targe
7273
bool state);
7374
public delegate void CheckpointModuleDelegate(IntPtr colShapePointer, IntPtr targetEntityPointer, BaseObjectType entityType,
7475
bool state);
76+
77+
public delegate void EntityHitEntityDelegate(IntPtr targetPointer, BaseObjectType targetType, IntPtr damagerPointer,
78+
BaseObjectType damagerType, uint weaponHash);
79+
80+
public delegate void PlayerStartEnterVehicleDelegate(IntPtr targetPointer, IntPtr player, byte seat);
81+
public delegate void PlayerStartLeaveVehicleDelegate(IntPtr targetPointer, IntPtr player, byte seat);
7582
}

api/AltV.Net.CApi/Libraries/ClientLibrary.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ public unsafe interface IClientLibrary
211211
public delegate* unmanaged[Cdecl]<nint, ClientEvents.ConnectionCompleteModuleDelegate, void> Event_SetConnectionCompleteDelegate { get; }
212212
public delegate* unmanaged[Cdecl]<nint, ClientEvents.ConsoleCommandModuleDelegate, void> Event_SetConsoleCommandDelegate { get; }
213213
public delegate* unmanaged[Cdecl]<nint, ClientEvents.CreateBaseObjectModuleDelegate, void> Event_SetCreateBaseObjectDelegate { get; }
214+
public delegate* unmanaged[Cdecl]<nint, ClientEvents.EntityHitEntityDelegate, void> Event_SetEntityHitEntityDelegate { get; }
214215
public delegate* unmanaged[Cdecl]<nint, ClientEvents.GameEntityCreateModuleDelegate, void> Event_SetGameEntityCreateDelegate { get; }
215216
public delegate* unmanaged[Cdecl]<nint, ClientEvents.GameEntityDestroyModuleDelegate, void> Event_SetGameEntityDestroyDelegate { get; }
216217
public delegate* unmanaged[Cdecl]<nint, ClientEvents.GlobalMetaChangeModuleDelegate, void> Event_SetGlobalMetaChangeDelegate { get; }
@@ -227,6 +228,8 @@ public unsafe interface IClientLibrary
227228
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerEnterVehicleModuleDelegate, void> Event_SetPlayerEnterVehicleDelegate { get; }
228229
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerLeaveVehicleModuleDelegate, void> Event_SetPlayerLeaveVehicleDelegate { get; }
229230
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerSpawnModuleDelegate, void> Event_SetPlayerSpawnDelegate { get; }
231+
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerStartEnterVehicleDelegate, void> Event_SetPlayerStartEnterVehicleDelegate { get; }
232+
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerStartLeaveVehicleDelegate, void> Event_SetPlayerStartLeaveVehicleDelegate { get; }
230233
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerWeaponChangeModuleDelegate, void> Event_SetPlayerWeaponChangeDelegate { get; }
231234
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerWeaponShootModuleDelegate, void> Event_SetPlayerWeaponShootDelegate { get; }
232235
public delegate* unmanaged[Cdecl]<nint, ClientEvents.RemoveBaseObjectModuleDelegate, void> Event_SetRemoveBaseObjectDelegate { get; }
@@ -811,7 +814,7 @@ public unsafe interface IClientLibrary
811814

812815
public unsafe class ClientLibrary : IClientLibrary
813816
{
814-
public readonly uint Methods = 1523;
817+
public readonly uint Methods = 1531;
815818
public delegate* unmanaged[Cdecl]<nint, nint, void> Audio_AddOutput_Entity { get; }
816819
public delegate* unmanaged[Cdecl]<nint, uint, void> Audio_AddOutput_ScriptId { get; }
817820
public delegate* unmanaged[Cdecl]<nint, nint> Audio_GetBaseObject { get; }
@@ -1013,6 +1016,7 @@ public unsafe class ClientLibrary : IClientLibrary
10131016
public delegate* unmanaged[Cdecl]<nint, ClientEvents.ConnectionCompleteModuleDelegate, void> Event_SetConnectionCompleteDelegate { get; }
10141017
public delegate* unmanaged[Cdecl]<nint, ClientEvents.ConsoleCommandModuleDelegate, void> Event_SetConsoleCommandDelegate { get; }
10151018
public delegate* unmanaged[Cdecl]<nint, ClientEvents.CreateBaseObjectModuleDelegate, void> Event_SetCreateBaseObjectDelegate { get; }
1019+
public delegate* unmanaged[Cdecl]<nint, ClientEvents.EntityHitEntityDelegate, void> Event_SetEntityHitEntityDelegate { get; }
10161020
public delegate* unmanaged[Cdecl]<nint, ClientEvents.GameEntityCreateModuleDelegate, void> Event_SetGameEntityCreateDelegate { get; }
10171021
public delegate* unmanaged[Cdecl]<nint, ClientEvents.GameEntityDestroyModuleDelegate, void> Event_SetGameEntityDestroyDelegate { get; }
10181022
public delegate* unmanaged[Cdecl]<nint, ClientEvents.GlobalMetaChangeModuleDelegate, void> Event_SetGlobalMetaChangeDelegate { get; }
@@ -1029,6 +1033,8 @@ public unsafe class ClientLibrary : IClientLibrary
10291033
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerEnterVehicleModuleDelegate, void> Event_SetPlayerEnterVehicleDelegate { get; }
10301034
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerLeaveVehicleModuleDelegate, void> Event_SetPlayerLeaveVehicleDelegate { get; }
10311035
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerSpawnModuleDelegate, void> Event_SetPlayerSpawnDelegate { get; }
1036+
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerStartEnterVehicleDelegate, void> Event_SetPlayerStartEnterVehicleDelegate { get; }
1037+
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerStartLeaveVehicleDelegate, void> Event_SetPlayerStartLeaveVehicleDelegate { get; }
10321038
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerWeaponChangeModuleDelegate, void> Event_SetPlayerWeaponChangeDelegate { get; }
10331039
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerWeaponShootModuleDelegate, void> Event_SetPlayerWeaponShootDelegate { get; }
10341040
public delegate* unmanaged[Cdecl]<nint, ClientEvents.RemoveBaseObjectModuleDelegate, void> Event_SetRemoveBaseObjectDelegate { get; }
@@ -2011,6 +2017,8 @@ public unsafe class ClientLibrary : IClientLibrary
20112017
private static void Event_SetConsoleCommandDelegateFallback(nint _resource, ClientEvents.ConsoleCommandModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetConsoleCommandDelegate", "Event_SetConsoleCommandDelegate SDK method is outdated. Please update your module nuget");
20122018
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetCreateBaseObjectDelegateDelegate(nint _resource, ClientEvents.CreateBaseObjectModuleDelegate _delegate);
20132019
private static void Event_SetCreateBaseObjectDelegateFallback(nint _resource, ClientEvents.CreateBaseObjectModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetCreateBaseObjectDelegate", "Event_SetCreateBaseObjectDelegate SDK method is outdated. Please update your module nuget");
2020+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetEntityHitEntityDelegateDelegate(nint _resource, ClientEvents.EntityHitEntityDelegate _delegate);
2021+
private static void Event_SetEntityHitEntityDelegateFallback(nint _resource, ClientEvents.EntityHitEntityDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetEntityHitEntityDelegate", "Event_SetEntityHitEntityDelegate SDK method is outdated. Please update your module nuget");
20142022
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetGameEntityCreateDelegateDelegate(nint _resource, ClientEvents.GameEntityCreateModuleDelegate _delegate);
20152023
private static void Event_SetGameEntityCreateDelegateFallback(nint _resource, ClientEvents.GameEntityCreateModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetGameEntityCreateDelegate", "Event_SetGameEntityCreateDelegate SDK method is outdated. Please update your module nuget");
20162024
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetGameEntityDestroyDelegateDelegate(nint _resource, ClientEvents.GameEntityDestroyModuleDelegate _delegate);
@@ -2043,6 +2051,10 @@ public unsafe class ClientLibrary : IClientLibrary
20432051
private static void Event_SetPlayerLeaveVehicleDelegateFallback(nint _resource, ClientEvents.PlayerLeaveVehicleModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerLeaveVehicleDelegate", "Event_SetPlayerLeaveVehicleDelegate SDK method is outdated. Please update your module nuget");
20442052
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerSpawnDelegateDelegate(nint _resource, ClientEvents.PlayerSpawnModuleDelegate _delegate);
20452053
private static void Event_SetPlayerSpawnDelegateFallback(nint _resource, ClientEvents.PlayerSpawnModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerSpawnDelegate", "Event_SetPlayerSpawnDelegate SDK method is outdated. Please update your module nuget");
2054+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerStartEnterVehicleDelegateDelegate(nint _resource, ClientEvents.PlayerStartEnterVehicleDelegate _delegate);
2055+
private static void Event_SetPlayerStartEnterVehicleDelegateFallback(nint _resource, ClientEvents.PlayerStartEnterVehicleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerStartEnterVehicleDelegate", "Event_SetPlayerStartEnterVehicleDelegate SDK method is outdated. Please update your module nuget");
2056+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerStartLeaveVehicleDelegateDelegate(nint _resource, ClientEvents.PlayerStartLeaveVehicleDelegate _delegate);
2057+
private static void Event_SetPlayerStartLeaveVehicleDelegateFallback(nint _resource, ClientEvents.PlayerStartLeaveVehicleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerStartLeaveVehicleDelegate", "Event_SetPlayerStartLeaveVehicleDelegate SDK method is outdated. Please update your module nuget");
20462058
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerWeaponChangeDelegateDelegate(nint _resource, ClientEvents.PlayerWeaponChangeModuleDelegate _delegate);
20472059
private static void Event_SetPlayerWeaponChangeDelegateFallback(nint _resource, ClientEvents.PlayerWeaponChangeModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerWeaponChangeDelegate", "Event_SetPlayerWeaponChangeDelegate SDK method is outdated. Please update your module nuget");
20482060
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerWeaponShootDelegateDelegate(nint _resource, ClientEvents.PlayerWeaponShootModuleDelegate _delegate);
@@ -3212,7 +3224,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
32123224
public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
32133225
{
32143226
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
3215-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 256916740904720869UL) Outdated = true;
3227+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13481148516987167850UL) Outdated = true;
32163228
Audio_AddOutput_Entity = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<Audio_AddOutput_EntityDelegate>(funcTable, 9879036518735269522UL, Audio_AddOutput_EntityFallback);
32173229
Audio_AddOutput_ScriptId = (delegate* unmanaged[Cdecl]<nint, uint, void>) GetUnmanagedPtr<Audio_AddOutput_ScriptIdDelegate>(funcTable, 14116998947805478300UL, Audio_AddOutput_ScriptIdFallback);
32183230
Audio_GetBaseObject = (delegate* unmanaged[Cdecl]<nint, nint>) GetUnmanagedPtr<Audio_GetBaseObjectDelegate>(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback);
@@ -3414,6 +3426,7 @@ public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
34143426
Event_SetConnectionCompleteDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.ConnectionCompleteModuleDelegate, void>) GetUnmanagedPtr<Event_SetConnectionCompleteDelegateDelegate>(funcTable, 12310767706503758111UL, Event_SetConnectionCompleteDelegateFallback);
34153427
Event_SetConsoleCommandDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.ConsoleCommandModuleDelegate, void>) GetUnmanagedPtr<Event_SetConsoleCommandDelegateDelegate>(funcTable, 11736526557039894433UL, Event_SetConsoleCommandDelegateFallback);
34163428
Event_SetCreateBaseObjectDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.CreateBaseObjectModuleDelegate, void>) GetUnmanagedPtr<Event_SetCreateBaseObjectDelegateDelegate>(funcTable, 3079581392961204745UL, Event_SetCreateBaseObjectDelegateFallback);
3429+
Event_SetEntityHitEntityDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.EntityHitEntityDelegate, void>) GetUnmanagedPtr<Event_SetEntityHitEntityDelegateDelegate>(funcTable, 13265843651210135853UL, Event_SetEntityHitEntityDelegateFallback);
34173430
Event_SetGameEntityCreateDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.GameEntityCreateModuleDelegate, void>) GetUnmanagedPtr<Event_SetGameEntityCreateDelegateDelegate>(funcTable, 8846162864874241135UL, Event_SetGameEntityCreateDelegateFallback);
34183431
Event_SetGameEntityDestroyDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.GameEntityDestroyModuleDelegate, void>) GetUnmanagedPtr<Event_SetGameEntityDestroyDelegateDelegate>(funcTable, 16291703028607344173UL, Event_SetGameEntityDestroyDelegateFallback);
34193432
Event_SetGlobalMetaChangeDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.GlobalMetaChangeModuleDelegate, void>) GetUnmanagedPtr<Event_SetGlobalMetaChangeDelegateDelegate>(funcTable, 263634197021329745UL, Event_SetGlobalMetaChangeDelegateFallback);
@@ -3430,6 +3443,8 @@ public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
34303443
Event_SetPlayerEnterVehicleDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerEnterVehicleModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerEnterVehicleDelegateDelegate>(funcTable, 16259534399403863387UL, Event_SetPlayerEnterVehicleDelegateFallback);
34313444
Event_SetPlayerLeaveVehicleDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerLeaveVehicleModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerLeaveVehicleDelegateDelegate>(funcTable, 10354256863799375649UL, Event_SetPlayerLeaveVehicleDelegateFallback);
34323445
Event_SetPlayerSpawnDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerSpawnModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerSpawnDelegateDelegate>(funcTable, 2502988276907442605UL, Event_SetPlayerSpawnDelegateFallback);
3446+
Event_SetPlayerStartEnterVehicleDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerStartEnterVehicleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerStartEnterVehicleDelegateDelegate>(funcTable, 13116291416409087561UL, Event_SetPlayerStartEnterVehicleDelegateFallback);
3447+
Event_SetPlayerStartLeaveVehicleDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerStartLeaveVehicleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerStartLeaveVehicleDelegateDelegate>(funcTable, 11452532921187005081UL, Event_SetPlayerStartLeaveVehicleDelegateFallback);
34333448
Event_SetPlayerWeaponChangeDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerWeaponChangeModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerWeaponChangeDelegateDelegate>(funcTable, 5096554163307275927UL, Event_SetPlayerWeaponChangeDelegateFallback);
34343449
Event_SetPlayerWeaponShootDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerWeaponShootModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerWeaponShootDelegateDelegate>(funcTable, 12142428092035142689UL, Event_SetPlayerWeaponShootDelegateFallback);
34353450
Event_SetRemoveBaseObjectDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.RemoveBaseObjectModuleDelegate, void>) GetUnmanagedPtr<Event_SetRemoveBaseObjectDelegateDelegate>(funcTable, 8121512912272945641UL, Event_SetRemoveBaseObjectDelegateFallback);

0 commit comments

Comments
 (0)