From 6aaeb61d203ebe281b1bac4593c0c8bcd4af9f13 Mon Sep 17 00:00:00 2001 From: EntenKoeniq <81123713+EntenKoeniq@users.noreply.github.com> Date: Tue, 13 Jul 2021 08:30:10 +0200 Subject: [PATCH] Enter vehicle as passenger added --- Client/Main.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Client/Main.cs b/Client/Main.cs index 5597b34..51a5575 100644 --- a/Client/Main.cs +++ b/Client/Main.cs @@ -23,6 +23,7 @@ namespace CoopClient public static bool ShareNpcsWithPlayers = false; public static bool NpcsAllowed = false; + private static bool IsGoingToCar = false; public static Settings MainSettings = Util.ReadSettings(); public static ObjectPool MainMenuPool = new ObjectPool(); @@ -180,6 +181,11 @@ namespace CoopClient MainNetworking.ReceiveMessages(); + if (IsGoingToCar && Game.Player.Character.IsInVehicle()) + { + IsGoingToCar = false; + } + if (!MainNetworking.IsOnServer()) { return; @@ -245,6 +251,29 @@ namespace CoopClient MainPlayerList.Pressed = (time - MainPlayerList.Pressed) < 5000 ? (time - 6000) : time; } break; + case Keys.G: + if (IsGoingToCar) + { + Game.Player.Character.Task.ClearAll(); + IsGoingToCar = false; + } + else if (!Game.Player.Character.IsInVehicle()) + { + Vehicle veh = World.GetNearbyVehicles(Game.Player.Character, 5f).First(); + if (veh != null) + { + for (int i = 0; i < veh.PassengerCapacity; i++) + { + if (veh.IsSeatFree((VehicleSeat)i)) + { + Game.Player.Character.Task.EnterVehicle(veh, (VehicleSeat)i); + IsGoingToCar = true; + break; + } + } + } + } + break; } }