diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 9de6c381..eb0347cf 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -2907,7 +2907,6 @@ namespace ReallifeGamemode.Server.Commands business.Update(); return; } - break; } player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]"); diff --git a/ReallifeGamemode.Server/Job/BusDriverJob.cs b/ReallifeGamemode.Server/Job/BusDriverJob.cs index 8eee0f0b..4c76e3e1 100644 --- a/ReallifeGamemode.Server/Job/BusDriverJob.cs +++ b/ReallifeGamemode.Server/Job/BusDriverJob.cs @@ -14,6 +14,17 @@ namespace ReallifeGamemode.Server.Job public override bool NeedVehicleToStart => true; + private readonly IReadOnlyCollection list = new List + { + new Vector3(-105.5951, -1684.548, 29.23948), + new Vector3(-1056.246, -2552.576, 13.66063), + new Vector3(200.3088, -1978.828, 19.3329), + new Vector3(358.6138, -1785.821, 28.92113), + new Vector3(281.8594, -1462.503, 29.13148), + new Vector3(77.72239, -1212.086, 29.12294), + new Vector3(218.1398, -850.9549, 30.16619) + }.AsReadOnly(); + public BusDriverJob() { JobStart += BusDriverJob_JobStart; @@ -21,15 +32,7 @@ namespace ReallifeGamemode.Server.Job private void BusDriverJob_JobStart(Client player) { - List list = new List(); - list.Add(new Vector3(-105.5951, -1684.548, 29.23948)); - list.Add(new Vector3(-1056.246, -2552.576, 13.66063)); - list.Add(new Vector3(200.3088, -1978.828, 19.3329)); - list.Add(new Vector3(358.6138, -1785.821, 28.92113)); - list.Add(new Vector3(281.8594, -1462.503, 29.13148)); - list.Add(new Vector3(77.72239, -1212.086, 29.12294)); - list.Add(new Vector3(218.1398, -850.9549, 30.16619)); - CheckPointHandle.startCheckPointRoute(player, list); + CheckPointHandle.StartCheckPointRoute(player, list); } } } diff --git a/ReallifeGamemode.Server/Job/JobBase.cs b/ReallifeGamemode.Server/Job/JobBase.cs index 97d9de61..9d668f91 100644 --- a/ReallifeGamemode.Server/Job/JobBase.cs +++ b/ReallifeGamemode.Server/Job/JobBase.cs @@ -1,15 +1,9 @@ using GTANetworkAPI; using ReallifeGamemode.Server.Entities; -using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using ReallifeGamemode.Server.Util; -using System.Collections; namespace ReallifeGamemode.Server.Job { diff --git a/ReallifeGamemode.Server/Util/CheckPointHandle.cs b/ReallifeGamemode.Server/Util/CheckPointHandle.cs index 9362e030..e6f4d358 100644 --- a/ReallifeGamemode.Server/Util/CheckPointHandle.cs +++ b/ReallifeGamemode.Server/Util/CheckPointHandle.cs @@ -14,17 +14,17 @@ namespace ReallifeGamemode.Server.Util { public class CheckPointHandle : Script { - public static List listHandle = new List(); - public static void startCheckPointRoute(Client player, List nListCps) + public static List listHandle = new List(); + public static void StartCheckPointRoute(Client player, IEnumerable nListCps) { - checkPointListForPlayer playerHandle = new checkPointListForPlayer(player, nListCps); + CheckPointListForPlayer playerHandle = new CheckPointListForPlayer(player, nListCps); listHandle.Add(playerHandle); - playerHandle.startRoute(); + playerHandle.StartRoute(); } - public static void removePlayerHandlerFromList(Client player) + public static void RemovePlayerHandlerFromList(Client player) { - checkPointListForPlayer temp = null; + CheckPointListForPlayer temp = null; for (int a = 0; a < listHandle.Count; a++) { temp = listHandle[a]; @@ -36,9 +36,9 @@ namespace ReallifeGamemode.Server.Util } [RemoteEvent("playerInCheckpoint")] - public void playerInCheckpoint(Client user) + public void PlayerInCheckpoint(Client user) { - checkPointListForPlayer temp = null; + CheckPointListForPlayer temp = null; for (int a = 0; a < listHandle.Count; a++) { temp = listHandle[a]; @@ -48,43 +48,45 @@ namespace ReallifeGamemode.Server.Util } } - temp.nextCheckpoint(); + temp.NextCheckpoint(); ChatService.Broadcast("neuer cp"); } } - public class checkPointListForPlayer + + public class CheckPointListForPlayer { - public List list = new List(); + public IEnumerable list = new List(); public Client player; Vector3 checkPoint; - Boolean done; + bool done; + int checkPointsDone = 0; - public checkPointListForPlayer(Client nPlayer, List nList) + public CheckPointListForPlayer(Client nPlayer, IEnumerable nList) { this.player = nPlayer; this.list = nList; } - public void startRoute() + public void StartRoute() { player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player); } - public void nextCheckpoint() + public void NextCheckpoint() { this.checkPointsDone++; - if (this.list.Count > checkPointsDone) + if (this.list.Count() > checkPointsDone) { Vector3 nextCp = list.ElementAt(checkPointsDone); ChatService.SendMessage(this.player, "cp set at " + nextCp.ToString()); this.player.TriggerEvent("setCheckPoint", nextCp, player); } - if (this.list.Count == checkPointsDone) + if (this.list.Count() == checkPointsDone) { ChatService.SendMessage(this.player, "Du hast alle Checkpoints abgefahren!"); - CheckPointHandle.removePlayerHandlerFromList(this.player); + CheckPointHandle.RemovePlayerHandlerFromList(this.player); } } }