using System; using System.Collections.Generic; using System.Text; using ReallifeGamemode.Server.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Util; using GTANetworkAPI; using System.Collections; using System.Linq; namespace ReallifeGamemode.Server.Util { public class CheckPointHandle : Script { public static List listHandle = new List(); public static void startCheckPointRoute(Client player, List nListCps) { checkPointListForPlayer playerHandle = new checkPointListForPlayer(player, nListCps); listHandle.Add(playerHandle); playerHandle.startRoute(); } [RemoteEvent("playerInCheckpoint")] public void playerInCheckpoint(Client user) { ChatService.Broadcast("neuer cp"); checkPointListForPlayer temp = null; for (int a = 0; a < listHandle.Count; a++) { temp = listHandle[a]; if (temp.player == user) { break; } } temp.nextCheckpoint(); } } public class checkPointListForPlayer { public List list = new List(); public Client player; Vector3 checkPoint; Boolean done; int checkPointsDone = 0; public checkPointListForPlayer(Client nPlayer, List nList) { this.player = nPlayer; this.list = nList; } public void startRoute() { player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player); } public void nextCheckpoint() { this.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); } } } }