für siga
This commit is contained in:
@@ -166,4 +166,7 @@ import busRouteList from './Jobs/BusRouteSelect';
|
||||
busRouteList(globalData);
|
||||
|
||||
import drivingSchoolHandle from './util/drivingschool';
|
||||
drivingSchoolHandle(globalData);
|
||||
drivingSchoolHandle(globalData);
|
||||
|
||||
import notificationUtil from './util/notification';
|
||||
notificationUtil();
|
||||
@@ -11,20 +11,25 @@ export default function checkpointHandle(globalData: GlobalData) {
|
||||
var delay;
|
||||
var delayCounter;
|
||||
var markerID;
|
||||
var event;
|
||||
var checkPointsDone = 0;
|
||||
|
||||
mp.events.add('setCheckPoint', (position, player, nDelay, nMarkerID) => {
|
||||
mp.events.add('setCheckPoint', (position, player, checkPointID, nDelay, nMarkerID, nEvent) => {
|
||||
inCheckpoint = false;
|
||||
posCp = position;
|
||||
Player = player;
|
||||
delay = nDelay;
|
||||
markerID = nMarkerID;
|
||||
delayCounter = 0;
|
||||
checkPointsDone = checkPointID;
|
||||
event = nEvent;
|
||||
activeCheckpoint = mp.markers.new(markerID, posCp, 3.0, {
|
||||
color: [255, 0, 0, 150],
|
||||
visible: true,
|
||||
dimension: 0
|
||||
});
|
||||
|
||||
clearInterval(myVar);
|
||||
//mp.events.call("SERVER:Util_setWaypoint", posCp.X, posCp.Z);
|
||||
mp.game.ui.setNewWaypoint(posCp.x, posCp.y);
|
||||
myVar = setInterval(myTimer, 100);
|
||||
@@ -47,6 +52,12 @@ export default function checkpointHandle(globalData: GlobalData) {
|
||||
activeCheckpoint.visible = false;
|
||||
clearInterval(myVar);
|
||||
mp.events.callRemote("playerInCheckpoint");
|
||||
if (event != "") {
|
||||
while (checkPointsDone > 10000) {
|
||||
|
||||
}
|
||||
mp.events.callRemote(event, checkPointsDone);
|
||||
}
|
||||
} else {
|
||||
delayCounter += 100;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,13 @@ export default function drivingSchoolHandle(globalData: GlobalData) {
|
||||
var mainMenu: NativeUI.Menu;
|
||||
let send = new UIMenuItem("Pruefung starten", "");
|
||||
var timer;
|
||||
var timerCheckpoint;
|
||||
var timerSet = false;
|
||||
var Player;
|
||||
var timeToWait = 0;
|
||||
var checkPoint;
|
||||
var counter = 0;
|
||||
var waitFinished = false;
|
||||
|
||||
mp.events.add('drivingSchoolMenu', () => {
|
||||
mp.game.ui.setTextComponentFormat('STRING');
|
||||
@@ -40,18 +47,78 @@ export default function drivingSchoolHandle(globalData: GlobalData) {
|
||||
|
||||
mp.events.add('waitPlayerEntersVehicle', () => {
|
||||
mp.game.ui.setNewWaypoint(-761.9943, -1321.84);
|
||||
timer = setInterval(timerFunc, 3000);
|
||||
timerSet = true;
|
||||
timer = setInterval(timerPlayerInVehicle, 3000);
|
||||
});
|
||||
|
||||
|
||||
mp.events.add('stopTimer', () => {
|
||||
timerSet = false;
|
||||
clearInterval(timer);
|
||||
});
|
||||
});
|
||||
|
||||
mp.events.add('waitHere', (player, CP, time) => {
|
||||
let dist;
|
||||
waitFinished = false;
|
||||
timeToWait = time;
|
||||
Player = player;
|
||||
checkPoint = CP;
|
||||
let counter = 0;
|
||||
clearInterval(timerCheckpoint);
|
||||
counter = 0;
|
||||
timerCheckpoint = setInterval(timerWaitHere, 100);
|
||||
|
||||
});
|
||||
|
||||
function timerFunc() {
|
||||
mp.gui.chat.push("wait");
|
||||
mp.events.callRemote('timerCheckVehicle');
|
||||
mp.events.add('checkWait', () => {
|
||||
if (waitFinished == false) {
|
||||
mp.gui.chat.push("Du hast an der letzten Kreuzung nicht gewartet");
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('lookDirection', (direction, angle1, angle2) => {
|
||||
let player = mp.players.local;
|
||||
|
||||
let camera = mp.cameras.new("gameplay");
|
||||
var dir = camera.getDirection();
|
||||
//0.74850505590443884 0.093938655593395233
|
||||
if (!(dir.x <= angle1 && dir.x >= angle2)) {
|
||||
mp.gui.chat.push("Du hast nicht nach " + direction + " geschaut!");
|
||||
}
|
||||
//0.38181596994400024 0.9669561386108398
|
||||
});
|
||||
|
||||
mp.events.add('lookDirectionTesting', (veh) => {
|
||||
let player = mp.players.local;
|
||||
let camera = mp.cameras.new("gameplay");
|
||||
var dir = camera.getDirection();
|
||||
|
||||
|
||||
mp.gui.chat.push("x: " + veh.rotation.x + " | y: " + veh.rotation.y + " |z: " + veh.rotation.z);
|
||||
});
|
||||
|
||||
function timerWaitHere() {
|
||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(Player.position.x, Player.position.y, 0, checkPoint.x, checkPoint.y, 0, false);
|
||||
|
||||
if (dist <= 2) {
|
||||
counter += 100;
|
||||
} else {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
if (counter >= timeToWait) {
|
||||
mp.gui.chat.push("Gut, fahre nun weiter.");
|
||||
waitFinished = true;
|
||||
clearInterval(timerCheckpoint);
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function timerPlayerInVehicle() {
|
||||
if (timerSet) {
|
||||
mp.events.callRemote('timerCheckVehicle');
|
||||
}
|
||||
};
|
||||
|
||||
function keyPressHandler() {
|
||||
|
||||
6
ReallifeGamemode.Client/util/notification.ts
Normal file
6
ReallifeGamemode.Client/util/notification.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default function notificationUtil() {
|
||||
mp.events.add("SERVER:Util_sendNotification", (player, text) => {
|
||||
mp.gui.chat.push("sendnotification");
|
||||
player.SendNotification("" + text);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user