This commit is contained in:
2019-09-08 20:10:07 +02:00
parent aa2a2b11be
commit 165fd27076
7 changed files with 107 additions and 12 deletions

View File

@@ -0,0 +1,35 @@
import * as NativeUI from 'NativeUI';
import InputHelper from '../inputhelper';
export default function checkpointHandle(globalData: GlobalData) {
var count = 0;
var myVar;
var posCp;
var Player;
var activeCheckpoint;
var inCheckpoint = false;
mp.events.add('setCheckPoint', (position, player) => {
mp.gui.chat.push("exec");
posCp = position;
Player = player;
activeCheckpoint = mp.markers.new(1, posCp, 3.0, {
color: [255, 0, 0, 150],
visible: true,
dimension: 0
});
myVar = setInterval(myTimer, 100);
});
function myTimer() {
let dist = mp.game.gameplay.getDistanceBetweenCoords(Player.position.x, Player.position.y, 0, posCp.x, posCp.y, 0, false);
if (dist <= 2 && !inCheckpoint) {
inCheckpoint = true;
mp.events.callRemote("playerInCheckpoint");
} else if (dist > 2) {
inCheckpoint = false;
}
}
}