Skip to content

Commit c09b9df

Browse files
committed
Merge remote-tracking branch 'origin/dev' into rc
# Conflicts: # runtime
2 parents a190aa2 + 5065c26 commit c09b9df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1113
-313
lines changed

api/AltV.Net.Async/AsyncCore.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public override IEnumerable<string> GetRegisteredServerEvents()
3636
}
3737

3838
internal readonly AsyncEventHandler<CheckpointAsyncDelegate> CheckpointAsyncEventHandler =
39-
new(EventType.CHECKPOINT_EVENT);
39+
new(EventType.COLSHAPE_EVENT);
4040

4141
internal readonly AsyncEventHandler<PlayerConnectAsyncDelegate> PlayerConnectAsyncEventHandler =
4242
new(EventType.PLAYER_CONNECT);
@@ -168,6 +168,9 @@ internal readonly AsyncEventHandler<PlayerChangeVehicleSeatAsyncDelegate>
168168
internal readonly AsyncEventHandler<ClientDeleteObjectAsyncEventDelegate> ClientDeleteObjectAsyncEventHandler =
169169
new(EventType.CLIENT_DELETE_OBJECT_EVENT);
170170

171+
internal readonly AsyncEventHandler<GivePedScriptedTaskAsyncDelegate> GivePedScriptedTaskAsyncEventHandler =
172+
new(EventType.GIVE_PED_SCRIPTED_TASK);
173+
171174
public AsyncCore(IntPtr nativePointer, IntPtr resourcePointer, AssemblyLoadContext assemblyLoadContext, ILibrary library, IPoolManager poolManager,
172175
INativeResourcePool nativeResourcePool) : base(nativePointer, resourcePointer, assemblyLoadContext, library, poolManager, nativeResourcePool)
173176
{
@@ -822,6 +825,17 @@ public override void OnClientDeleteObjectEvent(IntPtr eventPointer, IPlayer sour
822825
});
823826
}
824827

828+
public override void OnGivePedScriptedTaskEvent(IntPtr eventPointer, IPlayer sourcePlayer, IPed sourcePed, uint taskType)
829+
{
830+
base.OnGivePedScriptedTaskEvent(eventPointer, sourcePlayer, sourcePed, taskType);
831+
832+
if (!GivePedScriptedTaskAsyncEventHandler.HasEvents()) return;
833+
Task.Run(async () =>
834+
{
835+
await GivePedScriptedTaskAsyncEventHandler.CallAsync(@delegate => @delegate(sourcePlayer, sourcePed, taskType));
836+
});
837+
}
838+
825839
public new Function OnClient(string eventName, Function function)
826840
{
827841
if (function == null)

api/AltV.Net.Async/Events/Events.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,6 @@ public delegate Task WeaponDamageAsyncDelegate(IPlayer player, IEntity target, u
9696
public delegate Task UpdateSyncedSceneAsyncEventDelegate(IPlayer source, float startRate, int sceneId);
9797
public delegate Task ClientRequestObjectAsyncEventDelegate(IPlayer target, uint model, Position position);
9898
public delegate Task ClientDeleteObjectAsyncEventDelegate(IPlayer target);
99+
100+
public delegate Task GivePedScriptedTaskAsyncDelegate(IPlayer source, IPed target, uint taskType);
99101
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,7 @@ public delegate void PlayerBulletHitModuleDelegate(uint weapon, IntPtr victimPoi
8585
Position pos);
8686

8787
public delegate void VoiceConnectionModuleDelegate(VoiceConnectionState state);
88+
89+
public delegate void ServerScriptRPCAnswerModuleDelegate(ushort answerId, IntPtr answer,
90+
string answerError);
8891
}

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

Lines changed: 17 additions & 2 deletions
Large diffs are not rendered by default.

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

Lines changed: 22 additions & 7 deletions
Large diffs are not rendered by default.

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ public unsafe interface ISharedLibrary
188188
public delegate* unmanaged[Cdecl]<byte> Core_GetEventEnumSize { get; }
189189
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetMarkers { get; }
190190
public delegate* unmanaged[Cdecl]<nint, nint, nint> Core_GetMetaData { get; }
191+
public delegate* unmanaged[Cdecl]<nint, int> Core_GetNetTime { get; }
191192
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetNetworkObjects { get; }
192193
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetPeds { get; }
193194
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetPlayers { get; }
@@ -405,7 +406,7 @@ public unsafe interface ISharedLibrary
405406

406407
public unsafe class SharedLibrary : ISharedLibrary
407408
{
408-
public readonly uint Methods = 1715;
409+
public readonly uint Methods = 1722;
409410
public delegate* unmanaged[Cdecl]<nint, uint> Audio_GetID { get; }
410411
public delegate* unmanaged[Cdecl]<nint, uint> AudioAttachedOutput_GetID { get; }
411412
public delegate* unmanaged[Cdecl]<nint, uint> AudioFilter_GetID { get; }
@@ -584,6 +585,7 @@ public unsafe class SharedLibrary : ISharedLibrary
584585
public delegate* unmanaged[Cdecl]<byte> Core_GetEventEnumSize { get; }
585586
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetMarkers { get; }
586587
public delegate* unmanaged[Cdecl]<nint, nint, nint> Core_GetMetaData { get; }
588+
public delegate* unmanaged[Cdecl]<nint, int> Core_GetNetTime { get; }
587589
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetNetworkObjects { get; }
588590
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetPeds { get; }
589591
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetPlayers { get; }
@@ -1153,6 +1155,8 @@ public unsafe class SharedLibrary : ISharedLibrary
11531155
private static nint Core_GetMarkersFallback(nint _core, ulong* _size) => throw new Exceptions.OutdatedSdkException("Core_GetMarkers", "Core_GetMarkers SDK method is outdated. Please update your module nuget");
11541156
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetMetaDataDelegate(nint _core, nint _key);
11551157
private static nint Core_GetMetaDataFallback(nint _core, nint _key) => throw new Exceptions.OutdatedSdkException("Core_GetMetaData", "Core_GetMetaData SDK method is outdated. Please update your module nuget");
1158+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate int Core_GetNetTimeDelegate(nint _server);
1159+
private static int Core_GetNetTimeFallback(nint _server) => throw new Exceptions.OutdatedSdkException("Core_GetNetTime", "Core_GetNetTime SDK method is outdated. Please update your module nuget");
11561160
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetNetworkObjectsDelegate(nint _core, ulong* _size);
11571161
private static nint Core_GetNetworkObjectsFallback(nint _core, ulong* _size) => throw new Exceptions.OutdatedSdkException("Core_GetNetworkObjects", "Core_GetNetworkObjects SDK method is outdated. Please update your module nuget");
11581162
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetPedsDelegate(nint _core, ulong* _size);
@@ -1588,7 +1592,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
15881592
public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
15891593
{
15901594
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
1591-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 10494575567167650847UL) Outdated = true;
1595+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 10439883327927219649UL) Outdated = true;
15921596
Audio_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<Audio_GetIDDelegate>(funcTable, 4464042055475980737UL, Audio_GetIDFallback);
15931597
AudioAttachedOutput_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioAttachedOutput_GetIDDelegate>(funcTable, 17725794901805112189UL, AudioAttachedOutput_GetIDFallback);
15941598
AudioFilter_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioFilter_GetIDDelegate>(funcTable, 8824535635529306325UL, AudioFilter_GetIDFallback);
@@ -1767,6 +1771,7 @@ public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
17671771
Core_GetEventEnumSize = (delegate* unmanaged[Cdecl]<byte>) GetUnmanagedPtr<Core_GetEventEnumSizeDelegate>(funcTable, 6921054663232355759UL, Core_GetEventEnumSizeFallback);
17681772
Core_GetMarkers = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetMarkersDelegate>(funcTable, 7482854450085275693UL, Core_GetMarkersFallback);
17691773
Core_GetMetaData = (delegate* unmanaged[Cdecl]<nint, nint, nint>) GetUnmanagedPtr<Core_GetMetaDataDelegate>(funcTable, 2139798095052897524UL, Core_GetMetaDataFallback);
1774+
Core_GetNetTime = (delegate* unmanaged[Cdecl]<nint, int>) GetUnmanagedPtr<Core_GetNetTimeDelegate>(funcTable, 15652019729912249391UL, Core_GetNetTimeFallback);
17701775
Core_GetNetworkObjects = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetNetworkObjectsDelegate>(funcTable, 8454955647873390265UL, Core_GetNetworkObjectsFallback);
17711776
Core_GetPeds = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetPedsDelegate>(funcTable, 5411021830103603795UL, Core_GetPedsFallback);
17721777
Core_GetPlayers = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetPlayersDelegate>(funcTable, 6799731000550763773UL, Core_GetPlayersFallback);

api/AltV.Net.CApi/Native/AltV.Resource.cs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ internal delegate void CheckpointDelegate(IntPtr checkpointPointer, IntPtr entit
2424
BaseObjectType baseObjectType,
2525
byte state);
2626

27-
internal delegate void PlayerConnectDelegate(IntPtr playerPointer, ushort playerId, string reason);
27+
internal delegate void PlayerConnectDelegate(IntPtr playerPointer, string reason);
2828

2929
internal delegate void PlayerConnectDeniedDelegate(PlayerConnectDeniedReason reason, string name, string ip,
3030
ulong passwordHash, byte isDebug, string branch, uint majorVersion, string cdnUrl, long discordId);
3131

3232
internal delegate void ResourceEventDelegate(IntPtr resourcePointer);
3333

3434
internal delegate void PlayerDamageDelegate(IntPtr playerPointer, IntPtr attackerEntityPointer,
35-
BaseObjectType attackerBaseObjectType,
36-
ushort attackerEntityId, uint weapon, ushort healthDamage, ushort armourDamage);
35+
BaseObjectType attackerBaseObjectType, uint weapon, ushort healthDamage, ushort armourDamage);
3736

3837
internal delegate void PlayerDeathDelegate(IntPtr playerPointer, IntPtr killerEntityPointer,
3938
BaseObjectType killerBaseObjectType, uint weapon);
@@ -123,6 +122,23 @@ internal delegate void VehicleHornDelegate(IntPtr eventPointer, IntPtr targetPoi
123122

124123
internal delegate void UpdateSyncedSceneDelegate(IntPtr source, float startRate, int sceneId);
125124

125+
internal delegate void GivePedScriptedTaskDelegate(IntPtr eventPointer, IntPtr source, IntPtr target, uint taskType);
126+
127+
128+
internal delegate void PedDamageDelegate(IntPtr pedPointer, IntPtr attackerEntityPointer,
129+
BaseObjectType attackerBaseObjectType, uint weapon, ushort healthDamage, ushort armourDamage);
130+
131+
internal delegate void PedDeathDelegate(IntPtr pedPointer, IntPtr killerEntityPointer,
132+
BaseObjectType killerBaseObjectType, uint weapon);
133+
134+
internal delegate void PedHealDelegate(IntPtr pedPointer, ushort oldHealth, ushort newHealth,
135+
ushort oldArmour, ushort newArmour);
136+
137+
internal delegate void PlayerStartTalkingDelegate(IntPtr playerPointer);
138+
139+
internal delegate void PlayerStopTalkingDelegate(IntPtr playerPointer);
140+
internal delegate void ClientScriptRPCDelegate(IntPtr eventPointer, IntPtr targetPointer, string name, IntPtr args, ulong size, ushort answerId);
141+
126142

127143
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
128144
internal static extern void CSharpResourceImpl_SetMainDelegate(IntPtr resource,
@@ -319,6 +335,34 @@ internal static extern void CSharpResourceImpl_SetStopSyncedSceneDelegate(IntPtr
319335
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
320336
internal static extern void CSharpResourceImpl_SetUpdateSyncedSceneDelegate(IntPtr resource,
321337
UpdateSyncedSceneDelegate @delegate);
338+
339+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
340+
internal static extern void CSharpResourceImpl_SetGivePedScriptedTaskDelegate(IntPtr resource,
341+
GivePedScriptedTaskDelegate @delegate);
342+
343+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
344+
internal static extern void CSharpResourceImpl_SetPedDamageDelegate(IntPtr resource,
345+
PedDamageDelegate @delegate);
346+
347+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
348+
internal static extern void CSharpResourceImpl_SetPedDeathDelegate(IntPtr resource,
349+
PedDeathDelegate @delegate);
350+
351+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
352+
internal static extern void CSharpResourceImpl_SetPedHealDelegate(IntPtr resource,
353+
PedHealDelegate @delegate);
354+
355+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
356+
internal static extern void CSharpResourceImpl_SetPlayerStartTalkingDelegate(IntPtr resource,
357+
PlayerStartTalkingDelegate @delegate);
358+
359+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
360+
internal static extern void CSharpResourceImpl_SetPlayerStopTalkingDelegate(IntPtr resource,
361+
PlayerStopTalkingDelegate @delegate);
362+
363+
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
364+
internal static extern void CSharpResourceImpl_SetClientScriptRPCDelegate(IntPtr resource,
365+
ClientScriptRPCDelegate @delegate);
322366
}
323367
}
324368
}

api/AltV.Net.Client/Alt.Create.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public partial class Alt
1818
public static IRmlDocument CreateRmlDocument(string url) => Core.CreateRmlDocument(url);
1919
public static IAudio CreateAudio(string source, float volume, bool isRadio = false, string basePath = "") => Core.CreateAudio(source, volume, isRadio, basePath);
2020
public static IAudioFilter CreateAudioFilter(uint hash) => Core.CreateAudioFilter(hash);
21-
public static IAudioFrontendOutput CreateFrontendOutput(uint categoryHash) => Core.CreateFrontendOutput(categoryHash);
22-
public static IAudioWorldOutput CreateWorldOutput(uint categoryHash, Position pos) => Core.CreateWorldOutput(categoryHash, pos);
23-
public static IAudioAttachedOutput CreateAttachedOutput(uint categoryHash, IWorldObject worldObject) => Core.CreateAttachedOutput(categoryHash, worldObject);
21+
public static IAudioOutputFrontend CreateAudioOutputFrontend(uint categoryHash) => Core.CreateAudioOutputFrontend(categoryHash);
22+
public static IAudioOutputWorld CreateAudioOutputWorld(uint categoryHash, Position pos) => Core.CreateAudioOutputWorld(categoryHash, pos);
23+
public static IAudioOutputAttached CreateAudioOutputAttached(uint categoryHash, IWorldObject worldObject) => Core.CreateAudioOutputAttached(categoryHash, worldObject);
2424
public static ILocalObject CreateLocalObject(uint modelHash, Position position, Rotation rotation, bool noOffset = false, bool dynamic = false, bool useStreaming = false, uint streamingDistance = 0) => Core.CreateLocalObject(modelHash, position, rotation, noOffset, dynamic, useStreaming, streamingDistance);
2525
public static IHttpClient CreateHttpClient() => Core.CreateHttpClient();
2626
public static IWebSocketClient CreateWebSocketClient(string url) => Core.CreateWebSocketClient(url);

api/AltV.Net.Client/Alt.Events.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ public static event VoiceConnectionDelegate OnVoiceConnection
246246
remove => CoreImpl.VoiceConnectionEventHandler.Remove(value);
247247
}
248248

249+
public static event ServerScriptRPCAnswerDelegate OnServerScriptRPCAnswer
250+
{
251+
add => CoreImpl.ServerScriptRPCAnswerHandler.Add(value);
252+
remove => CoreImpl.ServerScriptRPCAnswerHandler.Remove(value);
253+
}
254+
249255
public static void OnServer(string eventName, Function function) => CoreImpl.AddServerEventListener(eventName, function);
250256

251257
public static void OnServer<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(string eventName, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> function) => CoreImpl.AddServerEventListener(eventName, Function.Create(Core, function));

api/AltV.Net.Client/Alt.Globals.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public static partial class Alt
7474
public static string GetHeadshotBase64(byte id) => Core.GetHeadshotBase64(id);
7575
public static Task<string> TakeScreenshot() => Core.TakeScreenshot();
7676
public static Task<string> TakeScreenshotGameOnly() => Core.TakeScreenshotGameOnly();
77+
public static void RegisterFont(string path) => Core.RegisterFont(path);
7778

7879
public static MapZoomData GetMapZoomData(uint id) => Core.GetMapZoomData(id);
7980
public static MapZoomData GetMapZoomData(string alias) => Core.GetMapZoomData(alias);

0 commit comments

Comments
 (0)