Fixing issues from vehiclesync
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//You don't need to worry about anything here
|
||||
|
||||
mp.events.add("VehStream_SetEngineStatus", (veh, status) => {
|
||||
if (veh === undefined || veh === null) return;
|
||||
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
|
||||
if (veh !== undefined) {
|
||||
if (veh.isSeatFree(-1)) //Turns engine on instantly if no driver, otherwise it will not turn on
|
||||
{
|
||||
@@ -17,7 +17,7 @@ mp.events.add("VehStream_SetEngineStatus", (veh, status) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetLockStatus", (veh, status) => {
|
||||
if (veh === undefined || veh === null) return;
|
||||
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
|
||||
if (veh !== undefined) {
|
||||
if (status)
|
||||
veh.setDoorsLocked(2);
|
||||
@@ -27,7 +27,7 @@ mp.events.add("VehStream_SetLockStatus", (veh, status) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => {
|
||||
if (entity === undefined || entity === null) return;
|
||||
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
|
||||
if (typeof entity.getVariable("VehicleSyncData") !== 'undefined') {
|
||||
var toggle = entity.getVariable("VehicleSyncData");
|
||||
entity.setEngineOn(toggle.Engine, false, true);
|
||||
@@ -36,7 +36,7 @@ mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_PlayerExitVehicleAttempt", (entity) => {
|
||||
if (entity === undefined || entity === null) return;
|
||||
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
|
||||
if (entity !== undefined) {
|
||||
if (typeof entity.getVariable("VehicleSyncData") !== 'undefined') {
|
||||
var toggle = entity.getVariable("VehicleSyncData");
|
||||
@@ -50,177 +50,181 @@ mp.events.add("VehStream_PlayerExitVehicleAttempt", (entity) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_PlayerExitVehicle", (entity) => {
|
||||
if (entity === undefined || entity === null) return;
|
||||
setTimeout(() => {
|
||||
var Status = [];
|
||||
let y = 0;
|
||||
for (y = 0; y < 8; y++) {
|
||||
if (entity.isDoorDamaged(y)) {
|
||||
try {
|
||||
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
|
||||
setTimeout(() => {
|
||||
var Status = [];
|
||||
let y = 0;
|
||||
for (y = 0; y < 8; y++) {
|
||||
if (entity.isDoorDamaged(y)) {
|
||||
Status.push(2);
|
||||
}
|
||||
else if (entity.getDoorAngleRatio(y) > 0.15) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
mp.events.callRemote("VehStream_SetDoorData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7]);
|
||||
|
||||
Status = [];
|
||||
if (entity.isWindowIntact(0)) {
|
||||
if (entity.getBoneIndexByName("window_rf") === -1) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
else if (entity.getDoorAngleRatio(y) > 0.15) {
|
||||
if (entity.isWindowIntact(1)) {
|
||||
if (entity.getBoneIndexByName("window_lf") === -1) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (entity.isWindowIntact(2)) {
|
||||
if (entity.getBoneIndexByName("window_rr") === -1) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (entity.isWindowIntact(3)) {
|
||||
if (entity.getBoneIndexByName("window_lr") === -1) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
mp.events.callRemote("VehStream_SetWindowData", entity, Status[0], Status[1], Status[2], Status[3]);
|
||||
|
||||
Status = [];
|
||||
if (!entity.isTyreBurst(0, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(0, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(1, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
mp.events.callRemote("VehStream_SetDoorData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7]);
|
||||
|
||||
Status = [];
|
||||
if (entity.isWindowIntact(0)) {
|
||||
if (entity.getBoneIndexByName("window_rf") === -1) {
|
||||
else if (entity.isTyreBurst(1, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(2, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (entity.isWindowIntact(1)) {
|
||||
if (entity.getBoneIndexByName("window_lf") === -1) {
|
||||
else if (entity.isTyreBurst(2, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(3, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (entity.isWindowIntact(2)) {
|
||||
if (entity.getBoneIndexByName("window_rr") === -1) {
|
||||
else if (entity.isTyreBurst(3, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(4, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (entity.isWindowIntact(3)) {
|
||||
if (entity.getBoneIndexByName("window_lr") === -1) {
|
||||
else if (entity.isTyreBurst(4, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(5, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
mp.events.callRemote("VehStream_SetWindowData", entity, Status[0], Status[1], Status[2], Status[3]);
|
||||
else if (entity.isTyreBurst(5, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
Status = [];
|
||||
if (!entity.isTyreBurst(0, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(0, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (!entity.isTyreBurst(6, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(6, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(1, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(1, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (!entity.isTyreBurst(7, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(7, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(2, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(2, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (!entity.isTyreBurst(45, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(45, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(3, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(3, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
if (!entity.isTyreBurst(47, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(47, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(4, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(4, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(5, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(5, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(6, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(6, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(7, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(7, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(45, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(45, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
if (!entity.isTyreBurst(47, false)) {
|
||||
Status.push(0);
|
||||
}
|
||||
else if (entity.isTyreBurst(47, false)) {
|
||||
Status.push(1);
|
||||
}
|
||||
else {
|
||||
Status.push(2);
|
||||
}
|
||||
|
||||
mp.events.callRemote("VehStream_SetWheelData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7], Status[8], Status[9]);
|
||||
}, 2500);
|
||||
mp.events.callRemote("VehStream_SetWheelData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7], Status[8], Status[9]);
|
||||
}, 2500);
|
||||
} catch (e) {
|
||||
console.log("error: " + e);
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => {
|
||||
if (entity === undefined || entity === null) return;
|
||||
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
|
||||
setTimeout(() => {
|
||||
var Status = [];
|
||||
let y = 0;
|
||||
@@ -287,14 +291,14 @@ mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleDirtLevel", (entity, dirt) => {
|
||||
if (entity === undefined || entity === null) return;
|
||||
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
|
||||
if (entity !== undefined) {
|
||||
entity.setDirtLevel(dirt);
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleDoorStatus_Single", (veh, door, state) => {
|
||||
if (veh === undefined || veh === null) return;
|
||||
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
|
||||
if (veh !== undefined) {
|
||||
if (state === 0) {
|
||||
veh.setDoorShut(door, false);
|
||||
@@ -309,7 +313,7 @@ mp.events.add("VehStream_SetVehicleDoorStatus_Single", (veh, door, state) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleDoorStatus", (...args) => {
|
||||
if (args[0] !== undefined && args[0] !== null) {
|
||||
if (args[0] !== undefined && args[0] !== null || !args[0].isAVehicle()) {
|
||||
let y = 0;
|
||||
for (y = 1; y < args.length; y++) {
|
||||
if (args[y] === 0) {
|
||||
@@ -326,7 +330,7 @@ mp.events.add("VehStream_SetVehicleDoorStatus", (...args) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleWindowStatus_Single", (veh, windw, state) => {
|
||||
if (veh === undefined || veh === null) return;
|
||||
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
|
||||
if (veh !== undefined) {
|
||||
if (state === 1) {
|
||||
veh.rollDownWindow(windw);
|
||||
@@ -342,7 +346,7 @@ mp.events.add("VehStream_SetVehicleWindowStatus_Single", (veh, windw, state) =>
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleWindowStatus", (...args) => {
|
||||
if (args[0] !== undefined && args[0] !== null) {
|
||||
if (args[0] !== undefined && args[0] !== null || !args[0].isAVehicle()) {
|
||||
let y = 0;
|
||||
for (y = 1; y < 4; y++) {
|
||||
if (args[y] === 1) {
|
||||
@@ -360,7 +364,7 @@ mp.events.add("VehStream_SetVehicleWindowStatus", (...args) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleWheelStatus_Single", (veh, wheel, state) => {
|
||||
if (veh === undefined || veh === null) return;
|
||||
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
|
||||
if (veh !== undefined) {
|
||||
if (wheel === 9) {
|
||||
if (state === 1) {
|
||||
@@ -399,7 +403,7 @@ mp.events.add("VehStream_SetVehicleWheelStatus_Single", (veh, wheel, state) => {
|
||||
});
|
||||
|
||||
mp.events.add("VehStream_SetVehicleWheelStatus", (...args) => {
|
||||
if (args[0] !== undefined && args[0] !== null) {
|
||||
if (args[0] !== undefined && args[0] !== null || !args[0].isAVehicle()) {
|
||||
let y = 0;
|
||||
for (y = 1; y < args.length; y++) {
|
||||
if (y === 9) {
|
||||
@@ -441,7 +445,7 @@ mp.events.add("VehStream_SetVehicleWheelStatus", (...args) => {
|
||||
|
||||
//Sync data on stream in
|
||||
mp.events.add("entityStreamIn", (entity) => {
|
||||
if (entity === undefined) return;
|
||||
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
|
||||
if (entity.type === "vehicle") {
|
||||
let typeor = typeof entity.getVariable('VehicleSyncData');
|
||||
let actualData = entity.getVariable('VehicleSyncData');
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="meta.xml" />
|
||||
@@ -31,6 +32,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Client\dlcpacks\polamggtr\" />
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(ConfigurationName)' == 'Debug'">
|
||||
|
||||
Reference in New Issue
Block a user