Skip to content

Commit

Permalink
feat(server): add exception when more then 4 batch positions setted
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Dec 26, 2023
1 parent ac4fbbf commit 02fb296
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api/AltV.Net/Elements/Entities/IVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,22 @@ NumberPlateStyle GetNumberPlateStyleExt() =>

List<PlayerSeat> Passengers { get; }

/// <summary>
/// Set badges to vehicle
/// </summary>
/// <param name="textureDictionary">The hash of textureDictionary</param>
/// <param name="texture">The hash of texture</param>
/// <param name="vehicleBadgePosition">The array of badge position. Maximum is 4</param>
/// <exception cref="ArgumentOutOfRangeException">When badge postion is more the 4</exception>
void SetBage(string textureDictionary, string texture, VehicleBadgePosition[] vehicleBadgePosition);

/// <summary>
/// Set badges to vehicle
/// </summary>
/// <param name="textureDictionary">The hash of textureDictionary</param>
/// <param name="texture">The hash of texture</param>
/// <param name="vehicleBadgePosition">The array of badge position. Maximum is 4</param>
/// <exception cref="ArgumentOutOfRangeException">When badge postion is more the 4</exception>
void SetBage(uint textureDictionary, uint texture, VehicleBadgePosition[] vehicleBadgePosition);
}
}
5 changes: 5 additions & 0 deletions api/AltV.Net/Elements/Entities/Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,11 @@ public void SetBage(string textureDictionary, string texture, VehicleBadgePositi

public void SetBage(uint textureDictionary, uint texture, VehicleBadgePosition[] vehicleBadgePosition)
{
if (vehicleBadgePosition.Length > 4)
{
throw new ArgumentOutOfRangeException(
$"{nameof(vehicleBadgePosition)} should be have maximum 4 badge positions");
}
unsafe
{
Core.Library.Server.Vehicle_SetBadge(VehicleNativePointer, textureDictionary, texture, vehicleBadgePosition, (ushort)vehicleBadgePosition.Length);
Expand Down

0 comments on commit 02fb296

Please sign in to comment.