Skip to content
This repository was archived by the owner on Dec 25, 2022. It is now read-only.

Commit 9200722

Browse files
committed
Allow special aircraft horns on normal vehicles too as per request
1 parent b77f014 commit 9200722

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

Client/Effect/HornEffect.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public bool Expired
2626
public Task Init()
2727
{
2828
_sound = API.GetSoundId();
29+
API.SetHornEnabled(_vehicle, false);
2930
API.PlaySoundFromEntity(_sound, Vehicles.GetAircraftHorn(_vehicle), _vehicle, null, false, 0);
3031
return Task.FromResult(0);
3132
}
@@ -38,6 +39,7 @@ public void Clear()
3839
{
3940
API.StopSound(_sound);
4041
API.ReleaseSoundId(_sound);
42+
API.SetHornEnabled(_vehicle, true);
4143
}
4244

4345
public static string GetKeyFrom(int vehicle)

Client/Menus/AircraftHornMenu.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ public AircraftHornMenu() : base("PocceMod", "select horn")
2525

2626
public static void SetAircraftHorn(int horn)
2727
{
28-
var player = API.GetPlayerPed(-1);
29-
if (!API.IsPedInFlyingVehicle(player))
30-
{
31-
Common.Notification("Player is not in a flying vehicle");
32-
return;
33-
}
34-
35-
if (!Common.EnsurePlayerIsVehicleDriver(out player, out int vehicle))
28+
if (!Common.EnsurePlayerIsVehicleDriver(out int player, out int vehicle))
3629
return;
3730

3831
Vehicles.SetAircraftHorn(vehicle, horn);

Client/Vehicles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ private static Task UpdateControls()
624624
if (hasOtherDriver || MainMenu.IsOpen || API.IsEntityDead(vehicle))
625625
return Delay(100);
626626

627-
if (API.IsPedInFlyingVehicle(player) && API.DecorExistOn(vehicle, AircraftHornDecor))
627+
if (API.DecorExistOn(vehicle, AircraftHornDecor))
628628
{
629629
if (API.IsControlJustPressed(0, 86)) // INPUT_VEH_HORN
630630
{

0 commit comments

Comments
 (0)