using System; using System.Collections.Generic; using System.Text; using RAGE; namespace ReallifeGamemode.Client.Jobs.BusDriver { public class Main : Events.Script { public static CheckpointInstance NextObjective { get; set; } = null; public static int tick = 0; public static int around_one_sec = 80; public static bool check_for_key_press = true; public Main() { Chat.Output("Loaded Clientside"); Events.Add("load_objective", LoadObjective); Events.Add("clear_all_markers", ClearJobCheckPoints); Events.Tick += OnUpdate; } private void OnUpdate(List nametags) { tick++; if (tick >= around_one_sec) { HeartBeat(); } } public void HeartBeat() { tick = 0; check_for_key_press = true; if (NextObjective != null) { CheckpointInstance checkpointInstance = CheckpointHelper.IsNearCheckpoint(3f); if (checkpointInstance != null) { NextObjective = null; CheckpointHelper.ClearCheckpoint(checkpointInstance); Events.CallRemote("marker_completed"); } } } public static void ClearJobCheckPoints(object[] args) { CheckpointHelper.ClearAllCheckpoints(); } public static void LoadObjective(object[] args) { Vector3 markerPosition = (Vector3)args[0]; float markerSize = Convert.ToSingle(args[1]); if (markerPosition == null) return; if (NextObjective != null) { CheckpointHelper.ClearCheckpoint(NextObjective); } NextObjective = new CheckpointInstance(markerPosition, markerSize); } } }