diff --git a/api/AltV.Net.CApi/Events/ClientEvents.cs b/api/AltV.Net.CApi/Events/ClientEvents.cs index f125a546..e4c8822a 100644 --- a/api/AltV.Net.CApi/Events/ClientEvents.cs +++ b/api/AltV.Net.CApi/Events/ClientEvents.cs @@ -19,14 +19,14 @@ namespace AltV.Net.CApi.ClientEvents public delegate void PlayerDisconnectModuleDelegate(); public delegate void PlayerEnterVehicleModuleDelegate(IntPtr baseObject, BaseObjectType type, byte seat); public delegate void PlayerLeaveVehicleModuleDelegate(IntPtr baseObject, BaseObjectType type, byte seat); - public delegate void PlayerChangeVehicleSeatModuleDelegate(IntPtr pointer, byte oldSeat, byte newSeat); - public delegate void PlayerChangeAnimationModuleDelegate(IntPtr pointer, uint oldDict, uint newDict, uint oldName, uint newName); - public delegate void PlayerChangeInteriorModuleDelegate(IntPtr pointer, uint oldIntLoc, uint newIntLoc); + public delegate void PlayerChangeVehicleSeatModuleDelegate(IntPtr pointer, BaseObjectType type, byte oldSeat, byte newSeat); + public delegate void PlayerChangeAnimationModuleDelegate(IntPtr pointer, BaseObjectType type, uint oldDict, uint newDict, uint oldName, uint newName); + public delegate void PlayerChangeInteriorModuleDelegate(IntPtr pointer, BaseObjectType type, uint oldIntLoc, uint newIntLoc); public delegate void PlayerWeaponShootModuleDelegate(uint weapon, ushort totalAmmo, ushort ammoInClip); public delegate void PlayerWeaponChangeModuleDelegate(uint oldWeapon, uint newWeapon); - public delegate void GameEntityCreateModuleDelegate(IntPtr pointer, byte type); - public delegate void GameEntityDestroyModuleDelegate(IntPtr pointer, byte type); + public delegate void GameEntityCreateModuleDelegate(IntPtr pointer, BaseObjectType type); + public delegate void GameEntityDestroyModuleDelegate(IntPtr pointer, BaseObjectType type); public delegate void AnyResourceErrorModuleDelegate(string name); public delegate void AnyResourceStartModuleDelegate(string name); @@ -78,8 +78,8 @@ public delegate void CheckpointModuleDelegate(IntPtr colShapePointer, IntPtr tar public delegate void EntityHitEntityModuleDelegate(IntPtr targetPointer, BaseObjectType targetType, IntPtr damagerPointer, BaseObjectType damagerType, uint weaponHash); - public delegate void PlayerStartEnterVehicleModuleDelegate(IntPtr targetPointer, IntPtr player, byte seat); - public delegate void PlayerStartLeaveVehicleModuleDelegate(IntPtr targetPointer, IntPtr player, byte seat); + public delegate void PlayerStartEnterVehicleModuleDelegate(IntPtr targetPointer, BaseObjectType type, IntPtr player, BaseObjectType playerType, byte seat); + public delegate void PlayerStartLeaveVehicleModuleDelegate(IntPtr targetPointer, BaseObjectType type, IntPtr player, BaseObjectType playerType, byte seat); public delegate void PlayerBulletHitModuleDelegate(uint weapon, IntPtr victimPointer, BaseObjectType victimType, Position pos); diff --git a/api/AltV.Net.Client/Core.Events.cs b/api/AltV.Net.Client/Core.Events.cs index 15273cf0..7be66dd7 100644 --- a/api/AltV.Net.Client/Core.Events.cs +++ b/api/AltV.Net.Client/Core.Events.cs @@ -261,9 +261,9 @@ public void OnPlayerEnterVehicle(IntPtr pointer, BaseObjectType type, byte seat) EnterVehicleEventHandler.GetEvents().ForEachCatching(fn => fn(vehicle, seat), $"event {nameof(OnPlayerEnterVehicle)}"); } - public void OnGameEntityCreate(IntPtr pointer, byte type) + public void OnGameEntityCreate(IntPtr pointer, BaseObjectType type) { - var baseObject = PoolManager.Get(pointer, (BaseObjectType) type); + var baseObject = PoolManager.Get(pointer, type); if (baseObject is not IEntity entity) { Console.WriteLine("Invalid entity: " + pointer + " " + (baseObject == null)); @@ -273,9 +273,9 @@ public void OnGameEntityCreate(IntPtr pointer, byte type) GameEntityCreateEventHandler.GetEvents().ForEachCatching(fn => fn(entity), $"event {nameof(OnGameEntityCreate)}"); } - public void OnGameEntityDestroy(IntPtr pointer, byte type) + public void OnGameEntityDestroy(IntPtr pointer, BaseObjectType type) { - var baseObject = PoolManager.Get(pointer, (BaseObjectType) type); + var baseObject = PoolManager.Get(pointer, type); if (baseObject is not IEntity entity) { Console.WriteLine("Invalid entity: " + pointer); @@ -339,14 +339,14 @@ public void OnGlobalSyncedMetaChange(string key, IntPtr valuePtr, IntPtr oldValu GlobalSyncedMetaChangeEventHandler.GetEvents().ForEachCatching(fn => fn(key, value.ToObject(), oldValue.ToObject()), $"event {nameof(OnGlobalSyncedMetaChange)}"); } - public void OnPlayerChangeVehicleSeat(IntPtr vehiclePtr, byte oldSeat, byte newSeat) + public void OnPlayerChangeVehicleSeat(IntPtr vehiclePtr, BaseObjectType type, byte oldSeat, byte newSeat) { - var vehicle = PoolManager.Vehicle.Get(vehiclePtr); + var vehicle = (IVehicle)PoolManager.Get(vehiclePtr, type); PlayerChangeVehicleSeatEventHandler.GetEvents().ForEachCatching(fn => fn(vehicle, oldSeat, newSeat), $"event {nameof(OnPlayerChangeVehicleSeat)}"); } - public void OnPlayerChangeAnimation(IntPtr playerPtr, uint oldDict, uint newDict, uint oldName, uint newName) + public void OnPlayerChangeAnimation(IntPtr playerPtr, BaseObjectType type, uint oldDict, uint newDict, uint oldName, uint newName) { - var player = PoolManager.Player.Get(playerPtr); + var player = (IPlayer)PoolManager.Get(playerPtr, type); if (player == null) { Alt.LogWarning("OnPlayerChangeAnimation: Invalid player " + playerPtr); @@ -356,9 +356,9 @@ public void OnPlayerChangeAnimation(IntPtr playerPtr, uint oldDict, uint newDict PlayerChangeAnimationEventHandler.GetEvents().ForEachCatching(fn => fn(player, oldDict, newDict, oldName, newName), $"event {nameof(OnPlayerChangeAnimation)}"); } - public void OnPlayerChangeInterior(IntPtr playerPtr, uint oldIntLoc, uint newIntLoc) + public void OnPlayerChangeInterior(IntPtr playerPtr, BaseObjectType type, uint oldIntLoc, uint newIntLoc) { - var player = PoolManager.Player.Get(playerPtr); + var player = (IPlayer)PoolManager.Get(playerPtr, type); if (player == null) { Alt.LogWarning("OnPlayerChangeInterior: Invalid player " + playerPtr); @@ -654,18 +654,18 @@ public void OnMetaChange(IntPtr targetPtr, BaseObjectType type, string key, IntP MetaChangeEventHandler.GetEvents().ForEachCatching(fn => fn(target, key, value.ToObject(), oldValue.ToObject()), $"event {nameof(OnMetaChange)}"); } - public void OnPlayerStartEnterVehicle(IntPtr targetpointer, IntPtr playerPointer, byte seat) + public void OnPlayerStartEnterVehicle(IntPtr targetpointer, BaseObjectType type, IntPtr playerPointer, BaseObjectType playerType, byte seat) { - var vehicle = PoolManager.Vehicle.Get(targetpointer); - var player = PoolManager.Player.Get(playerPointer); + var vehicle = (IVehicle)PoolManager.Get(targetpointer, type); + var player = (IPlayer)PoolManager.Get(playerPointer, playerType); PlayerStartEnterVehicleEventHandler.GetEvents().ForEachCatching(fn => fn(vehicle, player, seat), $"event {nameof(OnPlayerStartEnterVehicle)}"); } - public void OnPlayerStartLeaveVehicle(IntPtr targetpointer, IntPtr playerPointer, byte seat) + public void OnPlayerStartLeaveVehicle(IntPtr targetpointer, BaseObjectType type, IntPtr playerPointer, BaseObjectType playerType, byte seat) { - var vehicle = PoolManager.Vehicle.Get(targetpointer); - var player = PoolManager.Player.Get(playerPointer); + var vehicle = (IVehicle)PoolManager.Get(targetpointer, type); + var player = (IPlayer)PoolManager.Get(playerPointer, playerType); PlayerStartLeaveVehicleEventHandler.GetEvents().ForEachCatching(fn => fn(vehicle, player, seat), $"event {nameof(OnPlayerStartLeaveVehicle)}"); } diff --git a/api/AltV.Net.Client/ModuleWrapper.cs b/api/AltV.Net.Client/ModuleWrapper.cs index 572ca185..edaeccd7 100644 --- a/api/AltV.Net.Client/ModuleWrapper.cs +++ b/api/AltV.Net.Client/ModuleWrapper.cs @@ -214,12 +214,12 @@ public static void OnPlayerEnterVehicle(IntPtr pointer, BaseObjectType type, byt _core.OnPlayerEnterVehicle(pointer, type, seat); } - public static void OnGameEntityCreate(IntPtr pointer, byte type) + public static void OnGameEntityCreate(IntPtr pointer, BaseObjectType type) { _core.OnGameEntityCreate(pointer, type); } - public static void OnGameEntityDestroy(IntPtr pointer, byte type) + public static void OnGameEntityDestroy(IntPtr pointer, BaseObjectType type) { _core.OnGameEntityDestroy(pointer, type); } @@ -323,19 +323,19 @@ public static void OnConnectionComplete() _core.OnConnectionComplete(); } - public static void OnPlayerChangeVehicleSeat(IntPtr vehicle, byte oldSeat, byte newSeat) + public static void OnPlayerChangeVehicleSeat(IntPtr vehicle, BaseObjectType type, byte oldSeat, byte newSeat) { - _core.OnPlayerChangeVehicleSeat(vehicle, oldSeat, newSeat); + _core.OnPlayerChangeVehicleSeat(vehicle, type, oldSeat, newSeat); } - public static void OnPlayerChangeAnimation(IntPtr player, uint oldDict, uint newDict, uint oldName, uint newName) + public static void OnPlayerChangeAnimation(IntPtr player, BaseObjectType type, uint oldDict, uint newDict, uint oldName, uint newName) { - _core.OnPlayerChangeAnimation(player, oldDict, newDict, oldName, newName); + _core.OnPlayerChangeAnimation(player, type, oldDict, newDict, oldName, newName); } - public static void OnPlayerChangeInterior(IntPtr player, uint oldIntLoc, uint newIntLoc) + public static void OnPlayerChangeInterior(IntPtr player, BaseObjectType type, uint oldIntLoc, uint newIntLoc) { - _core.OnPlayerChangeInterior(player, oldIntLoc, newIntLoc); + _core.OnPlayerChangeInterior(player, type, oldIntLoc, newIntLoc); } public static void OnPlayerWeaponShoot(uint weapon, ushort totalAmmo, ushort ammoInClip) @@ -426,14 +426,14 @@ public static void OnMetaChange(IntPtr target, BaseObjectType type, string key, _core.OnMetaChange(target, type, key, value, oldvalue); } - public static void OnPlayerStartEnterVehicle(IntPtr targetpointer, IntPtr player, byte seat) + public static void OnPlayerStartEnterVehicle(IntPtr targetpointer, BaseObjectType type, IntPtr player, BaseObjectType playerType, byte seat) { - _core.OnPlayerStartEnterVehicle(targetpointer, player, seat); + _core.OnPlayerStartEnterVehicle(targetpointer, type, player, playerType, seat); } - public static void OnPlayerStartLeaveVehicle(IntPtr targetpointer, IntPtr player, byte seat) + public static void OnPlayerStartLeaveVehicle(IntPtr targetpointer, BaseObjectType type, IntPtr player, BaseObjectType playerType, byte seat) { - _core.OnPlayerStartLeaveVehicle(targetpointer, player, seat); + _core.OnPlayerStartLeaveVehicle(targetpointer, type, player, playerType, seat); } public static void OnEntityHitEntity(IntPtr targetpointer, BaseObjectType targettype, IntPtr damagerpointer, BaseObjectType damagertype, uint weaponhash)