111 lines
3.6 KiB
C#
111 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using ReallifeGamemode.Server.Extensions;
|
|
using ReallifeGamemode.Server.Util;
|
|
using ReallifeGamemode.Server.Services;
|
|
using System.Linq;
|
|
using GTANetworkAPI;
|
|
|
|
namespace ReallifeGamemode.Server.DrivingSchool
|
|
{
|
|
class PlaneSchool : Script
|
|
{
|
|
private static TextLabel informationLabel1;
|
|
private static Marker marker1;
|
|
private static ColShape _colShape1;
|
|
public static Vector3 Position { get; }
|
|
|
|
private readonly IReadOnlyCollection<Vector3> planeRoute = new List<Vector3>
|
|
{
|
|
new Vector3(-1114.39, -2333.09, 14.87),
|
|
new Vector3(-1133.06, -2287.62, 14.89),
|
|
new Vector3(-1185.63, -2303.45, 14.86),
|
|
new Vector3(-1168.78, -2349.79, 14.88),
|
|
new Vector3(-1118.74, -2340.85, 14.87),
|
|
new Vector3(-1219.9, -2239.5, 14.87),
|
|
new Vector3(-1355.84, -2245.06, 14.87),
|
|
new Vector3(-1427.14, -2368.96, 14.87),
|
|
new Vector3(-872.5, -1820.64, 172.57),
|
|
new Vector3(786.55, 2309.85, 426.1),
|
|
new Vector3(1261.85, 3950.07, 301.3),
|
|
new Vector3(2133.83, 4803.55, 41.99),
|
|
new Vector3(2134.13, 4782.7, 41.9),
|
|
new Vector3(2098.9, 4792.94, 41.98),
|
|
new Vector3(-869.77, -1424.05, 133),
|
|
new Vector3(-1164.29, -2351.52, 14.88),
|
|
}.AsReadOnly();
|
|
|
|
public static void Setup()
|
|
{
|
|
|
|
informationLabel1 = NAPI.TextLabel.CreateTextLabel("Flugschule", new Vector3(-1083.96, -2476.96, 14.07), 20.0f, 1.3f, 0, new Color(255, 255, 255));
|
|
marker1 = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-1083.96, -2476.96, 13.07), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255));
|
|
|
|
_colShape1 = NAPI.ColShape.CreateSphereColShape(new Vector3(-1083.96, -2476.96, 14.07), 3f);
|
|
_colShape1.OnEntityEnterColShape += EntityEnterBusinessColShape;
|
|
_colShape1.OnEntityExitColShape += EntityExitBusinessColShape;
|
|
NAPI.Blip.CreateBlip(90, new Vector3(-1083.96, -2476.96, 14.07), 1.0f, 4, "Flugschule", shortRange: true);
|
|
}
|
|
private static void EntityEnterBusinessColShape(ColShape colShape, Client client)
|
|
{
|
|
if (client.IsInVehicle || !client.IsLoggedIn()) return;
|
|
|
|
client.TriggerEvent("planeSchoolMenu");
|
|
}
|
|
|
|
private static void EntityExitBusinessColShape(ColShape colShape, Client client)
|
|
{
|
|
client.TriggerEvent("removeplaneSchoolMenu");
|
|
}
|
|
|
|
[RemoteEvent("startplaneSchool")]
|
|
public void StartplaneSchool(Client user)
|
|
{
|
|
ChatService.SendMessage(user, "Du hast die Flugscheinprüfung gestartet.");
|
|
ChatService.SendMessage(user, "Steige nun in eines der Flugzeuge ein.");
|
|
|
|
user.TriggerEvent("waitPlayerEntersVehicle1");
|
|
}
|
|
|
|
[RemoteEvent("timerCheckVehicle1")]
|
|
public void TimerCheckVehicle1(Client user)
|
|
{
|
|
Vehicle veh = user.Vehicle;
|
|
|
|
if (veh == null || veh.DisplayName != "Velum")
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
ChatService.SendMessage(user, "Gut nun kann die Prüfung losgehen.");
|
|
user.TriggerEvent("stopTimer");
|
|
CheckPointHandle.StartCheckPointRoute(user, planeRoute, 0, 6, "planeSchoolEvent");
|
|
}
|
|
}
|
|
|
|
[RemoteEvent("planeSchoolEvent")]
|
|
public void planeSchoolEvent(Client user, int checkpoint)
|
|
{
|
|
if(checkpoint == 6 || checkpoint ==13)
|
|
{
|
|
ChatService.SendMessage(user, "Beschleunige um abzuheben.");
|
|
}
|
|
else if(checkpoint == 10 || checkpoint == 14)
|
|
{
|
|
ChatService.SendMessage(user, "Setze zum landeflug an.");
|
|
|
|
}
|
|
else if (checkpoint == 15)
|
|
{
|
|
ChatService.SendMessage(user, "Du hast deinen Flugschein bestanden.");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|