added drivingschool point + checkpoints for route

This commit is contained in:
2019-09-17 21:41:06 +02:00
parent 331141d6bb
commit e62ca95f4d
5 changed files with 190 additions and 1 deletions

View File

@@ -163,4 +163,7 @@ import checkpointHandle from './util/checkpoint';
checkpointHandle(globalData); checkpointHandle(globalData);
import busRouteList from './Jobs/BusRouteSelect'; import busRouteList from './Jobs/BusRouteSelect';
busRouteList(globalData); busRouteList(globalData);
import drivingSchoolHandle from './util/drivingschool';
drivingSchoolHandle(globalData);

View File

@@ -0,0 +1,63 @@
import * as NativeUI from 'NativeUI';
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const ListItem = NativeUI.ListItem;
export default function drivingSchoolHandle(globalData: GlobalData) {
var keyBound = false;
var mainMenu: NativeUI.Menu;
let send = new UIMenuItem("Pruefung starten", "");
var timer;
mp.events.add('drivingSchoolMenu', () => {
mp.game.ui.setTextComponentFormat('STRING');
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Fahrschulmenü zu öffnen');
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
mp.keys.bind(0x45, false, keyPressHandler);
keyBound = true;
});
mp.events.add('removeDrivingSchoolMenu', (unbind) => {
mp.game.ui.clearHelp(true);
mp.gui.chat.show(true);
if (keyBound && unbind) {
if (mainMenu) mainMenu.Close();
mp.keys.unbind(0x45, false, keyPressHandler);
keyBound = false;
}
});
mp.events.add('waitPlayerEntersVehicle', () => {
mp.game.ui.setNewWaypoint(-761.9943, -1321.84);
timer = setInterval(timerFunc, 3000);
});
mp.events.add('stopTimer', () => {
clearInterval(timer);
});
function timerFunc() {
mp.gui.chat.push("wait");
mp.events.callRemote('timerCheckVehicle');
};
function keyPressHandler() {
if (globalData.InChat || globalData.InInput || globalData.InMenu) return;
mp.events.call('removeDrivingSchoolMenu', false);
mp.events.callRemote('startDrivingSchool');
}
}

View File

@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.Text;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Services;
using System.Linq;
using GTANetworkAPI;
namespace ReallifeGamemode.Server.DrivingSchool
{
class DrivingSchool : Script
{
private static TextLabel informationLabel;
private static Marker marker;
private static ColShape _colShape;
public static Vector3 Position { get; }
private readonly IReadOnlyCollection<Vector3> DrivingRoute = new List<Vector3>
{
//BEGIN
new Vector3(-745.6191, -1285.735, 4.947221),
new Vector3(-704.5242, -1246.765, 9.885977),
new Vector3(-669.0187, -1277.192, 10.29253),
new Vector3(-646.1747, -1293.238, 10.28384),
new Vector3(-510.7098, -916.9164, 25.10735),
new Vector3(-492.6284, -860.5167, 29.89526),
new Vector3(17.09636, -973.2763, 29.01929),
new Vector3(76.66012, -999.568, 28.97918),
//SLALOM
new Vector3(-14.43704, -1719.955, 28.98133),
new Vector3(-12.64976, -1751.287, 28.91913),
new Vector3(6.008641, -1767.067, 28.91265),
new Vector3(12.80635, -1752.094, 28.91877),
new Vector3(26.71735, -1747.96, 28.92006),
new Vector3(28.67053, -1733.492, 28.91953),
new Vector3(42.68731, -1728.767, 28.92002),
new Vector3(44.33229, -1714.426, 28.9193),
new Vector3(37.25899, -1723.924, 28.92041),
new Vector3(34.591, -1738.211, 28.92125),
new Vector3(21.28996, -1742.563, 28.91987),
new Vector3(18.46534, -1756.87, 28.92011),
new Vector3(4.841759, -1761.316, 28.91519),
new Vector3(44.69115, -1805.247, 25.07369),
new Vector3(111.6519, -1822.466, 26.03703),
//SCHROTTPLATZ
new Vector3(-394.8713, -1734.21, 19.23653),
new Vector3(-468.9609, -1687.248, 18.56528),
new Vector3(-475.5448, -1670.373, -18.34653),
new Vector3(-453.5338, -1665.695, 18.64714),
new Vector3(-449.6863, -1680.451, 18.66275),
new Vector3(-467.9489, -1728.37, 18.27419),
new Vector3(-520.4453, -1703.146, 18.80065),
new Vector3(-522.3558, -1680.122, 18.88261),
new Vector3(-509.998, -1691.828, 18.91303),
new Vector3(-526.3292, -1685.291, 18.83323),
new Vector3(-551.9138, -1651.865, 18.81676),
new Vector3(-520.2884, -1632.388, 17.41465),
new Vector3(-491.7721, -1648.275, 17.43219),
new Vector3(-550.9622, -1662.636, 18.82121),
new Vector3(-496.3094, -1736.833, 18.33857),
new Vector3(-417.4822, -1712.987, 19.10845),
//ENDE
new Vector3(-498.1252, -1879.154, 17.22348),
new Vector3(-754.5391, -1300.816, 4.617907)
}.AsReadOnly();
public static void Setup()
{
informationLabel = NAPI.TextLabel.CreateTextLabel("Fahrschule", new Vector3(-815.8334, -1346.405, 5.150263), 20.0f, 1.3f, 0, new Color(255, 255, 255));
marker = NAPI.Marker.CreateMarker(434, new Vector3(-815.8334, -1346.405, 5.150263), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255));
_colShape = NAPI.ColShape.CreateSphereColShape(new Vector3(-815.8334, -1346.405, 5.150263), 3f);
_colShape.OnEntityEnterColShape += EntityEnterBusinessColShape;
_colShape.OnEntityExitColShape += EntityExitBusinessColShape;
}
private static void EntityEnterBusinessColShape(ColShape colShape, Client client)
{
if (client.IsInVehicle || !client.IsLoggedIn()) return;
client.TriggerEvent("drivingSchoolMenu");
//client.TriggerEvent("SERVER:Business_ShowMenuHelp");
}
private static void EntityExitBusinessColShape(ColShape colShape, Client client)
{
client.TriggerEvent("removeDrivingSchoolMenu");
//client.TriggerEvent("SERVER:Business_RemoveHelp", true);
}
[RemoteEvent("startDrivingSchool")]
public void StartDrivingSchool(Client user)
{
ChatService.SendMessage(user, "Du hast die Führerscheinprüfung gestartet.");
ChatService.SendMessage(user, "Steige nun in eines der Fahrschulautos");
user.TriggerEvent("waitPlayerEntersVehicle");
}
[RemoteEvent("timerCheckVehicle")]
public void TimerCheckVehicle(Client user)
{
Vehicle veh = user.Vehicle;
if (veh == null || veh.DisplayName != "Buffalo")
{
return;
} else
{
ChatService.SendMessage(user, "Gut nun kann die Prüfung losgehen");
user.TriggerEvent("stopTimer");
CheckPointHandle.StartCheckPointRoute(user, DrivingRoute, 0, 1);
}
}
}
}

View File

@@ -6,6 +6,7 @@ using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Wanted; using ReallifeGamemode.Server.Wanted;
using ReallifeGamemode.Server.DrivingSchool;
/** /**
* @overview Life of German Reallife - Main Class (Main.cs) * @overview Life of German Reallife - Main Class (Main.cs)
@@ -58,6 +59,7 @@ namespace ReallifeGamemode.Server
CityHallManager.LoadCityHall(); CityHallManager.LoadCityHall();
JobManager.LoadJobs(); JobManager.LoadJobs();
HouseManager.LoadHouses(); HouseManager.LoadHouses();
DrivingSchool.DrivingSchool.Setup();
TempBlip tempBlip = new TempBlip() TempBlip tempBlip = new TempBlip()

View File

@@ -41,6 +41,7 @@ namespace ReallifeGamemode.Server.Util
} }
} }
temp.NextCheckpoint(); temp.NextCheckpoint();
} }
} }