Ragemp-roleplay-skript/Jobs/Transporter/Transporter.js
2019-04-16 13:59:07 +02:00

83 lines
4.8 KiB
JavaScript

"use strict";
/// <reference path="../../types-gtanetwork/index.d.ts" />
var marker = null;
var player = API.getLocalPlayer();
API.onServerEventTrigger.connect(function (eventName, args) {
if (eventName == "transporterstart") {
var randommath = Math.random() * (7 - 1) + 1;
var random = Math.round(randommath);
if (random == 1) {
marker = API.createMarker(1, new Vector3(-3052.099, 596.9607, 6.44038), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setEntitySyncedData(player, "job:transporter:X", -3052.099);
API.triggerServerEvent("colwasselected", -3052.099);
API.setWaypoint(-3052.099, 596.9607);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", -3052);
}
else if (random == 2) {
marker = API.createMarker(1, new Vector3(-1376.936, -144.8066, 47.484128), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setWaypoint(-1376.936, -144.8066);
API.setEntitySyncedData(player, "job:transporter:X", -1376.936);
API.triggerServerEvent("colwasselected", -1376.936);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", -1376);
}
else if (random == 3) {
marker = API.createMarker(1, new Vector3(-728.4478, -911.282, 18.0139), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setWaypoint(-728.4478, -911.282);
API.setEntitySyncedData(player, "job:transporter:X", -728.4478);
API.triggerServerEvent("colwasselected", -728.4478);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", -728);
}
else if (random == 4) {
marker = API.createMarker(1, new Vector3(493.8185, -1002.227, 26.82701), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setWaypoint(493.8185, -1002.227);
API.setEntitySyncedData(player, "job:transporter:X", 493.8185);
API.triggerServerEvent("colwasselected", 493.8185);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", 493);
}
else if (random == 5) {
marker = API.createMarker(1, new Vector3(1247.924, -346.1441, 68.0822), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setWaypoint(1247.924, -346.1441);
API.setEntitySyncedData(player, "job:transporter:X", 1247.924);
API.triggerServerEvent("colwasselected", 1247.924);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", 1247);
}
else if (random == 6) {
marker = API.createMarker(1, new Vector3(2562.558, -319.5804, 91.992), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setWaypoint(2562.558, -319.5804);
API.setEntitySyncedData(player, "job:transporter:X", 2562.558);
API.triggerServerEvent("colwasselected", 2562.558);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", 2562);
}
else if (random == 7) {
marker = API.createMarker(1, new Vector3(1862.685, 3703.321, 32.49183), new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(2, 2, 2), 255, 0, 0, 255);
API.setWaypoint(1862.685, 3703.321);
API.setEntitySyncedData(player, "job:transporter:X", 1862.685);
API.triggerServerEvent("colwasselected", 1862.685);
API.sendNotification("~g~Fahren sie zur markierten Route!");
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", 1862);
}
}
else if (eventName == "triggerServerEvent") {
var argumments = args[0];
API.triggerServerEvent("triggerBackFromClient", argumments);
}
else if (eventName == "transporterCancel") {
if (API.doesEntityExist(marker))
API.deleteEntity(marker);
marker = null;
API.removeWaypoint();
API.setEntitySyncedData(API.getLocalPlayer(), "transporter:marker:loc", 0);
}
else if (eventName == "deletelastWaypoint") {
if (API.doesEntityExist(marker))
API.deleteEntity(marker);
marker = null;
API.removeWaypoint();
}
});