added drivingschool point + checkpoints for route
This commit is contained in:
63
ReallifeGamemode.Client/util/drivingschool.ts
Normal file
63
ReallifeGamemode.Client/util/drivingschool.ts
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user