From 774129c01ccb97ef7746c9d95fe4d6c088439e14 Mon Sep 17 00:00:00 2001 From: Fabian Fabian Date: Thu, 12 Sep 2019 18:41:22 +0200 Subject: [PATCH] more functionality in bus system --- ReallifeGamemode.Client/util/checkpoint.ts | 1 - .../Util/CheckPointHandle.cs | 20 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Client/util/checkpoint.ts b/ReallifeGamemode.Client/util/checkpoint.ts index 46da9539..454b0746 100644 --- a/ReallifeGamemode.Client/util/checkpoint.ts +++ b/ReallifeGamemode.Client/util/checkpoint.ts @@ -10,7 +10,6 @@ export default function checkpointHandle(globalData: GlobalData) { var inCheckpoint = false; mp.events.add('setCheckPoint', (position, player) => { - mp.gui.chat.push("jaha"); inCheckpoint = false; posCp = position; Player = player; diff --git a/ReallifeGamemode.Server/Util/CheckPointHandle.cs b/ReallifeGamemode.Server/Util/CheckPointHandle.cs index f734f275..9362e030 100644 --- a/ReallifeGamemode.Server/Util/CheckPointHandle.cs +++ b/ReallifeGamemode.Server/Util/CheckPointHandle.cs @@ -22,11 +22,22 @@ namespace ReallifeGamemode.Server.Util playerHandle.startRoute(); } + public static void removePlayerHandlerFromList(Client player) + { + checkPointListForPlayer temp = null; + for (int a = 0; a < listHandle.Count; a++) + { + temp = listHandle[a]; + if (temp.player == player) + { + listHandle.Remove(temp); + } + } + } [RemoteEvent("playerInCheckpoint")] public void playerInCheckpoint(Client user) { - ChatService.Broadcast("neuer cp"); checkPointListForPlayer temp = null; for (int a = 0; a < listHandle.Count; a++) { @@ -39,6 +50,7 @@ namespace ReallifeGamemode.Server.Util temp.nextCheckpoint(); + ChatService.Broadcast("neuer cp"); } } public class checkPointListForPlayer @@ -69,7 +81,11 @@ namespace ReallifeGamemode.Server.Util ChatService.SendMessage(this.player, "cp set at " + nextCp.ToString()); this.player.TriggerEvent("setCheckPoint", nextCp, player); } - + if (this.list.Count == checkPointsDone) + { + ChatService.SendMessage(this.player, "Du hast alle Checkpoints abgefahren!"); + CheckPointHandle.removePlayerHandlerFromList(this.player); + } } } }