From 930c66a439a590bd3e7395f318f539ccc4db5d50 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 30 Dec 2021 16:03:07 -0600
Subject: [PATCH 001/609] Reverted 1.4.0 stuff
This reverts commit 7a5167743bc5ff520688adf0d9093cb007fb9dc6.
Revert "Use new stream distance stuff"
This reverts commit bdda7caf4c9b73521a2f8ae9b9ecf3783b8c8cca.
Revert "Add blip/pickup distance to global cfg"
This reverts commit 5a916c4a9853c1cbeb75be368050c01d5f5da253.
Revert "Add utils for new element streaming funcs"
This reverts commit 22d39ceb69e806ba9e819285d016f6a8aa9076d9.
---
scripts/server/business.js | 19 ++++++++------
scripts/server/config.js | 7 ------
scripts/server/event.js | 3 +++
scripts/server/house.js | 11 ++------
scripts/server/native/connected.js | 40 ------------------------------
5 files changed, 16 insertions(+), 64 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index 5c23034b..e4e1fef6 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -1324,8 +1324,6 @@ function createBusinessEntrancePickup(businessId) {
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
- setElementStreamInDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().businessPickupStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().businessPickupStreamOutDistance);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
}
@@ -1348,8 +1346,11 @@ function createBusinessEntranceBlip(businessId) {
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
- setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().businessBlipStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ //getBusinessData(businessId).entranceBlip.streamInDistance = 300;
+ //getBusinessData(businessId).entranceBlip.streamOutDistance = 350;
+ //getBusinessData(businessId).entranceBlip.interior = getBusinessData(businessId).entranceInterior;
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).entranceBlip);
}
}
@@ -1372,8 +1373,9 @@ function createBusinessExitPickup(businessId) {
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
- setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().businessPickupStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().businessPickupStreamOutDistance);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
+ //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
+ //getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior;
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).exitPickup);
}
@@ -1398,8 +1400,9 @@ function createBusinessExitBlip(businessId) {
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
- setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().businessBlipStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ //getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
+ //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
+ //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).exitBlip);
}
}
diff --git a/scripts/server/config.js b/scripts/server/config.js
index 65474917..78cd89a2 100644
--- a/scripts/server/config.js
+++ b/scripts/server/config.js
@@ -80,13 +80,6 @@ let globalConfig = {
VRR_ITEM_USETYPE_VEHTIRE,
],
vehicleInactiveRespawnDelay: 1800000, // 20 minutes
- housePickupStreamInDistance: 50,
- housePickupStreamOutDistance: 75,
- businessPickupStreamInDistance: 50,
- businessPickupStreamOutDistance: 75,
- jobPickupStreamInDistance: 50,
- jobPickupStreamOutDistance: 75,
- vehicleTrunkRearDistance: 3,
};
// ===========================================================================
diff --git a/scripts/server/event.js b/scripts/server/event.js
index ca3008e4..9aee4443 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -95,6 +95,9 @@ function onPlayerQuit(event, client, quitReasonId) {
}
messageDiscordEventChannel(`๐ ${getPlayerDisplayForConsole(client)} has left the server.`);
+
+ clearTemporaryVehicles();
+ clearTemporaryPeds();
}
// ===========================================================================
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 8ac3b0ff..0031955e 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -861,9 +861,6 @@ function createHouseEntrancePickup(houseId) {
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
- setElementStreamInDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().housePickupStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().housePickupStreamOutDistance);
-
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.id", houseId, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
@@ -900,8 +897,8 @@ function createHouseEntranceBlip(houseId) {
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
- setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
+ //getHouseData(houseId).entranceBlip.streamInDistance = 300;
+ //getHouseData(houseId).entranceBlip.streamOutDistance = 350;
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).entranceBlip);
@@ -926,8 +923,6 @@ function createHouseExitPickup(houseId) {
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
- setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance);
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.id", houseId, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
@@ -954,8 +949,6 @@ function createHouseExitBlip(houseId) {
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
- setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance);
- setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).exitBlip);
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 7dd3118c..4f88d10e 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -424,46 +424,6 @@ function setElementOnAllDimensions(element, state) {
// ===========================================================================
-function setElementDefaultExistance(element, state) {
- if(!isNull(element) && element != false) {
- element.defaultExistance = state;
- }
-}
-
-// ===========================================================================
-
-function setElementExistsFor(element, client, state) {
- if(!isNull(element) && element != false) {
- element.setExistsFor(client, state);
- }
-}
-
-// ===========================================================================
-
-function clearElementExistsFor(element) {
- if(!isNull(element) && element != false) {
- element.clearExistsFor();
- }
-}
-
-// ===========================================================================
-
-function setElementStreamInDistance(element, distance) {
- if(!isNull(element) && element != false) {
- element.streamInDistance = distance;
- }
-}
-
-// ===========================================================================
-
-function setElementStreamOutDistance(element, distance) {
- if(!isNull(element) && element != false) {
- element.streamOutDistance = distance;
- }
-}
-
-// ===========================================================================
-
function destroyGameElement(element) {
if(!isNull(element) && element != false) {
destroyElement(element);
From c1322f2bab2c75acb334be42139ff9a7dca7b0c4 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 1 Jan 2022 13:25:41 -0600
Subject: [PATCH 002/609] Use native for HUD on IV
---
scripts/client/server.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/client/server.js b/scripts/client/server.js
index aa46f493..2ac8df8b 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -123,7 +123,11 @@ function setPlayer2DRendering(hudState, labelState, smallGameMessageState, score
renderHUD = hudState;
if(typeof setHUDEnabled != "undefined") {
- setHUDEnabled(hudState);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.displayHud(false);
+ } else {
+ setHUDEnabled(hudState);
+ }
}
renderLabels = labelState;
From 386b6f395233e7ce25ea27770b7957f3b5e8cf16 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 1 Jan 2022 13:26:17 -0600
Subject: [PATCH 003/609] Disable loading job route from db until ready
---
scripts/server/job.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 6f5749b0..4f3db3cd 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -39,7 +39,7 @@ function loadJobsFromDatabase() {
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
- tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
+ //tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
tempJobs.push(tempJobData);
logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
}
From 8bad9eb5a6fdd3f37d97ac0c2db3e4d6e23461a5 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 1 Jan 2022 13:26:28 -0600
Subject: [PATCH 004/609] More native utils
---
scripts/server/native/connected.js | 34 +++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 4f88d10e..7f369e5b 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -480,9 +480,41 @@ function setVehicleSiren(vehicle, siren) {
// ===========================================================================
-function setVehicleColours(vehicle, colour1, colour2) {
+function getVehicleLights(vehicle) {
+ return vehicle.lights;
+}
+
+// ===========================================================================
+
+function getVehicleEngine(vehicle) {
+ return vehicle.engine;
+}
+
+// ===========================================================================
+
+function getVehicleLocked(vehicle) {
+ return vehicle.locked;
+}
+
+// ===========================================================================
+
+function getVehicleSiren(vehicle) {
+ return vehicle.siren;
+}
+
+// ===========================================================================
+
+function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1) {
vehicle.colour1 = colour1;
vehicle.colour2 = colour2;
+
+ if(colour3 != -1) {
+ vehicle.colour3 = colour3;
+ }
+
+ if(colour4 != -1) {
+ vehicle.colour4 = colour4;
+ }
}
// ===========================================================================
From ecbe91895bf997b10205f0aa16e5cd779f4c4f13 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 1 Jan 2022 13:26:51 -0600
Subject: [PATCH 005/609] Make sure vehicle exists before saving pos/rot
---
scripts/server/vehicle.js | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index e25cf955..7baa250c 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -78,13 +78,15 @@ function saveVehicleToDatabase(vehicleDataId) {
logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if(dbConnection) {
- if(!tempVehicleData.spawnLocked) {
- if(areServerElementsSupported()) {
- tempVehicleData.spawnPosition = tempVehicleData.vehicle.position;
- tempVehicleData.spawnRotation = tempVehicleData.vehicle.heading;
- } else {
- tempVehicleData.spawnPosition = tempVehicleData.syncPosition;
- tempVehicleData.spawnRotation = tempVehicleData.syncHeading;
+ if(tempVehicleData.vehicle != false) {
+ if(!tempVehicleData.spawnLocked) {
+ if(areServerElementsSupported()) {
+ tempVehicleData.spawnPosition = tempVehicleData.vehicle.position;
+ tempVehicleData.spawnRotation = tempVehicleData.vehicle.heading;
+ } else {
+ tempVehicleData.spawnPosition = tempVehicleData.syncPosition;
+ tempVehicleData.spawnRotation = tempVehicleData.syncHeading;
+ }
}
}
@@ -1174,6 +1176,7 @@ function respawnVehicle(vehicle) {
// ===========================================================================
function spawnVehicle(vehicleData) {
+ logToConsole(LOG_DEBUG, `[VRR.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
addToWorld(vehicle);
@@ -1184,25 +1187,30 @@ function spawnVehicle(vehicleData) {
if(isGameFeatureSupported("vehicleColours")) {
if(vehicleData.colour1IsRGBA && vehicleData.colour2IsRGBA) {
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
+ let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
+ let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
+ logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
+ vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
} else {
- vehicle.colour1 = vehicleData.colour1;
- vehicle.colour2 = vehicleData.colour2;
- vehicle.colour3 = vehicleData.colour3;
- vehicle.colour4 = vehicleData.colour4;
+ setVehicleColours(vehicle, vehicleData.colour1, vehicleData.colour2, vehicleData.colour3, vehicleData.colour4);
+ logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
}
}
if(vehicleData.spawnLocked == true) {
- vehicle.engine = false;
+ setVehicleEngine(vehicle, false);
+ logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
} else {
- vehicle.engine = intToBool(vehicleData.engine);
+ setVehicleEngine(vehicle, intToBool(vehicleData.engine));
+ logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngineState(vehicle)))}`);
}
if(typeof vehicle.locked != "undefined") {
- vehicle.locked = intToBool(vehicleData.locked);
+ setVehicleLocked(vehicle, intToBool(vehicleData.locked));
+ logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLockState(vehicle)))}`);
}
- vehicle.dimension = vehicleData.dimension;
+ setElementDimension(vehicle.dimension, vehicleData.dimension);
vehicleData.vehicle = vehicle;
From e985cd07e329359596fb7c08ae3d698adc90f920 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 1 Jan 2022 13:28:03 -0600
Subject: [PATCH 006/609] Revert "Reverted 1.4.0 stuff"
This reverts commit 930c66a439a590bd3e7395f318f539ccc4db5d50.
---
scripts/server/business.js | 19 ++++++--------
scripts/server/config.js | 7 ++++++
scripts/server/event.js | 3 ---
scripts/server/house.js | 11 ++++++--
scripts/server/native/connected.js | 40 ++++++++++++++++++++++++++++++
5 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index e4e1fef6..5c23034b 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -1324,6 +1324,8 @@ function createBusinessEntrancePickup(businessId) {
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
+ setElementStreamInDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().businessPickupStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().businessPickupStreamOutDistance);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
}
@@ -1346,11 +1348,8 @@ function createBusinessEntranceBlip(businessId) {
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
- //getBusinessData(businessId).entranceBlip.streamInDistance = 300;
- //getBusinessData(businessId).entranceBlip.streamOutDistance = 350;
- //getBusinessData(businessId).entranceBlip.interior = getBusinessData(businessId).entranceInterior;
- //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false);
- //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
+ setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().businessBlipStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().businessBlipStreamOutDistance);
addToWorld(getBusinessData(businessId).entranceBlip);
}
}
@@ -1373,9 +1372,8 @@ function createBusinessExitPickup(businessId) {
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
- //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
- //setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
- //getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior;
+ setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().businessPickupStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().businessPickupStreamOutDistance);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).exitPickup);
}
@@ -1400,9 +1398,8 @@ function createBusinessExitBlip(businessId) {
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
- //getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
- //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
- //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
+ setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().businessBlipStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().businessBlipStreamOutDistance);
addToWorld(getBusinessData(businessId).exitBlip);
}
}
diff --git a/scripts/server/config.js b/scripts/server/config.js
index 78cd89a2..65474917 100644
--- a/scripts/server/config.js
+++ b/scripts/server/config.js
@@ -80,6 +80,13 @@ let globalConfig = {
VRR_ITEM_USETYPE_VEHTIRE,
],
vehicleInactiveRespawnDelay: 1800000, // 20 minutes
+ housePickupStreamInDistance: 50,
+ housePickupStreamOutDistance: 75,
+ businessPickupStreamInDistance: 50,
+ businessPickupStreamOutDistance: 75,
+ jobPickupStreamInDistance: 50,
+ jobPickupStreamOutDistance: 75,
+ vehicleTrunkRearDistance: 3,
};
// ===========================================================================
diff --git a/scripts/server/event.js b/scripts/server/event.js
index 9aee4443..ca3008e4 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -95,9 +95,6 @@ function onPlayerQuit(event, client, quitReasonId) {
}
messageDiscordEventChannel(`๐ ${getPlayerDisplayForConsole(client)} has left the server.`);
-
- clearTemporaryVehicles();
- clearTemporaryPeds();
}
// ===========================================================================
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 0031955e..8ac3b0ff 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -861,6 +861,9 @@ function createHouseEntrancePickup(houseId) {
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
+ setElementStreamInDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().housePickupStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().housePickupStreamOutDistance);
+
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.id", houseId, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
@@ -897,8 +900,8 @@ function createHouseEntranceBlip(houseId) {
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
- //getHouseData(houseId).entranceBlip.streamInDistance = 300;
- //getHouseData(houseId).entranceBlip.streamOutDistance = 350;
+ setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).entranceBlip);
@@ -923,6 +926,8 @@ function createHouseExitPickup(houseId) {
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
+ setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance);
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.id", houseId, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
@@ -949,6 +954,8 @@ function createHouseExitBlip(houseId) {
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
+ setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance);
+ setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).exitBlip);
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 7f369e5b..e0f36a8e 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -424,6 +424,46 @@ function setElementOnAllDimensions(element, state) {
// ===========================================================================
+function setElementDefaultExistance(element, state) {
+ if(!isNull(element) && element != false) {
+ element.defaultExistance = state;
+ }
+}
+
+// ===========================================================================
+
+function setElementExistsFor(element, client, state) {
+ if(!isNull(element) && element != false) {
+ element.setExistsFor(client, state);
+ }
+}
+
+// ===========================================================================
+
+function clearElementExistsFor(element) {
+ if(!isNull(element) && element != false) {
+ element.clearExistsFor();
+ }
+}
+
+// ===========================================================================
+
+function setElementStreamInDistance(element, distance) {
+ if(!isNull(element) && element != false) {
+ element.streamInDistance = distance;
+ }
+}
+
+// ===========================================================================
+
+function setElementStreamOutDistance(element, distance) {
+ if(!isNull(element) && element != false) {
+ element.streamOutDistance = distance;
+ }
+}
+
+// ===========================================================================
+
function destroyGameElement(element) {
if(!isNull(element) && element != false) {
destroyElement(element);
From 70ba9e99b35f0d3763182306151e8aea294540b8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Jan 2022 20:07:57 -0600
Subject: [PATCH 007/609] Element transient
---
scripts/server/house.js | 5 ++++-
scripts/server/native/connected.js | 12 ++++++++++++
scripts/server/vehicle.js | 2 ++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 8ac3b0ff..15adb883 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -863,7 +863,7 @@ function createHouseEntrancePickup(houseId) {
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
setElementStreamInDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().housePickupStreamInDistance);
setElementStreamOutDistance(getBusinessData(businessId).entrancePickup, getGlobalConfig().housePickupStreamOutDistance);
-
+ setElementTransient(getHouseData(houseId).entrancePickup, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.id", houseId, false);
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
@@ -902,6 +902,7 @@ function createHouseEntranceBlip(houseId) {
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance);
setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
+ setElementTransient(getHouseData(houseId).entranceBlip, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).entranceBlip);
@@ -928,6 +929,7 @@ function createHouseExitPickup(houseId) {
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance);
setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance);
+ setElementTransient(getHouseData(houseId).exitPickup, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.id", houseId, false);
setEntityData(getHouseData(houseId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
@@ -956,6 +958,7 @@ function createHouseExitBlip(houseId) {
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance);
setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
+ setElementTransient(getHouseData(houseId).exitBlip, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).exitBlip);
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index e0f36a8e..553a8f5c 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -155,6 +155,18 @@ function setVehicleHeading(vehicle, heading) {
// ===========================================================================
+function getElementTransient(element) {
+ return element.transient;
+}
+
+// ===========================================================================
+
+function setElementTransient(element, state) {
+ return element.transient = state;
+}
+
+// ===========================================================================
+
function getVehicleSyncer(vehicle) {
return getElementSyncer(vehicle);
}
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index 7baa250c..63608796 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -1178,6 +1178,8 @@ function respawnVehicle(vehicle) {
function spawnVehicle(vehicleData) {
logToConsole(LOG_DEBUG, `[VRR.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
+ setVehicleHeading(vehicle, vehicleData.spawnRotation);
+ setElementTransient(vehicle, false);
addToWorld(vehicle);
if(!vehicle) {
From d0a0eb15f121ad44675c894ce8bf164b09b21ded Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Jan 2022 20:08:42 -0600
Subject: [PATCH 008/609] Some prep
---
scripts/server/native/connected.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 553a8f5c..e8340ffd 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -348,7 +348,7 @@ function setElementDimension(element, dimension) {
// ===========================================================================
function setElementRotation(element, rotation) {
- return element.setRotation(rotation);
+ return element.rotation = rotation;
}
// ===========================================================================
@@ -545,7 +545,7 @@ function getVehicleEngine(vehicle) {
// ===========================================================================
function getVehicleLocked(vehicle) {
- return vehicle.locked;
+ return vehicle.lockedStatus;
}
// ===========================================================================
From e44307991dcabc38110f788964d0e7fec83dca6c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 24 Feb 2022 15:45:00 -0600
Subject: [PATCH 009/609] Arrange meta.xml client scripts by name
---
meta.xml | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/meta.xml b/meta.xml
index 33f8807f..e41b8fd1 100644
--- a/meta.xml
+++ b/meta.xml
@@ -25,7 +25,6 @@
-
@@ -112,26 +111,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 7daa6927704988c2cb6a660d9a5021c0d24ba4fc Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 24 Feb 2022 15:45:30 -0600
Subject: [PATCH 010/609] Offload colour replace to client
---
scripts/client/chatbox.js | 8 +-
scripts/server/colour.js | 367 -----------
scripts/server/locale.js | 3 -
scripts/server/messaging.js | 29 +-
scripts/shared/gamedata.js | 1 +
scripts/shared/utilities.js | 1228 +++++++++++++++++++++++++++++++++++
6 files changed, 1243 insertions(+), 393 deletions(-)
delete mode 100644 scripts/server/colour.js
diff --git a/scripts/client/chatbox.js b/scripts/client/chatbox.js
index 37526c4b..d74eb237 100644
--- a/scripts/client/chatbox.js
+++ b/scripts/client/chatbox.js
@@ -46,11 +46,13 @@ function unBindChatBoxKeys() {
// ===========================================================================
function receiveChatBoxMessageFromServer(messageString, colour) {
- if(bottomMessageIndex => chatBoxHistory.length-1) {
- message(messageString, colour);
+ let colouredString = replaceColoursInMessage(messageString);
+
+ if(bottomMessageIndex >= chatBoxHistory.length-1) {
+ message(colouredString, colour);
bottomMessageIndex = chatBoxHistory.length-1;
}
- addToChatBoxHistory(messageString, colour);
+ addToChatBoxHistory(colouredString, colour);
}
// ===========================================================================
diff --git a/scripts/server/colour.js b/scripts/server/colour.js
deleted file mode 100644
index 3ffe0889..00000000
--- a/scripts/server/colour.js
+++ /dev/null
@@ -1,367 +0,0 @@
-// ===========================================================================
-// Vortrex's Roleplay Resource
-// https://github.com/VortrexFTW/gtac_roleplay
-// ===========================================================================
-// FILE: colour.js
-// DESC: Provides colours, functions and usage
-// TYPE: Server (JavaScript)
-// ===========================================================================
-
-let serverColours = {
- hex: {
- byType: {
- talkMessage: "C8C8C8",
- shoutMessage: "FFFFC8",
- whisperMessage: "828282",
- doActionMessage: "B19CD9",
- meActionMessage: "B19CD9",
- errorMessage: "ED4337",
- syntaxMessage: "C8C8C8",
- normalMessage: "FFFFFF",
- alertMessage: "FFFF00",
- successMessage: "00B400",
- clanChatMessage: "00BE00",
- businessBlue: "0099FF",
- houseGreen: "11CC11",
- clanOrange: "FF9900",
- vehiclePurple: "960096",
- jobYellow: "FFFF00",
- },
- byName: {
- white: "FFFFFF",
- black: "000000",
- red: "FF0000",
- yellow: "FFFF00",
- royalBlue: "0000FF",
- teal: "00FFFF",
- orange: "FF8000",
- softRed: "ED4337",
- softGreen: "32CD32",
- lightPurple: "960096",
- lightGrey: "C8C8C8",
- mediumGrey: "969696",
- darkGrey: "404040",
- policeBlue: "3250C8",
- medicPink: "DB7093",
- firefighterRed: "CD3C3C",
- busDriverGreen: "32A032",
- taxiDriverYellow: "F0E664",
- deliveryPurple: "B19CD9",
- civilianWhite: "C8C8C8",
- burntYellow: "D2D200",
- burntOrange: "D27800",
- bankGreen: "00B400",
- softYellow: "EAC67E",
- businessBlue: "0099FF",
- houseGreen: "11CC11",
- clanOrange: "FF9900",
- vehiclePurple: "960096",
- jobYellow: "FFFF00",
- },
- },
-
- byType: {
- talkMessage: toColour(200, 200, 200),
- shoutMessage: toColour(255, 255, 200),
- whisperMessage: toColour(130, 130, 130),
- doActionMessage: toColour(177, 156, 217, 255),
- meActionMessage: toColour(177, 156, 217, 255),
- errorMessage: toColour(237, 67, 55, 255),
- syntaxMessage: toColour(200, 200, 200, 255),
- normalMessage: toColour(255, 255, 255, 255),
- alertMessage: toColour(255, 255, 0, 255),
- successMessage: toColour(0, 180, 0, 255),
- clanChatMessage: toColour(0, 190, 0, 255),
- },
- byName: {
- white: toColour(255, 255, 255, 255),
- black: toColour(0, 0, 0, 255),
- red: toColour(255, 0, 0, 255),
- yellow: toColour(255, 255, 0, 255),
- royalBlue: toColour(0, 0, 255, 255),
- teal: toColour(0, 255, 255, 255),
- orange: toColour(255, 128, 0, 255),
- softRed: toColour(205, 60, 60, 255),
- softGreen: toColour(50, 205, 50, 255),
- lightPurple: toColour(150, 0, 150, 255),
- lightGrey: toColour(200, 200, 200, 255),
- mediumGrey: toColour(150, 150, 150, 255),
- darkGrey: toColour(64, 64, 64, 255),
- policeBlue: toColour(50, 80, 200, 255),
- medicPink: toColour(219, 112, 147, 255),
- firefighterRed: toColour(205, 60, 60, 255),
- busDriverGreen: toColour(50, 160, 50, 255),
- taxiDriverYellow: toColour(240, 230, 100, 255),
- deliveryPurple: toColour(177, 156, 217, 255),
- civilianWhite: toColour(200, 200, 200, 255),
- burntYellow: toColour(210, 210, 0, 255),
- burntOrange: toColour(210, 120, 0, 255),
- bankGreen: toColour(0, 150, 0, 255),
- softYellow: toColour(234, 198, 126, 255),
- businessBlue: toColour(0, 153, 255, 255),
- houseGreen: toColour(17, 204, 17, 255),
- clanOrange: toColour(255, 153, 0, 255),
- },
-};
-
-// ===========================================================================
-
-function getServerColours() {
- return serverColours;
-}
-
-// ===========================================================================
-
-function getColourByType(typeName) {
- return getServerColours().byType[typeName];
-}
-
-// ===========================================================================
-
-function getColourByName(colourName) {
- return getServerColours().byName[colourName];
-}
-
-// ===========================================================================
-
-function getHexColourByName(colourName) {
- //let rgbaColour = getServerColours().byName[colourName];
- //let rgbaArray = rgbaArrayFromToColour(rgbaColour);
- //return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
-
- return `#${getServerColours().hex.byName[colourName]}`;
-}
-
-// ===========================================================================
-
-function getHexColourByType(colourName) {
- //let rgbaColour = getServerColours().byType[colourName];
- //let rgbaArray = rgbaArrayFromToColour(rgbaColour);
- //return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
-
- return `#${getServerColours().hex.byType[colourName]}`;
-}
-
-// ===========================================================================
-
-function getPlayerColour(client) {
- if(getPlayerData(client) != false) {
- if(!isPlayerLoggedIn(client)) {
- return getColourByName("darkGrey");
- } else {
- if(isPlayerWorking(client)) {
- return getJobData(getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client).job)).colour;
- }
- }
- }
-
- return getColourByName("civilianWhite");
-}
-
-// ===========================================================================
-
-/**
- * Gets the red/green colour depending on bool (red = false, green = true) for inline use in chatbox messages
- *
- * @param {Boolean} boolValue The boolean value
- * @return {String} Red or green inline HEX colour string
- *
- */
-function getBoolRedGreenInlineColour(boolValue) {
- return (!boolValue) ? "{softRed}" : "{softGreen}";
-}
-
-// ===========================================================================
-
-/**
- * Gets an array of RGB colour values from a HEX colour string
- *
- * @param {String} hexColour Hex colour string
- * @return {Array} 3-slot array where each slot is an RGB colour value
- *
- */
-function hexToRgb(h) {
- return [
- '0x'+h[1]+h[2]|0,
- '0x'+h[3]+h[4]|0,
- '0x'+h[5]+h[6]|0
- ];
-}
-
-// ===========================================================================
-
-/**
- * Gets a HEX colour string from RGB values, without brackets (example: #FFFFFF)
- *
- * @param {Number} red Red RGB value
- * @param {Number} green Green RGB value
- * @param {Number} blue Blue RGB value
- * @return {String} HEX colour string
- *
- */
-function rgbToHex(r, g, b) {
- return "#"+((1<<24)+(r<<16)+(g<<8)+ b).toString(16).slice(1);
-}
-
-// ===========================================================================
-
-/**
- * Gets the current colour for a player (affected by job and status)
- *
- * @param {Client} client Player client
- * @return {Number} Colour integer
- *
- */
-function getClientChatColour(client) {
- let tempJob = getPlayerCurrentSubAccount(client).job;
- if(tempJob != -1) {
- if(getPlayerData(client).isWorking) {
- return getJobData(tempJob).jobColour;
- }
- }
- return getColourByName("white");
-}
-
-// ===========================================================================
-
-/**
- * Gets a toColour-created colour integer with random RGB values (alpha is always 255)
- *
- * @return {Number} Colour integer
- *
- */
-function getRandomRGB() {
- return toColour.apply(null, [
- getRandom(0, 255),
- getRandom(0, 255),
- getRandom(0, 255),
- 255
- ]);
-}
-
-// ===========================================================================
-
-/**
- * Gets a hex formatting colour by name for use inline in chatbox messages (example: [#FFFFFF]).
- *
- * @param {String} colourName - Colour name
- * @return {String} HEX-formatted colour string with brackets
- *
- */
-function getInlineChatColourByName(colourName) {
- return `{${colourName}}`;
-}
-
-// ===========================================================================
-
-/**
- * Gets a hex formatting colour by type for use inline in chatbox messages (example: [#FFFFFF]).
- *
- * @param {String} colourName - Colour type
- * @return {String} HEX-formatted colour string with brackets
- *
- */
-function getInlineChatColourByType(colourName) {
- return `{${colourName}}`;
-}
-
-// ===========================================================================
-
-/**
- * Gets an array of RGBA colour values from a toColour integer.
- *
- * @param {Number} colour - Colour integer created by toColour
- * @return {Array} 4-slot array where each slot is an RGBA colour value
- *
- */
-function rgbaArrayFromToColour(colour) {
- //return [
- // (colour >> 24) & 0xFF, // red
- // (colour >> 16) & 0xFF,
- // (colour >> 8) & 0xFF,
- // colour & 0xFF // alpha
- //];
- return [
- (colour >> 16) & 0xFF, // red
- (colour >> 8) & 0xFF,
- colour & 0xFF,
- (colour >> 24) & 0xFF// alpha
- ];
-}
-
-// ===========================================================================
-
-function hexFromToColour(colour) {
- let rgba = rgbaArrayFromToColour(colour);
- return rgbToHex(rgba[0], rgba[1], rgba[2]);
-}
-
-// ===========================================================================
-
-function replaceColoursInMessage(messageText) {
- if(messageText == null) {
- return "";
- }
-
- let tempFind = `{RESETCOLOUR}`;
- let tempRegex = new RegExp(tempFind, 'g');
- messageText = messageText.replace(tempRegex, "[/#]");
-
- tempFind = `{ALTCOLOUR}`;
- tempRegex = new RegExp(tempFind, 'g');
- messageText = messageText.replace(tempRegex, "[#C8C8C8]");
-
- tempFind = `{MAINCOLOUR}`;
- tempRegex = new RegExp(tempFind, 'g');
- messageText = messageText.replace(tempRegex, "[#FFFFFF]");
-
- for(let i in getServerColours().hex.byName) {
- let find = `{${i}}`;
- let re = new RegExp(find, 'g');
- messageText = messageText.replace(re, `[#${getServerColours().hex.byName[i]}]`);
- }
-
- for(let i in getServerColours().hex.byType) {
- let find = `{${i}}`;
- let re = new RegExp(find, 'g');
- messageText = messageText.replace(re, `[#${getServerColours().hex.byType[i]}]`);
- }
-
- return messageText;
-}
-
-// ===========================================================================
-
-function removeColoursInMessage(messageText) {
- if(messageText == null) {
- return "";
- }
-
- let tempFind = `{RESETCOLOUR}`;
- let tempRegex = new RegExp(tempFind, 'g');
- messageText = messageText.replace(tempRegex, "");
-
- tempFind = `{ALTCOLOUR}`;
- tempRegex = new RegExp(tempFind, 'g');
- messageText = messageText.replace(tempRegex, "");
-
- tempFind = `{MAINCOLOUR}`;
- tempRegex = new RegExp(tempFind, 'g');
- messageText = messageText.replace(tempRegex, "");
-
- for(let i in getServerColours().hex.byName) {
- let find = `{${i}}`;
- let re = new RegExp(find, 'g');
- messageText = messageText.replace(re, "");
- }
-
- for(let i in getServerColours().hex.byType) {
- let find = `{${i}}`;
- let re = new RegExp(find, 'g');
- messageText = messageText.replace(re, "");
- }
-
- return messageText;
-}
-
-// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/locale.js b/scripts/server/locale.js
index f10c0b02..a45ef9e8 100644
--- a/scripts/server/locale.js
+++ b/scripts/server/locale.js
@@ -34,8 +34,6 @@ function getLocaleString(client, stringName, ...args) {
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
}
- tempString = replaceColoursInMessage(tempString);
-
for(let i = 1; i <= args.length; i++) {
tempString = tempString.replace(`{${i}}`, args[i-1]);
}
@@ -47,7 +45,6 @@ function getLocaleString(client, stringName, ...args) {
function getGroupedLocaleString(client, stringName, index, ...args) {
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
- tempString = replaceColoursInMessage(tempString);
for(let i = 1; i <= args.length; i++) {
tempString = tempString.replace(`{${i}}`, args[i-1]);
diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js
index 91a5608f..e27eb770 100644
--- a/scripts/server/messaging.js
+++ b/scripts/server/messaging.js
@@ -33,19 +33,19 @@ function messageAdminAction(messageText) {
*
*/
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
- if(isConsole(client) || client == null) {
- logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
- }
+ //if(isConsole(client) || client == null) {
+ // logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
+ //}
- sendChatBoxMessageToPlayer(client, `${replaceColoursInMessage(messageText)}`, colour);
+ sendChatBoxMessageToPlayer(client, messageText, colour);
return true;
}
// ===========================================================================
function messageAdmins(messageText, colour = getColourByName("softRed")) {
- let plainMessage = removeColoursInMessage(messageText);
- console.warn(`๐ก๏ธ ${plainMessage}`);
+ //let plainMessage = removeColoursInMessage(messageText);
+ //console.warn(`๐ก๏ธ ${plainMessage}`);
let clients = getClients();
for(let i in clients) {
@@ -54,9 +54,9 @@ function messageAdmins(messageText, colour = getColourByName("softRed")) {
}
}
- if(getServerConfig().discordConfig.sendAdminEvents) {
- messageDiscordAdminChannel(plainMessage);
- }
+ //if(getServerConfig().discordConfig.sendAdminEvents) {
+ // messageDiscordAdminChannel(plainMessage);
+ //}
}
// ===========================================================================
@@ -236,17 +236,6 @@ function clearChatBox(client) {
// ===========================================================================
-function replaceEmojiInString(messageString) {
- for(let i in emojiReplaceString) {
- while(messageString.indexOf(emojiReplaceString[i][0]) != -1) {
- messageString = messageString.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
- }
- }
- return messageString;
-}
-
-// ===========================================================================
-
function messagePlayerHelpContent(client, messageString) {
messagePlayerNormal(client, `{clanOrange}โข {MAINCOLOUR}${messageString}`);
}
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index 6c44119e..497dcdbb 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -5355,3 +5355,4 @@ let gameData = {
],
};
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/shared/utilities.js b/scripts/shared/utilities.js
index 808ccb91..1cd8fd4a 100644
--- a/scripts/shared/utilities.js
+++ b/scripts/shared/utilities.js
@@ -170,6 +170,963 @@ let cardinalDirections = [
// ===========================================================================
+let serverColours = {
+ hex: {
+ byType: {
+ talkMessage: "C8C8C8",
+ shoutMessage: "FFFFC8",
+ whisperMessage: "828282",
+ doActionMessage: "B19CD9",
+ meActionMessage: "B19CD9",
+ errorMessage: "ED4337",
+ syntaxMessage: "C8C8C8",
+ normalMessage: "FFFFFF",
+ alertMessage: "FFFF00",
+ successMessage: "00B400",
+ clanChatMessage: "00BE00",
+ businessBlue: "0099FF",
+ houseGreen: "11CC11",
+ clanOrange: "FF9900",
+ vehiclePurple: "960096",
+ jobYellow: "FFFF00",
+ },
+ byName: {
+ white: "FFFFFF",
+ black: "000000",
+ red: "FF0000",
+ yellow: "FFFF00",
+ royalBlue: "0000FF",
+ teal: "00FFFF",
+ orange: "FF8000",
+ softRed: "ED4337",
+ softGreen: "32CD32",
+ lightPurple: "960096",
+ lightGrey: "C8C8C8",
+ mediumGrey: "969696",
+ darkGrey: "404040",
+ policeBlue: "3250C8",
+ medicPink: "DB7093",
+ firefighterRed: "CD3C3C",
+ busDriverGreen: "32A032",
+ taxiDriverYellow: "F0E664",
+ deliveryPurple: "B19CD9",
+ civilianWhite: "C8C8C8",
+ burntYellow: "D2D200",
+ burntOrange: "D27800",
+ bankGreen: "00B400",
+ softYellow: "EAC67E",
+ businessBlue: "0099FF",
+ houseGreen: "11CC11",
+ clanOrange: "FF9900",
+ vehiclePurple: "960096",
+ jobYellow: "FFFF00",
+ },
+ },
+
+ byType: {
+ talkMessage: toColour(200, 200, 200),
+ shoutMessage: toColour(255, 255, 200),
+ whisperMessage: toColour(130, 130, 130),
+ doActionMessage: toColour(177, 156, 217, 255),
+ meActionMessage: toColour(177, 156, 217, 255),
+ errorMessage: toColour(237, 67, 55, 255),
+ syntaxMessage: toColour(200, 200, 200, 255),
+ normalMessage: toColour(255, 255, 255, 255),
+ alertMessage: toColour(255, 255, 0, 255),
+ successMessage: toColour(0, 180, 0, 255),
+ clanChatMessage: toColour(0, 190, 0, 255),
+ },
+ byName: {
+ white: toColour(255, 255, 255, 255),
+ black: toColour(0, 0, 0, 255),
+ red: toColour(255, 0, 0, 255),
+ yellow: toColour(255, 255, 0, 255),
+ royalBlue: toColour(0, 0, 255, 255),
+ teal: toColour(0, 255, 255, 255),
+ orange: toColour(255, 128, 0, 255),
+ softRed: toColour(205, 60, 60, 255),
+ softGreen: toColour(50, 205, 50, 255),
+ lightPurple: toColour(150, 0, 150, 255),
+ lightGrey: toColour(200, 200, 200, 255),
+ mediumGrey: toColour(150, 150, 150, 255),
+ darkGrey: toColour(64, 64, 64, 255),
+ policeBlue: toColour(50, 80, 200, 255),
+ medicPink: toColour(219, 112, 147, 255),
+ firefighterRed: toColour(205, 60, 60, 255),
+ busDriverGreen: toColour(50, 160, 50, 255),
+ taxiDriverYellow: toColour(240, 230, 100, 255),
+ deliveryPurple: toColour(177, 156, 217, 255),
+ civilianWhite: toColour(200, 200, 200, 255),
+ burntYellow: toColour(210, 210, 0, 255),
+ burntOrange: toColour(210, 120, 0, 255),
+ bankGreen: toColour(0, 150, 0, 255),
+ softYellow: toColour(234, 198, 126, 255),
+ businessBlue: toColour(0, 153, 255, 255),
+ houseGreen: toColour(17, 204, 17, 255),
+ clanOrange: toColour(255, 153, 0, 255),
+ },
+};
+
+let serverEmoji = [
+ [":hash:", "#"],
+ [":zero:", "0"],
+ [":one:", "1"],
+ [":two:", "2"],
+ [":three:", "3"],
+ [":four:", "4"],
+ [":five:", "5"],
+ [":six:", "6"],
+ [":seven:", "7"],
+ [":eight:", "8"],
+ [":nine:", "9"],
+ [":copyright:", "ยฉ"],
+ [":registered:", "ยฎ"],
+ [":bangbang:", "โผ"],
+ [":interrobang:", "โ"],
+ [":tm:", "โข"],
+ [":information_source:", "โน"],
+ [":left_right_arrow:", "โ"],
+ [":arrow_up_down:", "โ"],
+ [":arrow_upper_left:", "โ"],
+ [":arrow_upper_right:", "โ"],
+ [":arrow_lower_right:", "โ"],
+ [":arrow_lower_left:", "โ"],
+ [":leftwards_arrow_with_hook:", "โฉ"],
+ [":arrow_right_hook:", "โช"],
+ [":watch:", "โ"],
+ [":hourglass:", "โ"],
+ [":fast_forward:", "โฉ"],
+ [":rewind:", "โช"],
+ [":arrow_double_up:", "โซ"],
+ [":arrow_double_down:", "โฌ"],
+ [":alarm_clock:", "โฐ"],
+ [":hourglass_flowing_sand:", "โณ"],
+ [":m:", "โ"],
+ [":black_small_square:", "โช"],
+ [":white_small_square:", "โซ"],
+ [":arrow_forward:", "โถ"],
+ [":arrow_backward:", "โ"],
+ [":white_medium_square:", "โป"],
+ [":black_medium_square:", "โผ"],
+ [":white_medium_small_square:", "โฝ"],
+ [":black_medium_small_square:", "โพ"],
+ [":sunny:", "โ"],
+ [":cloud:", "โ"],
+ [":telephone:", "โ"],
+ [":ballot_box_with_check:", "โ"],
+ [":umbrella:", "โ"],
+ [":coffee:", "โ"],
+ [":point_up:", "โ"],
+ [":relaxed:", "โบ"],
+ [":aries:", "โ"],
+ [":taurus:", "โ"],
+ [":gemini:", "โ"],
+ [":cancer:", "โ"],
+ [":leo:", "โ"],
+ [":virgo:", "โ"],
+ [":libra:", "โ"],
+ [":scorpius:", "โ"],
+ [":sagittarius:", "โ"],
+ [":capricorn:", "โ"],
+ [":aquarius:", "โ"],
+ [":pisces:", "โ"],
+ [":spades:", "โ "],
+ [":clubs:", "โฃ"],
+ [":hearts:", "โฅ"],
+ [":diamonds:", "โฆ"],
+ [":hotsprings:", "โจ"],
+ [":recycle:", "โป"],
+ [":wheelchair:", "โฟ"],
+ [":anchor:", "โ"],
+ [":warning:", "โ "],
+ [":zap:", "โก"],
+ [":white_circle:", "โช"],
+ [":black_circle:", "โซ"],
+ [":soccer:", "โฝ"],
+ [":baseball:", "โพ"],
+ [":snowman:", "โ"],
+ [":partly_sunny:", "โ
"],
+ [":ophiuchus:", "โ"],
+ [":no_entry:", "โ"],
+ [":church:", "โช"],
+ [":fountain:", "โฒ"],
+ [":golf:", "โณ"],
+ [":sailboat:", "โต"],
+ [":tent:", "โบ"],
+ [":fuelpump:", "โฝ"],
+ [":scissors:", "โ"],
+ [":white_check_mark:", "โ
"],
+ [":airplane:", "โ"],
+ [":envelope:", "โ"],
+ [":fist:", "โ"],
+ [":raised_hand:", "โ"],
+ [":v:", "โ"],
+ [":pencil2:", "โ"],
+ [":black_nib:", "โ"],
+ [":heavy_check_mark:", "โ"],
+ [":heavy_multiplication_x:", "โ"],
+ [":sparkles:", "โจ"],
+ [":eight_spoked_asterisk:", "โณ"],
+ [":eight_pointed_black_star:", "โด"],
+ [":snowflake:", "โ"],
+ [":sparkle:", "โ"],
+ [":x:", "โ"],
+ [":negative_squared_cross_mark:", "โ"],
+ [":question:", "โ"],
+ [":grey_question:", "โ"],
+ [":grey_exclamation:", "โ"],
+ [":exclamation:", "โ"],
+ [":heart:", "โค"],
+ [":heavy_plus_sign:", "โ"],
+ [":heavy_minus_sign:", "โ"],
+ [":heavy_division_sign:", "โ"],
+ [":arrow_right:", "โก"],
+ [":curly_loop:", "โฐ"],
+ [":arrow_heading_up:", "โคด"],
+ [":arrow_heading_down:", "โคต"],
+ [":arrow_left:", "โฌ
"],
+ [":arrow_up:", "โฌ"],
+ [":arrow_down:", "โฌ"],
+ [":black_large_square:", "โฌ"],
+ [":white_large_square:", "โฌ"],
+ [":star:", "โญ"],
+ [":o:", "โญ"],
+ [":wavy_dash:", "ใฐ"],
+ [":part_alternation_mark:", "ใฝ"],
+ [":congratulations:", "ใ"],
+ [":secret:", "ใ"],
+ [":mahjong:", "๐"],
+ [":black_joker:", "๐"],
+ [":a:", "๐
ฐ"],
+ [":b:", "๐
ฑ"],
+ [":o2:", "๐
พ"],
+ [":parking:", "๐
ฟ"],
+ [":ab:", "๐"],
+ [":cl:", "๐"],
+ [":cool:", "๐"],
+ [":free:", "๐"],
+ [":id:", "๐"],
+ [":new:", "๐"],
+ [":ng:", "๐"],
+ [":ok:", "๐"],
+ [":sos:", "๐"],
+ [":up:", "๐"],
+ [":vs:", "๐"],
+ [":cn:", "๐จ ๐ณ"],
+ [":de:", "๐ฉ ๐ช"],
+ [":es:", "๐ช ๐ธ"],
+ [":fr:", "๐ซ ๐ท"],
+ [":uk:", "๐ฌ ๐ง"],
+ [":it:", "๐ฎ ๐น"],
+ [":jp:", "๐ฏ ๐ต"],
+ [":kr:", "๐ฐ ๐ท"],
+ [":ru:", "๐ท ๐บ"],
+ [":us:", "๐บ ๐ธ"],
+ [":koko:", "๐"],
+ [":sa:", "๐"],
+ [":u7121:", "๐"],
+ [":u6307:", "๐ฏ"],
+ [":u7981:", "๐ฒ"],
+ [":u7a7a:", "๐ณ"],
+ [":u5408:", "๐ด"],
+ [":u6e80:", "๐ต"],
+ [":u6709:", "๐ถ"],
+ [":u6708:", "๐ท"],
+ [":u7533:", "๐ธ"],
+ [":u5272:", "๐น"],
+ [":u55b6:", "๐บ"],
+ [":ideograph_advantage:", "๐"],
+ [":accept:", "๐"],
+ [":cyclone:", "๐"],
+ [":foggy:", "๐"],
+ [":closed_umbrella:", "๐"],
+ [":night_with_stars:", "๐"],
+ [":sunrise_over_mountains:", "๐"],
+ [":sunrise:", "๐
"],
+ [":city_sunset:", "๐"],
+ [":city_sunrise:", "๐"],
+ [":rainbow:", "๐"],
+ [":bridge_at_night:", "๐"],
+ [":ocean:", "๐"],
+ [":volcano:", "๐"],
+ [":milky_way:", "๐"],
+ [":earth_asia:", "๐"],
+ [":new_moon:", "๐"],
+ [":first_quarter_moon:", "๐"],
+ [":waxing_gibbous_moon:", "๐"],
+ [":full_moon:", "๐"],
+ [":crescent_moon:", "๐"],
+ [":first_quarter_moon_with_face:", "๐"],
+ [":star2:", "๐"],
+ [":stars:", "๐ "],
+ [":chestnut:", "๐ฐ"],
+ [":seedling:", "๐ฑ"],
+ [":palm_tree:", "๐ด"],
+ [":cactus:", "๐ต"],
+ [":tulip:", "๐ท"],
+ [":cherry_blossom:", "๐ธ"],
+ [":rose:", "๐น"],
+ [":hibiscus:", "๐บ"],
+ [":sunflower:", "๐ป"],
+ [":blossom:", "๐ผ"],
+ [":corn:", "๐ฝ"],
+ [":ear_of_rice:", "๐พ"],
+ [":herb:", "๐ฟ"],
+ [":four_leaf_clover:", "๐"],
+ [":maple_leaf:", "๐"],
+ [":fallen_leaf:", "๐"],
+ [":leaves:", "๐"],
+ [":mushroom:", "๐"],
+ [":tomato:", "๐
"],
+ [":eggplant:", "๐"],
+ [":grapes:", "๐"],
+ [":melon:", "๐"],
+ [":watermelon:", "๐"],
+ [":tangerine:", "๐"],
+ [":banana:", "๐"],
+ [":pineapple:", "๐"],
+ [":apple:", "๐"],
+ [":green_apple:", "๐"],
+ [":peach:", "๐"],
+ [":cherries:", "๐"],
+ [":strawberry:", "๐"],
+ [":hamburger:", "๐"],
+ [":pizza:", "๐"],
+ [":meat_on_bone:", "๐"],
+ [":poultry_leg:", "๐"],
+ [":rice_cracker:", "๐"],
+ [":rice_ball:", "๐"],
+ [":rice:", "๐"],
+ [":curry:", "๐"],
+ [":ramen:", "๐"],
+ [":spaghetti:", "๐"],
+ [":bread:", "๐"],
+ [":fries:", "๐"],
+ [":sweet_potato:", "๐ "],
+ [":dango:", "๐ก"],
+ [":oden:", "๐ข"],
+ [":sushi:", "๐ฃ"],
+ [":fried_shrimp:", "๐ค"],
+ [":fish_cake:", "๐ฅ"],
+ [":icecream:", "๐ฆ"],
+ [":shaved_ice:", "๐ง"],
+ [":ice_cream:", "๐จ"],
+ [":doughnut:", "๐ฉ"],
+ [":cookie:", "๐ช"],
+ [":chocolate_bar:", "๐ซ"],
+ [":candy:", "๐ฌ"],
+ [":lollipop:", "๐ญ"],
+ [":custard:", "๐ฎ"],
+ [":honey_pot:", "๐ฏ"],
+ [":cake:", "๐ฐ"],
+ [":bento:", "๐ฑ"],
+ [":stew:", "๐ฒ"],
+ [":egg:", "๐ณ"],
+ [":fork_and_knife:", "๐ด"],
+ [":tea:", "๐ต"],
+ [":sake:", "๐ถ"],
+ [":wine_glass:", "๐ท"],
+ [":cocktail:", "๐ธ"],
+ [":tropical_drink:", "๐น"],
+ [":beer:", "๐บ"],
+ [":beers:", "๐ป"],
+ [":ribbon:", "๐"],
+ [":gift:", "๐"],
+ [":birthday:", "๐"],
+ [":jack_o_lantern:", "๐"],
+ [":christmas_tree:", "๐"],
+ [":santa:", "๐
"],
+ [":fireworks:", "๐"],
+ [":sparkler:", "๐"],
+ [":balloon:", "๐"],
+ [":tada:", "๐"],
+ [":confetti_ball:", "๐"],
+ [":tanabata_tree:", "๐"],
+ [":crossed_flags:", "๐"],
+ [":bamboo:", "๐"],
+ [":dolls:", "๐"],
+ [":flags:", "๐"],
+ [":wind_chime:", "๐"],
+ [":rice_scene:", "๐"],
+ [":school_satchel:", "๐"],
+ [":mortar_board:", "๐"],
+ [":carousel_horse:", "๐ "],
+ [":ferris_wheel:", "๐ก"],
+ [":roller_coaster:", "๐ข"],
+ [":fishing_pole_and_fish:", "๐ฃ"],
+ [":microphone:", "๐ค"],
+ [":movie_camera:", "๐ฅ"],
+ [":cinema:", "๐ฆ"],
+ [":headphones:", "๐ง"],
+ [":art:", "๐จ"],
+ [":tophat:", "๐ฉ"],
+ [":circus_tent:", "๐ช"],
+ [":ticket:", "๐ซ"],
+ [":clapper:", "๐ฌ"],
+ [":performing_arts:", "๐ญ"],
+ [":video_game:", "๐ฎ"],
+ [":dart:", "๐ฏ"],
+ [":slot_machine:", "๐ฐ"],
+ [":_8ball:", "๐ฑ"],
+ [":game_die:", "๐ฒ"],
+ [":bowling:", "๐ณ"],
+ [":flower_playing_cards:", "๐ด"],
+ [":musical_note:", "๐ต"],
+ [":notes:", "๐ถ"],
+ [":saxophone:", "๐ท"],
+ [":guitar:", "๐ธ"],
+ [":musical_keyboard:", "๐น"],
+ [":trumpet:", "๐บ"],
+ [":violin:", "๐ป"],
+ [":musical_score:", "๐ผ"],
+ [":running_shirt_with_sash:", "๐ฝ"],
+ [":tennis:", "๐พ"],
+ [":ski:", "๐ฟ"],
+ [":basketball:", "๐"],
+ [":checkered_flag:", "๐"],
+ [":snowboarder:", "๐"],
+ [":runner:", "๐"],
+ [":surfer:", "๐"],
+ [":trophy:", "๐"],
+ [":football:", "๐"],
+ [":swimmer:", "๐"],
+ [":house:", "๐ "],
+ [":house_with_garden:", "๐ก"],
+ [":office:", "๐ข"],
+ [":post_office:", "๐ฃ"],
+ [":hospital:", "๐ฅ"],
+ [":bank:", "๐ฆ"],
+ [":atm:", "๐ง"],
+ [":hotel:", "๐จ"],
+ [":love_hotel:", "๐ฉ"],
+ [":convenience_store:", "๐ช"],
+ [":school:", "๐ซ"],
+ [":department_store:", "๐ฌ"],
+ [":factory:", "๐ญ"],
+ [":izakaya_lantern:", "๐ฎ"],
+ [":japanese_castle:", "๐ฏ"],
+ [":european_castle:", "๐ฐ"],
+ [":snail:", "๐"],
+ [":snake:", "๐"],
+ [":racehorse:", "๐"],
+ [":sheep:", "๐"],
+ [":monkey:", "๐"],
+ [":chicken:", "๐"],
+ [":boar:", "๐"],
+ [":elephant:", "๐"],
+ [":octopus:", "๐"],
+ [":shell:", "๐"],
+ [":bug:", "๐"],
+ [":ant:", "๐"],
+ [":bee:", "๐"],
+ [":beetle:", "๐"],
+ [":fish:", "๐"],
+ [":tropical_fish:", "๐ "],
+ [":blowfish:", "๐ก"],
+ [":turtle:", "๐ข"],
+ [":hatching_chick:", "๐ฃ"],
+ [":baby_chick:", "๐ค"],
+ [":hatched_chick:", "๐ฅ"],
+ [":bird:", "๐ฆ"],
+ [":penguin:", "๐ง"],
+ [":koala:", "๐จ"],
+ [":poodle:", "๐ฉ"],
+ [":camel:", "๐ซ"],
+ [":dolphin:", "๐ฌ"],
+ [":mouse:", "๐ญ"],
+ [":cow:", "๐ฎ"],
+ [":tiger:", "๐ฏ"],
+ [":rabbit:", "๐ฐ"],
+ [":cat:", "๐ฑ"],
+ [":dragon_face:", "๐ฒ"],
+ [":whale:", "๐ณ"],
+ [":horse:", "๐ด"],
+ [":monkey_face:", "๐ต"],
+ [":dog:", "๐ถ"],
+ [":pig:", "๐ท"],
+ [":frog:", "๐ธ"],
+ [":hamster:", "๐น"],
+ [":wolf:", "๐บ"],
+ [":bear:", "๐ป"],
+ [":panda_face:", "๐ผ"],
+ [":pig_nose:", "๐ฝ"],
+ [":feet:", "๐พ"],
+ [":eyes:", "๐"],
+ [":ear:", "๐"],
+ [":nose:", "๐"],
+ [":lips:", "๐"],
+ [":tongue:", "๐
"],
+ [":point_up_2:", "๐"],
+ [":point_down:", "๐"],
+ [":point_left:", "๐"],
+ [":point_right:", "๐"],
+ [":punch:", "๐"],
+ [":wave:", "๐"],
+ [":ok_hand:", "๐"],
+ [":thumbsup:", "๐"],
+ [":thumbsdown:", "๐"],
+ [":clap:", "๐"],
+ [":open_hands:", "๐"],
+ [":crown:", "๐"],
+ [":womans_hat:", "๐"],
+ [":eyeglasses:", "๐"],
+ [":necktie:", "๐"],
+ [":shirt:", "๐"],
+ [":jeans:", "๐"],
+ [":dress:", "๐"],
+ [":kimono:", "๐"],
+ [":bikini:", "๐"],
+ [":womans_clothes:", "๐"],
+ [":purse:", "๐"],
+ [":handbag:", "๐"],
+ [":pouch:", "๐"],
+ [":mans_shoe:", "๐"],
+ [":athletic_shoe:", "๐"],
+ [":high_heel:", "๐ "],
+ [":sandal:", "๐ก"],
+ [":boot:", "๐ข"],
+ [":footprints:", "๐ฃ"],
+ [":bust_in_silhouette:", "๐ค"],
+ [":boy:", "๐ฆ"],
+ [":girl:", "๐ง"],
+ [":man:", "๐จ"],
+ [":woman:", "๐ฉ"],
+ [":family:", "๐ช"],
+ [":couple:", "๐ซ"],
+ [":cop:", "๐ฎ"],
+ [":dancers:", "๐ฏ"],
+ [":bride_with_veil:", "๐ฐ"],
+ [":person_with_blond_hair:", "๐ฑ"],
+ [":man_with_gua_pi_mao:", "๐ฒ"],
+ [":man_with_turban:", "๐ณ"],
+ [":older_man:", "๐ด"],
+ [":older_woman:", "๐ต"],
+ [":baby:", "๐ถ"],
+ [":construction_worker:", "๐ท"],
+ [":princess:", "๐ธ"],
+ [":japanese_ogre:", "๐น"],
+ [":japanese_goblin:", "๐บ"],
+ [":ghost:", "๐ป"],
+ [":angel:", "๐ผ"],
+ [":alien:", "๐ฝ"],
+ [":space_invader:", "๐พ"],
+ [":robot_face:", "๐ค"],
+ [":imp:", "๐ฟ"],
+ [":skull:", "๐"],
+ [":information_desk_person:", "๐"],
+ [":guardsman:", "๐"],
+ [":dancer:", "๐"],
+ [":lipstick:", "๐"],
+ [":nail_care:", "๐
"],
+ [":massage:", "๐"],
+ [":haircut:", "๐"],
+ [":barber:", "๐"],
+ [":syringe:", "๐"],
+ [":pill:", "๐"],
+ [":kiss:", "๐"],
+ [":love_letter:", "๐"],
+ [":ring:", "๐"],
+ [":gem:", "๐"],
+ [":couplekiss:", "๐"],
+ [":bouquet:", "๐"],
+ [":couple_with_heart:", "๐"],
+ [":wedding:", "๐"],
+ [":heartbeat:", "๐"],
+ [":broken_heart:", "๐"],
+ [":two_hearts:", "๐"],
+ [":sparkling_heart:", "๐"],
+ [":heartpulse:", "๐"],
+ [":cupid:", "๐"],
+ [":blue_heart:", "๐"],
+ [":green_heart:", "๐"],
+ [":yellow_heart:", "๐"],
+ [":purple_heart:", "๐"],
+ [":gift_heart:", "๐"],
+ [":revolving_hearts:", "๐"],
+ [":heart_decoration:", "๐"],
+ [":diamond_shape_with_a_dot_inside:", "๐ "],
+ [":bulb:", "๐ก"],
+ [":anger:", "๐ข"],
+ [":bomb:", "๐ฃ"],
+ [":zzz:", "๐ค"],
+ [":boom:", "๐ฅ"],
+ [":sweat_drops:", "๐ฆ"],
+ [":droplet:", "๐ง"],
+ [":dash:", "๐จ"],
+ [":poop:", "๐ฉ"],
+ [":muscle:", "๐ช"],
+ [":dizzy:", "๐ซ"],
+ [":speech_balloon:", "๐ฌ"],
+ [":white_flower:", "๐ฎ"],
+ [":_100:", "๐ฏ"],
+ [":moneybag:", "๐ฐ"],
+ [":currency_exchange:", "๐ฑ"],
+ [":heavy_dollar_sign:", "๐ฒ"],
+ [":credit_card:", "๐ณ"],
+ [":yen:", "๐ด"],
+ [":dollar:", "๐ต"],
+ [":money_with_wings:", "๐ธ"],
+ [":chart:", "๐น"],
+ [":seat:", "๐บ"],
+ [":computer:", "๐ป"],
+ [":briefcase:", "๐ผ"],
+ [":minidisc:", "๐ฝ"],
+ [":floppy_disk:", "๐พ"],
+ [":cd:", "๐ฟ"],
+ [":dvd:", "๐"],
+ [":file_folder:", "๐"],
+ [":open_file_folder:", "๐"],
+ [":page_with_curl:", "๐"],
+ [":page_facing_up:", "๐"],
+ [":date:", "๐
"],
+ [":calendar:", "๐"],
+ [":card_index:", "๐"],
+ [":chart_with_upwards_trend:", "๐"],
+ [":chart_with_downwards_trend:", "๐"],
+ [":bar_chart:", "๐"],
+ [":clipboard:", "๐"],
+ [":pushpin:", "๐"],
+ [":round_pushpin:", "๐"],
+ [":paperclip:", "๐"],
+ [":straight_ruler:", "๐"],
+ [":triangular_ruler:", "๐"],
+ [":bookmark_tabs:", "๐"],
+ [":ledger:", "๐"],
+ [":notebook:", "๐"],
+ [":notebook_with_decorative_cover:", "๐"],
+ [":closed_book:", "๐"],
+ [":book:", "๐"],
+ [":green_book:", "๐"],
+ [":blue_book:", "๐"],
+ [":orange_book:", "๐"],
+ [":books:", "๐"],
+ [":name_badge:", "๐"],
+ [":scroll:", "๐"],
+ [":pencil:", "๐"],
+ [":telephone_receiver:", "๐"],
+ [":pager:", "๐"],
+ [":fax:", "๐ "],
+ [":satellite:", "๐ก"],
+ [":loudspeaker:", "๐ข"],
+ [":mega:", "๐ฃ"],
+ [":outbox_tray:", "๐ค"],
+ [":inbox_tray:", "๐ฅ"],
+ [":package:", "๐ฆ"],
+ [":e_mail:", "๐ง"],
+ [":incoming_envelope:", "๐จ"],
+ [":envelope_with_arrow:", "๐ฉ"],
+ [":mailbox_closed:", "๐ช"],
+ [":mailbox:", "๐ซ"],
+ [":postbox:", "๐ฎ"],
+ [":newspaper:", "๐ฐ"],
+ [":iphone:", "๐ฑ"],
+ [":calling:", "๐ฒ"],
+ [":vibration_mode:", "๐ณ"],
+ [":mobile_phone_off:", "๐ด"],
+ [":signal_strength:", "๐ถ"],
+ [":camera:", "๐ท"],
+ [":video_camera:", "๐น"],
+ [":tv:", "๐บ"],
+ [":radio:", "๐ป"],
+ [":vhs:", "๐ผ"],
+ [":arrows_clockwise:", "๐"],
+ [":loud_sound:", "๐"],
+ [":battery:", "๐"],
+ [":electric_plug:", "๐"],
+ [":mag:", "๐"],
+ [":mag_right:", "๐"],
+ [":lock_with_ink_pen:", "๐"],
+ [":closed_lock_with_key:", "๐"],
+ [":key:", "๐"],
+ [":lock:", "๐"],
+ [":unlock:", "๐"],
+ [":bell:", "๐"],
+ [":bookmark:", "๐"],
+ [":link:", "๐"],
+ [":radio_button:", "๐"],
+ [":back:", "๐"],
+ [":end:", "๐"],
+ [":on:", "๐"],
+ [":soon:", "๐"],
+ [":top:", "๐"],
+ [":underage:", "๐"],
+ [":keycap_ten:", "๐"],
+ [":capital_abcd:", "๐ "],
+ [":abcd:", "๐ก"],
+ [":_1234:", "๐ข"],
+ [":symbols:", "๐ฃ"],
+ [":abc:", "๐ค"],
+ [":fire:", "๐ฅ"],
+ [":flashlight:", "๐ฆ"],
+ [":wrench:", "๐ง"],
+ [":hammer:", "๐จ"],
+ [":nut_and_bolt:", "๐ฉ"],
+ [":knife:", "๐ช"],
+ [":gun:", "๐ซ"],
+ [":crystal_ball:", "๐ฎ"],
+ [":six_pointed_star:", "๐ฏ"],
+ [":beginner:", "๐ฐ"],
+ [":trident:", "๐ฑ"],
+ [":black_square_button:", "๐ฒ"],
+ [":white_square_button:", "๐ณ"],
+ [":red_circle:", "๐ด"],
+ [":large_blue_circle:", "๐ต"],
+ [":large_orange_diamond:", "๐ถ"],
+ [":large_blue_diamond:", "๐ท"],
+ [":small_orange_diamond:", "๐ธ"],
+ [":small_blue_diamond:", "๐น"],
+ [":small_red_triangle:", "๐บ"],
+ [":small_red_triangle_down:", "๐ป"],
+ [":arrow_up_small:", "๐ผ"],
+ [":arrow_down_small:", "๐ฝ"],
+ [":clock1:", "๐"],
+ [":clock2:", "๐"],
+ [":clock3:", "๐"],
+ [":clock4:", "๐"],
+ [":clock5:", "๐"],
+ [":clock6:", "๐"],
+ [":clock7:", "๐"],
+ [":clock8:", "๐"],
+ [":clock9:", "๐"],
+ [":clock10:", "๐"],
+ [":clock11:", "๐"],
+ [":clock12:", "๐"],
+ [":mount_fuji:", "๐ป"],
+ [":tokyo_tower:", "๐ผ"],
+ [":statue_of_liberty:", "๐ฝ"],
+ [":japan:", "๐พ"],
+ [":moyai:", "๐ฟ"],
+ [":grin:", "๐"],
+ [":joy:", "๐"],
+ [":smiley:", "๐"],
+ [":smile:", "๐"],
+ [":sweat_smile:", "๐
"],
+ [":laughing:", "๐"],
+ [":wink:", "๐"],
+ [":blush:", "๐"],
+ [":yum:", "๐"],
+ [":relieved:", "๐"],
+ [":heart_eyes:", "๐"],
+ [":smirk:", "๐"],
+ [":unamused:", "๐"],
+ [":sweat:", "๐"],
+ [":pensive:", "๐"],
+ [":confounded:", "๐"],
+ [":kissing_heart:", "๐"],
+ [":kissing_closed_eyes:", "๐"],
+ [":stuck_out_tongue_winking_eye:", "๐"],
+ [":stuck_out_tongue_closed_eyes:", "๐"],
+ [":disappointed:", "๐"],
+ [":angry:", "๐ "],
+ [":rage:", "๐ก"],
+ [":cry:", "๐ข"],
+ [":persevere:", "๐ฃ"],
+ [":triumph:", "๐ค"],
+ [":disappointed_relieved:", "๐ฅ"],
+ [":fearful:", "๐จ"],
+ [":weary:", "๐ฉ"],
+ [":sleepy:", "๐ช"],
+ [":tired_face:", "๐ซ"],
+ [":sob:", "๐ญ"],
+ [":cold_sweat:", "๐ฐ"],
+ [":scream:", "๐ฑ"],
+ [":astonished:", "๐ฒ"],
+ [":flushed:", "๐ณ"],
+ [":dizzy_face:", "๐ต"],
+ [":mask:", "๐ท"],
+ [":smile_cat:", "๐ธ"],
+ [":joy_cat:", "๐น"],
+ [":smiley_cat:", "๐บ"],
+ [":heart_eyes_cat:", "๐ป"],
+ [":smirk_cat:", "๐ผ"],
+ [":kissing_cat:", "๐ฝ"],
+ [":pouting_cat:", "๐พ"],
+ [":crying_cat_face:", "๐ฟ"],
+ [":scream_cat:", "๐"],
+ [":no_good:", "๐
"],
+ [":ok_woman:", "๐"],
+ [":bow:", "๐"],
+ [":see_no_evil:", "๐"],
+ [":hear_no_evil:", "๐"],
+ [":speak_no_evil:", "๐"],
+ [":raising_hand:", "๐"],
+ [":raised_hands:", "๐"],
+ [":person_frowning:", "๐"],
+ [":person_with_pouting_face:", "๐"],
+ [":pray:", "๐"],
+ [":rocket:", "๐"],
+ [":railway_car:", "๐"],
+ [":bullettrain_side:", "๐"],
+ [":bullettrain_front:", "๐
"],
+ [":metro:", "๐"],
+ [":station:", "๐"],
+ [":bus:", "๐"],
+ [":busstop:", "๐"],
+ [":ambulance:", "๐"],
+ [":fire_engine:", "๐"],
+ [":police_car:", "๐"],
+ [":taxi:", "๐"],
+ [":red_car:", "๐"],
+ [":blue_car:", "๐"],
+ [":truck:", "๐"],
+ [":ship:", "๐ข"],
+ [":speedboat:", "๐ค"],
+ [":traffic_light:", "๐ฅ"],
+ [":construction:", "๐ง"],
+ [":rotating_light:", "๐จ"],
+ [":triangular_flag_on_post:", "๐ฉ"],
+ [":door:", "๐ช"],
+ [":no_entry_sign:", "๐ซ"],
+ [":smoking:", "๐ฌ"],
+ [":no_smoking:", "๐ญ"],
+ [":bike:", "๐ฒ"],
+ [":walking:", "๐ถ"],
+ [":mens:", "๐น"],
+ [":womens:", "๐บ"],
+ [":restroom:", "๐ป"],
+ [":baby_symbol:", "๐ผ"],
+ [":toilet:", "๐ฝ"],
+ [":wc:", "๐พ"],
+ [":bath:", "๐"],
+ [":articulated_lorry:", "๐"],
+ [":kissing_smiling_eyes:", "๐"],
+ [":pear:", "๐"],
+ [":bicyclist:", "๐ด"],
+ [":rabbit2:", "๐"],
+ [":clock830:", "๐ฃ"],
+ [":train:", "๐"],
+ [":oncoming_automobile:", "๐"],
+ [":expressionless:", "๐"],
+ [":smiling_imp:", "๐"],
+ [":frowning:", "๐ฆ"],
+ [":no_mouth:", "๐ถ"],
+ [":baby_bottle:", "๐ผ"],
+ [":non_potable_water:", "๐ฑ"],
+ [":open_mouth:", "๐ฎ"],
+ [":last_quarter_moon_with_face:", "๐"],
+ [":do_not_litter:", "๐ฏ"],
+ [":sunglasses:", "๐"],
+ [":loop:", "โฟ"],
+ [":last_quarter_moon:", "๐"],
+ [":grinning:", "๐"],
+ [":euro:", "๐ถ"],
+ [":clock330:", "๐"],
+ [":telescope:", "๐ญ"],
+ [":globe_with_meridians:", "๐"],
+ [":postal_horn:", "๐ฏ"],
+ [":stuck_out_tongue:", "๐"],
+ [":clock1030:", "๐ฅ"],
+ [":pound:", "๐ท"],
+ [":two_men_holding_hands:", "๐ฌ"],
+ [":tiger2:", "๐
"],
+ [":anguished:", "๐ง"],
+ [":vertical_traffic_light:", "๐ฆ"],
+ [":confused:", "๐"],
+ [":repeat:", "๐"],
+ [":oncoming_police_car:", "๐"],
+ [":tram:", "๐"],
+ [":dragon:", "๐"],
+ [":earth_americas:", "๐"],
+ [":rugby_football:", "๐"],
+ [":left_luggage:", "๐
"],
+ [":sound:", "๐"],
+ [":clock630:", "๐ก"],
+ [":dromedary_camel:", "๐ช"],
+ [":oncoming_bus:", "๐"],
+ [":horse_racing:", "๐"],
+ [":rooster:", "๐"],
+ [":rowboat:", "๐ฃ"],
+ [":customs:", "๐"],
+ [":repeat_one:", "๐"],
+ [":waxing_crescent_moon:", "๐"],
+ [":mountain_railway:", "๐"],
+ [":clock930:", "๐ค"],
+ [":put_litter_in_its_place:", "๐ฎ"],
+ [":arrows_counterclockwise:", "๐"],
+ [":clock130:", "๐"],
+ [":goat:", "๐"],
+ [":pig2:", "๐"],
+ [":innocent:", "๐"],
+ [":no_bicycles:", "๐ณ"],
+ [":light_rail:", "๐"],
+ [":whale2:", "๐"],
+ [":train2:", "๐"],
+ [":earth_africa:", "๐"],
+ [":shower:", "๐ฟ"],
+ [":waning_gibbous_moon:", "๐"],
+ [":steam_locomotive:", "๐"],
+ [":cat2:", "๐"],
+ [":tractor:", "๐"],
+ [":thought_balloon:", "๐ญ"],
+ [":two_women_holding_hands:", "๐ญ"],
+ [":full_moon_with_face:", "๐"],
+ [":mouse2:", "๐"],
+ [":clock430:", "๐"],
+ [":worried:", "๐"],
+ [":rat:", "๐"],
+ [":ram:", "๐"],
+ [":dog2:", "๐"],
+ [":kissing:", "๐"],
+ [":helicopter:", "๐"],
+ [":clock1130:", "๐ฆ"],
+ [":no_mobile_phones:", "๐ต"],
+ [":european_post_office:", "๐ค"],
+ [":ox:", "๐"],
+ [":mountain_cableway:", "๐ "],
+ [":sleeping:", "๐ด"],
+ [":cow2:", "๐"],
+ [":minibus:", "๐"],
+ [":clock730:", "๐ข"],
+ [":aerial_tramway:", "๐ก"],
+ [":speaker:", "๐"],
+ [":no_bell:", "๐"],
+ [":mailbox_with_mail:", "๐ฌ"],
+ [":no_pedestrians:", "๐ท"],
+ [":microscope:", "๐ฌ"],
+ [":bathtub:", "๐"],
+ [":suspension_railway:", "๐"],
+ [":crocodile:", "๐"],
+ [":mountain_bicyclist:", "๐ต"],
+ [":waning_crescent_moon:", "๐"],
+ [":monorail:", "๐"],
+ [":children_crossing:", "๐ธ"],
+ [":clock230:", "๐"],
+ [":busts_in_silhouette:", "๐ฅ"],
+ [":mailbox_with_no_mail:", "๐ญ"],
+ [":leopard:", "๐"],
+ [":deciduous_tree:", "๐ณ"],
+ [":oncoming_taxi:", "๐"],
+ [":lemon:", "๐"],
+ [":mute:", "๐"],
+ [":baggage_claim:", "๐"],
+ [":twisted_rightwards_arrows:", "๐"],
+ [":sun_with_face:", "๐"],
+ [":trolleybus:", "๐"],
+ [":evergreen_tree:", "๐ฒ"],
+ [":passport_control:", "๐"],
+ [":new_moon_with_face:", "๐"],
+ [":potable_water:", "๐ฐ"],
+ [":high_brightness:", "๐"],
+ [":low_brightness:", "๐
"],
+ [":clock530:", "๐ "],
+ [":hushed:", "๐ฏ"],
+ [":grimacing:", "๐ฌ"],
+ [":water_buffalo:", "๐"],
+ [":neutral_face:", "๐"],
+ [":clock1230:", "๐ง"],
+ [":P", "๐" ],
+ [":)", "๐" ],
+ [":D", "๐" ],
+ [":o", "๐ฎ" ],
+ [":O", "๐ฎ" ],
+ [":(", "โน๏ธ" ],
+ [":|", "๐" ],
+];
+
+// ===========================================================================
+
+// ===========================================================================
+
function makeLargeNumberReadable(num) {
return new Number(num).toLocaleString("en-US");
}
@@ -1459,4 +2416,275 @@ function getConsoleClient() {
}
}
+// ===========================================================================
+
+function getServerColours() {
+ return serverColours;
+}
+
+// ===========================================================================
+
+function getColourByType(typeName) {
+ return getServerColours().byType[typeName];
+}
+
+// ===========================================================================
+
+function getColourByName(colourName) {
+ return getServerColours().byName[colourName];
+}
+
+// ===========================================================================
+
+function getHexColourByName(colourName) {
+ //let rgbaColour = getServerColours().byName[colourName];
+ //let rgbaArray = rgbaArrayFromToColour(rgbaColour);
+ //return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
+
+ return `#${getServerColours().hex.byName[colourName]}`;
+}
+
+// ===========================================================================
+
+function getHexColourByType(colourName) {
+ //let rgbaColour = getServerColours().byType[colourName];
+ //let rgbaArray = rgbaArrayFromToColour(rgbaColour);
+ //return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
+
+ return `#${getServerColours().hex.byType[colourName]}`;
+}
+
+// ===========================================================================
+
+function getPlayerColour(client) {
+ if(getPlayerData(client) != false) {
+ if(!isPlayerLoggedIn(client)) {
+ return getColourByName("darkGrey");
+ } else {
+ if(isPlayerWorking(client)) {
+ return getJobData(getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client).job)).colour;
+ }
+ }
+ }
+
+ return getColourByName("civilianWhite");
+}
+
+// ===========================================================================
+
+/**
+ * Gets the red/green colour depending on bool (red = false, green = true) for inline use in chatbox messages
+ *
+ * @param {Boolean} boolValue The boolean value
+ * @return {String} Red or green inline HEX colour string
+ *
+ */
+function getBoolRedGreenInlineColour(boolValue) {
+ return (!boolValue) ? "{softRed}" : "{softGreen}";
+}
+
+// ===========================================================================
+
+/**
+ * Gets an array of RGB colour values from a HEX colour string
+ *
+ * @param {String} hexColour Hex colour string
+ * @return {Array} 3-slot array where each slot is an RGB colour value
+ *
+ */
+function hexToRgb(h) {
+ return [
+ '0x'+h[1]+h[2]|0,
+ '0x'+h[3]+h[4]|0,
+ '0x'+h[5]+h[6]|0
+ ];
+}
+
+// ===========================================================================
+
+/**
+ * Gets a HEX colour string from RGB values, without brackets (example: #FFFFFF)
+ *
+ * @param {Number} red Red RGB value
+ * @param {Number} green Green RGB value
+ * @param {Number} blue Blue RGB value
+ * @return {String} HEX colour string
+ *
+ */
+function rgbToHex(r, g, b) {
+ return "#"+((1<<24)+(r<<16)+(g<<8)+ b).toString(16).slice(1);
+}
+
+// ===========================================================================
+
+/**
+ * Gets the current colour for a player (affected by job and status)
+ *
+ * @param {Client} client Player client
+ * @return {Number} Colour integer
+ *
+ */
+function getClientChatColour(client) {
+ let tempJob = getPlayerCurrentSubAccount(client).job;
+ if(tempJob != -1) {
+ if(getPlayerData(client).isWorking) {
+ return getJobData(tempJob).jobColour;
+ }
+ }
+ return getColourByName("white");
+}
+
+// ===========================================================================
+
+/**
+ * Gets a toColour-created colour integer with random RGB values (alpha is always 255)
+ *
+ * @return {Number} Colour integer
+ *
+ */
+function getRandomRGB() {
+ return toColour.apply(null, [
+ getRandom(0, 255),
+ getRandom(0, 255),
+ getRandom(0, 255),
+ 255
+ ]);
+}
+
+// ===========================================================================
+
+/**
+ * Gets a hex formatting colour by name for use inline in chatbox messages (example: [#FFFFFF]).
+ *
+ * @param {String} colourName - Colour name
+ * @return {String} HEX-formatted colour string with brackets
+ *
+ */
+function getInlineChatColourByName(colourName) {
+ return `{${colourName}}`;
+}
+
+// ===========================================================================
+
+/**
+ * Gets a hex formatting colour by type for use inline in chatbox messages (example: [#FFFFFF]).
+ *
+ * @param {String} colourName - Colour type
+ * @return {String} HEX-formatted colour string with brackets
+ *
+ */
+function getInlineChatColourByType(colourName) {
+ return `{${colourName}}`;
+}
+
+// ===========================================================================
+
+/**
+ * Gets an array of RGBA colour values from a toColour integer.
+ *
+ * @param {Number} colour - Colour integer created by toColour
+ * @return {Array} 4-slot array where each slot is an RGBA colour value
+ *
+ */
+function rgbaArrayFromToColour(colour) {
+ //return [
+ // (colour >> 24) & 0xFF, // red
+ // (colour >> 16) & 0xFF,
+ // (colour >> 8) & 0xFF,
+ // colour & 0xFF // alpha
+ //];
+ return [
+ (colour >> 16) & 0xFF, // red
+ (colour >> 8) & 0xFF,
+ colour & 0xFF,
+ (colour >> 24) & 0xFF// alpha
+ ];
+}
+
+// ===========================================================================
+
+function hexFromToColour(colour) {
+ let rgba = rgbaArrayFromToColour(colour);
+ return rgbToHex(rgba[0], rgba[1], rgba[2]);
+}
+
+// ===========================================================================
+
+function replaceColoursInMessage(messageText) {
+ if(messageText == null) {
+ return "";
+ }
+
+ let tempFind = `{RESETCOLOUR}`;
+ let tempRegex = new RegExp(tempFind, 'g');
+ messageText = messageText.replace(tempRegex, "[/#]");
+
+ tempFind = `{ALTCOLOUR}`;
+ tempRegex = new RegExp(tempFind, 'g');
+ messageText = messageText.replace(tempRegex, "[#C8C8C8]");
+
+ tempFind = `{MAINCOLOUR}`;
+ tempRegex = new RegExp(tempFind, 'g');
+ messageText = messageText.replace(tempRegex, "[#FFFFFF]");
+
+ for(let i in getServerColours().hex.byName) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, `[#${getServerColours().hex.byName[i]}]`);
+ }
+
+ for(let i in getServerColours().hex.byType) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, `[#${getServerColours().hex.byType[i]}]`);
+ }
+
+ return messageText;
+}
+
+// ===========================================================================
+
+function removeColoursInMessage(messageText) {
+ if(messageText == null) {
+ return "";
+ }
+
+ let tempFind = `{RESETCOLOUR}`;
+ let tempRegex = new RegExp(tempFind, 'g');
+ messageText = messageText.replace(tempRegex, "");
+
+ tempFind = `{ALTCOLOUR}`;
+ tempRegex = new RegExp(tempFind, 'g');
+ messageText = messageText.replace(tempRegex, "");
+
+ tempFind = `{MAINCOLOUR}`;
+ tempRegex = new RegExp(tempFind, 'g');
+ messageText = messageText.replace(tempRegex, "");
+
+ for(let i in getServerColours().hex.byName) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, "");
+ }
+
+ for(let i in getServerColours().hex.byType) {
+ let find = `{${i}}`;
+ let re = new RegExp(find, 'g');
+ messageText = messageText.replace(re, "");
+ }
+
+ return messageText;
+}
+
+// ===========================================================================
+
+function replaceEmojiInString(messageString) {
+ for(let i in emojiReplaceString) {
+ while(messageString.indexOf(emojiReplaceString[i][0]) != -1) {
+ messageString = messageString.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
+ }
+ }
+ return messageString;
+}
+
// ===========================================================================
\ No newline at end of file
From 41542493d895942e12406ea19006afdd6a00fc0e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 25 Feb 2022 05:28:46 -0600
Subject: [PATCH 011/609] Add interior positions for IV
---
scripts/shared/gamedata.js | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index 497dcdbb..d22f28e4 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -4386,7 +4386,34 @@ let gameData = {
},
{ // GTA IV
-
+ Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
+ House1: [toVector3(-426.16, 1466.52, 38.971), 0],
+ House2: [toVector3(-969.77, 883.27, 18.817), 0],
+ House3: [toVector3(95.75, 851.68, 45.051), 0],
+ House4: [toVector3(603.04, 1404.06, 17.479), 0],
+ House5: [toVector3(892.56, -502.13, 19.407), 0],
+ House6: [toVector3(-524.09, 830.54, 23.627), 0],
+ House7: [toVector3(806.36, 146.68, 29.243), 0],
+ House8: [toVector3(356.91, 1511.28, 21.432), 0],
+ House9: [toVector3(1319.40, -847.02, 8.872), 0],
+ House10: [toVector3(1331.40, 126.60, 36.558), 0],
+ House11: [toVector3(1387.81, 622.66, 35.857), 0],
+ House12: [toVector3(932.74, -189.29, 35.143), 0],
+ House13: [toVector3(-1397.85, 1473.89, 26.447), 0],
+ House14: [toVector3(806.36, 146.68, 29.243), 0],
+ House15: [toVector3(-526.49, 829.41, 23.627), 0],
+ Gym: [toVector3(403.31, 1480.32, 11.834), 0],
+ PoliceStation: [toVector3(-406.52, 286.57, 13.682), 0],
+ FancyRestaurant: [toVector3(-118.24, -259.06, 12.654), 0],
+ Basement: [toVector3(1304.38, -856.66, 5.490), 0],
+ Office1: [toVector3(-409.31, 285.49, 18.592), 0],
+ Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
+ Office3: [toVector3(817.64, -259.77, 15.343), 0],
+ Office4: [toVector3(-86.35, 56.70, 75.953), 0],
+ HospitalRoom: [toVector3(1240.00, 192.44, 33.553), 0],
+ Church: [toVector3(-286.72, -282.36, 15.632), 0],
+ Prison: [toVector3(-1082.69, -364.05, 7.404), 0],
+ Ship: [toVector3(-336.53, -1494.56, 9.945), 0],
},
{}, // GTA IV EFLC
From 36cecc1955218d57106afc8bcde4d1a8cb28b7cf Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 25 Feb 2022 05:29:00 -0600
Subject: [PATCH 012/609] Vehicle fires
---
scripts/client/event.js | 1 +
scripts/client/utilities.js | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 03ae0839..c2c9b340 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -95,6 +95,7 @@ function onProcess(event, deltaTime) {
processGameSpecifics();
processNearbyPickups();
processVehiclePurchasing();
+ processVehicleFires();
}
// ===========================================================================
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 478530ee..bbf48cb2 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -901,4 +901,19 @@ function setVehiclePurchaseState(state, vehicleId, position) {
vehiclePurchasePosition = position;
}
+// ===========================================================================
+
+function processVehicleFires() {
+ let vehicles = getElementsByType(ELEMENT_VEHICLE);
+ for(let i in vehicles) {
+ if(vehicles[i].isSyncer) {
+ if(!doesEntityDataExist(vehicles[i], "vrr.fire")) {
+ triggerNetworkEvent("vrr.vehFire", vehicles[i].id);
+ } else {
+ vehicles[i].health = 249;
+ }
+ }
+ }
+}
+
// ===========================================================================
\ No newline at end of file
From f3c61a3bb660aaa79bdab581d966d76b6b920972 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 10 Mar 2022 10:43:28 -0600
Subject: [PATCH 013/609] Woops missing bracket
---
scripts/client/event.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index b07a21cc..a281fa9d 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -96,6 +96,7 @@ function onProcess(event, deltaTime) {
processNearbyPickups();
processVehiclePurchasing();
//processVehicleFires();
+}
// ===========================================================================
From 24e70233cb82371c6a81a413bae32fc44f78dc06 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 10 Mar 2022 10:43:47 -0600
Subject: [PATCH 014/609] Fixed locale string syntax issue
---
scripts/server/business.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index b6bb7d66..3e9faaa2 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -1765,9 +1765,9 @@ function buyFromBusinessCommand(command, params, client) {
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
let keyData = getPlayerKeyBindForCommand("inv");
- messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip"), `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`);
+ messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
} else {
- messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip"), `{ALTCOLOUR}/inv{MAINCOLOUR}`);
+ messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
}
}
From 78330aa4b1ad93b0ec138db7180d4511cee37a33 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 11 Mar 2022 02:47:59 -0600
Subject: [PATCH 015/609] Use normal chat for now
---
scripts/client/chatbox.js | 1 +
scripts/client/event.js | 7 ++++++
scripts/server/chat.js | 43 +++++++++++++++++++++----------------
scripts/server/client.js | 5 ++---
scripts/server/messaging.js | 10 ++++++++-
5 files changed, 43 insertions(+), 23 deletions(-)
diff --git a/scripts/client/chatbox.js b/scripts/client/chatbox.js
index d74eb237..64e454f6 100644
--- a/scripts/client/chatbox.js
+++ b/scripts/client/chatbox.js
@@ -46,6 +46,7 @@ function unBindChatBoxKeys() {
// ===========================================================================
function receiveChatBoxMessageFromServer(messageString, colour) {
+ logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Received chatbox message from server: ${messageString}`);
let colouredString = replaceColoursInMessage(messageString);
if(bottomMessageIndex >= chatBoxHistory.length-1) {
diff --git a/scripts/client/event.js b/scripts/client/event.js
index a281fa9d..2bc8a09d 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -224,4 +224,11 @@ function onLocalPlayerSwitchWeapon(oldWeapon, newWeapon) {
function onCameraProcess(event) {
}
+// ===========================================================================
+
+function onChatOutput(event, messageText, colour) {
+ //event.preventDefault();
+ //receiveChatBoxMessageFromServer(messageText, colour);
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index 29678550..554dbeaa 100644
--- a/scripts/server/chat.js
+++ b/scripts/server/chat.js
@@ -16,28 +16,33 @@ function initChatScript() {
// ===========================================================================
function processPlayerChat(client, messageText) {
- if(!getPlayerData(client)) {
- messagePlayerError(client, "You need to login before you can chat!");
- return false;
- }
+ if(!isConsole(client)) {
+ if(!getPlayerData(client)) {
+ messagePlayerError(client, "You need to login before you can chat!");
+ return false;
+ }
- if(!isPlayerLoggedIn(client)) {
- messagePlayerError(client, "You need to login before you can chat!");
- return false;
- }
+ if(!isPlayerLoggedIn(client)) {
+ messagePlayerError(client, "You need to login before you can chat!");
+ return false;
+ }
- if(!isPlayerSpawned(client)) {
- messagePlayerError(client, "You need to spawn before you can chat!");
- return false;
- }
+ if(!isPlayerSpawned(client)) {
+ messagePlayerError(client, "You need to spawn before you can chat!");
+ return false;
+ }
- if(isPlayerMuted(client)) {
- messagePlayerError(client, "You are muted and can't chat!");
- return false;
- }
-
- messageText = messageText.substring(0, 128);
+ if(isPlayerMuted(client)) {
+ messagePlayerError(client, "You are muted and can't chat!");
+ return false;
+ }
+ messageText = messageText.substring(0, 128);
+ messagePlayerNormal(null, `๐ฌ ${getCharacterFullName(client)}: ${messageText}`);
+ } else {
+ messagePlayerNormal(null, `๐ก๏ธ (ADMIN) - ${messageText}`);
+ }
+
/*
let clients = getClients();
for(let i in clients) {
@@ -48,7 +53,7 @@ function processPlayerChat(client, messageText) {
messagePlayerNormal(clients[i], `๐ฌ ${getCharacterFullName(client)}: [#FFFFFF]${translatedText}${original}`, clients[i], getColourByName("mediumGrey"));
}
*/
- messagePlayerNormal(null, `๐ฌ ${getCharacterFullName(client)}: ${messageText}`);
+
//messageDiscordChatChannel(`๐ฌ ${getCharacterFullName(client)}: ${messageText}`);
}
diff --git a/scripts/server/client.js b/scripts/server/client.js
index ba41871d..5bd79c7c 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -520,9 +520,8 @@ function sendPlayerRemoveFromVehicle(client) {
// ===========================================================================
-function sendChatBoxMessageToPlayer(client, message, colour) {
- sendNetworkEventToPlayer("vrr.m", client, message, colour)
- //messageClient(message, client, colour);
+function sendChatBoxMessageToPlayer(client, messageText, colour) {
+ messageClient(messageText, client, colour);
}
// ===========================================================================
diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js
index c4d11285..e990d2be 100644
--- a/scripts/server/messaging.js
+++ b/scripts/server/messaging.js
@@ -37,7 +37,15 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
//}
- sendChatBoxMessageToPlayer(client, messageText, colour);
+ messageText = replaceColoursInMessage(messageText);
+
+ if(client == null) {
+ message(messageText, colour);
+ } else {
+ messageClient(messageText, client, colour);
+ }
+
+ //sendChatBoxMessageToPlayer(client, messageText, colour);
return true;
}
From d75dfe9e26da04b1f2b5c6b4ff8a81c7acec1dc6 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 12 Mar 2022 09:40:59 -0600
Subject: [PATCH 016/609] Use new config cvars
---
scripts/server/config.js | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/scripts/server/config.js b/scripts/server/config.js
index 7e286638..caf569c8 100644
--- a/scripts/server/config.js
+++ b/scripts/server/config.js
@@ -84,20 +84,20 @@ function initConfigScript() {
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
logToConsole(LOG_INFO, "[VRR.Config]: Applying server config ...");
- getServerConfig().fallingSnow = intToBool(toInteger(server.getCVar("fallingsnow")));
- getServerConfig().groundSnow = intToBool(toInteger(server.getCVar("groundsnow")));
- getServerConfig().useGUI = intToBool(toInteger(server.getCVar("gui")));
+ getServerConfig().fallingSnow = intToBool(toInteger(server.getCVar("vrr_fallingsnow")));
+ getServerConfig().groundSnow = intToBool(toInteger(server.getCVar("vrr_groundsnow")));
+ getServerConfig().useGUI = intToBool(toInteger(server.getCVar("vrr_gui")));
getServerConfig().showLogo = false;
- getServerConfig().testerOnly = intToBool(toInteger(server.getCVar("testeronly")));
+ getServerConfig().testerOnly = intToBool(toInteger(server.getCVar("vrr_testeronly")));
getServerConfig().discordEnabled = false;
- getServerConfig().createJobPickups = intToBool(toInteger(server.getCVar("jobpickups")));
- getServerConfig().createBusinessPickups = intToBool(toInteger(server.getCVar("businesspickups")));
- getServerConfig().createHousePickups = intToBool(toInteger(server.getCVar("housepickups")));
- getServerConfig().createJobBlips = intToBool(toInteger(server.getCVar("jobblips")));
- getServerConfig().createBusinessBlips = intToBool(toInteger(server.getCVar("businessblips")));
- getServerConfig().createHouseBlips = intToBool(toInteger(server.getCVar("houseblips")));
- getServerConfig().useRealTime = intToBool(toInteger(server.getCVar("realtime")));
- getServerConfig().antiCheat.enabled = intToBool(toInteger(server.getCVar("anticheat")));
+ getServerConfig().createJobPickups = intToBool(toInteger(server.getCVar("vrr_jobpickups")));
+ getServerConfig().createBusinessPickups = intToBool(toInteger(server.getCVar("vrr_businesspickups")));
+ getServerConfig().createHousePickups = intToBool(toInteger(server.getCVar("vrr_housepickups")));
+ getServerConfig().createJobBlips = intToBool(toInteger(server.getCVar("vrr_jobblips")));
+ getServerConfig().createBusinessBlips = intToBool(toInteger(server.getCVar("vrr_businessblips")));
+ getServerConfig().createHouseBlips = intToBool(toInteger(server.getCVar("vrr_houseblips")));
+ getServerConfig().useRealTime = intToBool(toInteger(server.getCVar("vrr_realtime")));
+ getServerConfig().antiCheat.enabled = intToBool(toInteger(server.getCVar("vrr_anticheat")));
applyConfigToServer(serverConfig);
logToConsole(LOG_DEBUG, "[VRR.Config]: Server config applied successfully!");
From 3c362e06a57b5345f23cd242a7bc093213bdecb3 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 13 Mar 2022 05:28:53 -0500
Subject: [PATCH 017/609] Update locale strings
---
locale/chinese.json | 3 ++-
locale/english.json | 3 ++-
locale/polish.json | 3 ++-
locale/russian.json | 3 ++-
locale/spanish.json | 3 ++-
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/locale/chinese.json b/locale/chinese.json
index 5286e7db..b3636ef5 100644
--- a/locale/chinese.json
+++ b/locale/chinese.json
@@ -393,5 +393,6 @@
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
+ "ViewInventoryCommandTip": "Use {1} to see your items",
+ "GUIAccountSettingToggle": "You have turned {1} GUI"
}
diff --git a/locale/english.json b/locale/english.json
index 5f68c88e..b7f6d5bd 100644
--- a/locale/english.json
+++ b/locale/english.json
@@ -393,5 +393,6 @@
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
+ "ViewInventoryCommandTip": "Use {1} to see your items",
+ "GUIAccountSettingToggle": "You have turned {1} GUI"
}
diff --git a/locale/polish.json b/locale/polish.json
index e38d5e1f..5057588a 100644
--- a/locale/polish.json
+++ b/locale/polish.json
@@ -393,5 +393,6 @@
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
+ "ViewInventoryCommandTip": "Use {1} to see your items",
+ "GUIAccountSettingToggle": "You have turned {1} GUI"
}
diff --git a/locale/russian.json b/locale/russian.json
index 82a535d2..c5e92804 100644
--- a/locale/russian.json
+++ b/locale/russian.json
@@ -392,5 +392,6 @@
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
+ "ViewInventoryCommandTip": "Use {1} to see your items",
+ "GUIAccountSettingToggle": "You have turned {1} GUI"
}
diff --git a/locale/spanish.json b/locale/spanish.json
index 7562b925..795432a1 100644
--- a/locale/spanish.json
+++ b/locale/spanish.json
@@ -397,5 +397,6 @@
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
- "ViewInventoryCommandTip": "Use {1} to see your items"
+ "ViewInventoryCommandTip": "Use {1} to see your items",
+ "GUIAccountSettingToggle": "You have turned {1} GUI"
}
From 7c466474f31db1faaf473fad17d4536bda06186b Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 13 Mar 2022 05:29:11 -0500
Subject: [PATCH 018/609] IV stuff
---
scripts/client/startup.js | 5 +++++
scripts/client/sync.js | 4 ++--
scripts/server/native/connected.js | 11 ++++++++++-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/scripts/client/startup.js b/scripts/client/startup.js
index bd38327f..76cd14a7 100644
--- a/scripts/client/startup.js
+++ b/scripts/client/startup.js
@@ -151,6 +151,11 @@ function setUpInitialGame() {
natives.switchAmbientPlanes(true);
natives.switchMadDrivers(false);
+ // Singleplayer Cellphone
+ natives.requestScript("spcellphone");
+ natives.startNewScript("spcellphone", 0);
+ //natives.setMessagesWaiting(false);
+
natives.requestAnims("DANCING");
return true;
}
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index 3a2a3704..34a5e7b3 100644
--- a/scripts/client/sync.js
+++ b/scripts/client/sync.js
@@ -10,8 +10,8 @@
function processSync(event, deltaTime) {
if(localPlayer != null) {
if(!areServerElementsSupported()) {
- sendNetworkEventToServer("vrr.plr.pos", localPlayer.position);
- sendNetworkEventToServer("vrr.plr.rot", localPlayer.heading);
+ sendNetworkEventToServer("vrr.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
+ sendNetworkEventToServer("vrr.plr.rot", (localPlayer.vehicle != null) ? localPlayer.vehicle.heading : localPlayer.heading);
//if(localPlayer.vehicle != null) {
// sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 6c6a7393..2e5047bc 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -150,6 +150,9 @@ function getVehicleHeading(vehicle) {
// ===========================================================================
function setVehicleHeading(vehicle, heading) {
+ if(getGame() == VRR_GAME_GTA_IV) {
+ return sendNetworkEventToPlayer("vrr.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
+ }
return vehicle.heading = heading;
}
@@ -162,7 +165,13 @@ function getVehicleSyncer(vehicle) {
// ===========================================================================
function getVehicleForNetworkEvent(vehicle) {
- return vehicle;
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(getVehicleData(vehicle).ivNetworkId != -1) {
+ return getVehicleData(vehicle).ivNetworkId;
+ }
+ return -1;
+ }
+ return vehicle.id;
}
// ===========================================================================
From 94a8bf50ac374cf2e6b6c890461e4b291655b5ae Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 13 Mar 2022 05:29:22 -0500
Subject: [PATCH 019/609] Fix locale string arg
---
scripts/server/item.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/item.js b/scripts/server/item.js
index 0b91ba6e..1ca6b59e 100644
--- a/scripts/server/item.js
+++ b/scripts/server/item.js
@@ -160,7 +160,7 @@ function createItemCommand(command, params, client) {
let value = splitParams.slice(-1) || 1;
if(!getItemTypeData(itemType)) {
- messagePlayerError(client, getLocaleString("InvalidItemType"));
+ messagePlayerError(client, getLocaleString(client, "InvalidItemType"));
return false;
}
From 352836d192c6130f2a15b5d392c882b0230e6000 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 13 Mar 2022 05:33:30 -0500
Subject: [PATCH 020/609] Arabic locale file
---
locale/arabic.json | 399 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 399 insertions(+)
create mode 100644 locale/arabic.json
diff --git a/locale/arabic.json b/locale/arabic.json
new file mode 100644
index 00000000..461e9fcf
--- /dev/null
+++ b/locale/arabic.json
@@ -0,0 +1,399 @@
+{
+ "TranslationProvidedBy": "Name_Here",
+ "LocaleEnglishName": "Arabic",
+
+ "LocaleNativeName": "Arabic (Translate this to Arabic)",
+ "LocaleOffer": "This server is available in English. Use {1} to use it.",
+ "LocaleChanged1": "Your language is now set to {1}",
+ "LocaleChanged2": "The server will now display messages in {1}",
+ "LocaleChangedNote": "This does not change messages from other players",
+ "AccentsListHeader": "Accents",
+ "HeaderHelpMainList": "Help Categories",
+ "AccentNotFound": "Accent not found",
+ "AccentSet": "You set your accent to {1}",
+ "AnimationNotFound": "That animation doesn't exist",
+ "AnimationCommandTip": "Use {1} to see a list of valid animations",
+ "AnimationInvalidDistance": "The distance must be between 0 and 3",
+ "AnimationStopCommandTip": "Use {1} to stop your animation",
+ "CantBanClient": "You cannot ban this person",
+ "PlayerAccountBanned": "{1} has been account banned",
+ "ClanNotFound": "Clan not found",
+ "ClanNameTaken": "A clan with that name already exists",
+ "PlayerNotFound": "Player not found",
+ "ClanCantRemoveRanks": "You can't remove clan ranks",
+ "ClanCantAddRanks": "You can't add clan ranks",
+ "ClanRankNotFound": "Clan rank not found",
+ "ClanCantChangeMemberTag": "You can not change clan member's tags",
+ "ClanPlayerNotInSameClan": "That player is not in your clan",
+ "ClanCantChangeRankLevel": "You can not change clan rank's level",
+ "ClanCantChangeRankTag": "You can not change clan rank's tags",
+ "NameNotRegistered": "Your name is not registered! Use {1} to make an account.",
+ "AutomaticLoginIPToggle": "Automatic login by IP is now {1}",
+ "CouldNotRegisterAccount": "There was a problem creating your account. Please contact an admin.",
+ "RandomTipsToggle": "Random tips are now {1}",
+ "ActionTipsToggle": "Action tips are now {1}",
+ "AutoSpawnLastCharToggle": "Automatic spawn as last used character is {1}",
+ "AccountGUISettingToggle": "GUI is now {1}",
+ "On": "On",
+ "Off": "Off",
+ "Yes": "Yes",
+ "No": "No",
+ "True": "True",
+ "False": "False",
+ "Locked": "Locked",
+ "Unlocked": "Unlocked",
+ "PasswordNotGoodEnough": "The new password must meet the requirements!",
+ "PasswordNeedsBase": "Passwords must have at least {1}",
+ "PasswordNeedsCapitals": "{1} capital letters",
+ "PasswordNeedsNumbers": "{1} numbers",
+ "PasswordNeedsSymbols": "{1} symbols",
+ "PasswordsDontMatch": "The new password and confirm new password aren't the same!",
+ "PasswordChanged": "Your password has been changed!",
+ "AutoLoggedInIP": "You have been automatically logged in by IP!",
+ "WelcomeBack": "Welcome back to {1}, {2}! Please {3} to continue.",
+ "WelcomeNewPlayer": "Welcome to {1}, {2}! Please {3} to play.",
+ "InvalidPlayer": "Player not found!",
+ "InvalidBusiness": "Business not found!",
+ "InvalidHouse": "House not found!",
+ "InvalidVehicle": "Vehicle not found!",
+ "InvalidClan": "Clan not found!",
+ "InvalidClanRank": "Clan rank not found!",
+ "InvalidJob": "Job not found!",
+ "InvalidItem": "Item not found!",
+ "InvalidItemType": "Item type not found!",
+ "InvalidRadioStation": "Radio station not found!",
+ "InvalidGate": "Gate not found!",
+ "EntersProperty": "opens the door and enters the {1}",
+ "ExitsProperty": "opens the door and exits the {1}",
+ "EnterExitPropertyDoorLocked": "tries to open the {1} door but fails because it's locked",
+ "PropertyNoInterior": "This {1} does not have an interior, but you can still use commands at the door icon.",
+ "NoBusinessWithItemType": "There is no business with that item available",
+ "HeaderKeyBinds": "Key Binds",
+ "HeaderAccountHelp": "Account Help",
+ "HeaderVehicleHelp": "Vehicle Help",
+ "HeaderVehicleDealershipHelp": "Vehicle Dealership Help",
+ "HeaderJobHelp": "Job Help",
+ "HeaderChatHelp": "Chat Help",
+ "HeaderServerRules": "Server Rules",
+ "HeaderWebsiteInfo": "Website",
+ "HeaderDiscordInfo": "Discord",
+ "HeaderAnimationsList": "Animation List",
+ "HeaderPayAndSprayHelp": "Pay and Spray Help",
+ "HeaderAmmunationHelp": "Ammunation Help",
+ "HeaderVehicleTuneupHelp": "Vehicle Tune Help",
+ "HeaderBindableKeysHelp": "Bindable Keys",
+ "HeaderSkinHelp": "Clothes/Skin Help",
+ "HeaderBusinessHelp": "Business Help",
+ "HeaderClanHelp": "Clan Help",
+ "HeaderPlayerVehiclesList": "Player Vehicles ({1})",
+ "HeaderPlayerBusinessesList": "Player Businesses ({1})",
+ "HeaderClansList": "Clan List",
+ "HeaderAdminsList": "Admin List",
+ "HeaderBadgeInfo": "Badge Information",
+ "HeaderAccentsList": "Accent List",
+ "HeaderPlayerInfo": "Player Information ({1})",
+ "HeaderWealthandTaxHelp": "Wealth and Tax Information",
+ "HeaderCommandInfo": "Command Information ({1})",
+ "HeaderRadioHelp": "Radio Help",
+ "HeaderRadioStationsList": "Radio Stations",
+ "HeaderKeyBindsList": "Key Binds List",
+ "RadioVolumeChanged": "{1} You changed your streaming radio volume to {2}%",
+ "VolumeLevelNotNumber": "The volume level must be a number",
+ "RadioStationLocationInvalid": "You must be in a vehicle, house, or business or have a personal device to change the station!",
+ "ActionBusinessRadioStationChange": "changes the business radio station to {1} ({2})",
+ "ActionHouseRadioStationChange": "changes the house radio station to {1} ({2})",
+ "ActionVehicleRadioStationChange": "changes the vehicle radio station to {1} ({2})",
+ "ActionItemRadioStationChange": "changes the {1}'s station to {2} ({3})",
+ "RandomVehicleCommandsDisabled": "This is a random traffic vehicle and commands can't be used for it.",
+ "HouseDoorLock": "House {1} {2}!",
+ "BusinessDoorLock": "Business {1} {2}!",
+ "ServerGameModeRestarting": "The server game mode is restarting!",
+ "HeaderSelfItemList": "Your Inventory",
+ "HeaderPlayerItemList": "Player Inventory ({1})",
+ "HeaderHouseItemList": "House Inventory",
+ "HeaderBusinessFloorItemList": "Business Inventory (For Sale)",
+ "HeaderBusinessStorageItemList": "Business Inventory (Storage)",
+ "HeaderItemItemList": "{1}'s Inventory",
+ "ItemSlotNotNumber": "The item slot must be a number",
+ "ItemSlotMustBeBetween": "The item slot must be between {1} and {2}!",
+ "UseItemBugged": "The item you're trying to use is bugged. A bug report has been sent to the server developers.",
+ "PickupItemBugged": "The item you're trying to pickup is bugged. A bug report has been sent to the server developers.",
+ "DropItemBugged": "The item you're trying to drop is bugged. A bug report has been sent to the server developers.",
+ "HandsBusy": "Your hands are busy",
+ "CantUseItemInSkinChange": "You can't use an item while customizing your appearance",
+ "CantDropItemInSkinChange": "You can't drop an item while customizing your appearance",
+ "CantPickupItemInSkinChange": "You can't pickup an item while customizing your appearance",
+ "CantSwitchItemInSkinChange": "You can't switch an item while customizing your appearance",
+ "CantGiveItemInSkinChange": "You can't give an item while customizing your appearance",
+ "CantTakeItemInSkinChange": "You can't take an item while customizing your appearance",
+ "ItemUnequippableNoAmmo": "The {1} in slot {2} has no ammo, and can't be equipped!",
+ "NoSpaceSelfInventory": "You don't have any more space in your inventory",
+ "Business": "business",
+ "House": "house",
+ "Clan": "clan",
+ "Vehicle": "vehicle",
+ "Item": "item",
+ "ItemType": "item type",
+ "Gate": "gate",
+ "Door": "door",
+ "ClanRank": "clan rank",
+ "JobRank": "job rank",
+ "RadioStation": "radio station",
+ "Months": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "WeekDays": [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+ "CardinalDirections": [
+ "North",
+ "Northeast",
+ "East",
+ "Southeast",
+ "South",
+ "Southwest",
+ "West",
+ "Northwest"
+ ],
+ "NewPlayerReadyToPlay": [
+ "You have been given some cash. Use {1} to find places to buy items.",
+ "If you need money, jobs are the yellow dots on the radar.",
+ "For a car, visit the car dealership. You can also use a rental vehicle near spawn or take the train",
+ "Be sure to read the {1} and use {2} for info."
+ ],
+ "YourCurrentVehicleDeleted": "The vehicle you were in was deleted.",
+ "Distance": "Distance",
+ "Meters": "Meters",
+ "Feet": "Feet",
+ "Kilometers": "Kilometers",
+ "Miles": "Miles",
+ "MustBeVehicleDriver": "You must be the driver of the vehicle!",
+ "PlayerJoinedServer": "{1} has joined the game from {1}!",
+ "PlayerLeftServer": "{1} has left the game! ({1})",
+ "DisconnectReasons": [
+ "Lost Connection",
+ "Disconnected",
+ "Unsupported Client",
+ "Wrong Game",
+ "Incorrect Password",
+ "Unsupported Executable",
+ "Disconnected",
+ "Banned",
+ "Failed",
+ "Invalid Name",
+ "Crashed"
+ ],
+ "TakeItemFromHouse": "takes a {1} from the house",
+ "TakeItemFromBusinessStorage": "takes a {1} from the business storage",
+ "TakeItemFromBusiness": "takes a {1} from the business",
+ "TakeItemFromItem": "takes a {1} from the {2}",
+ "TakeItemFromVehicleTrunk": "takes a {1} from the trunk",
+ "TakeItemFromVehicleDash": "takes a {1} from the glove compartment",
+ "JobEquipmentInventoryKeyBindTip": "The job equipment is in your inventory. Press {1} to see them.",
+ "JobEquipmentInventoryCommandTip": "The job equipment is in your inventory. Use {1} to see them.",
+ "AccountHelp": [
+ "Do NOT share your password with anybody else. {1} staff will never ask you for your password",
+ "Use {1} to change your password, and {2} if you forgot it",
+ "Some settings you can use: {1}"
+ ],
+ "VehicleHelp": [
+ "Your personal vehicles will save wherever you or somebody else leaves them!",
+ "Visit dealerships to buy new vehicles (Use {1} for more information)",
+ "Some commands: {1}",
+ "Visit a mechanic garage to repair, colour, and tune up your car! {1} for info"
+ ],
+ "VehicleDealershipHelp": [
+ "Visit a vehicle dealer to buy new vehicles. Use {1} to find one.",
+ "At the dealer, enter a car you want to buy, and the price will be shown to you",
+ "If you want to buy the vehicle, use {1} and you will be given keys to test drive it around the parking lot.",
+ "Drive away from the dealership with the new vehicle to confirm the purchase."
+ ],
+ "JobHelp": [
+ "Visit job locations to get a job and earn money. Look for yellow spots on the map",
+ "At a job location, use {1} to get the job. Use {2} to quit your job",
+ "Use {1} to begin working. You can also get a job {2} and {3}",
+ "Most job vehicles are locked. Use {1} near one to enter it.",
+ "When entering a job vehicle, information on how to do the job will be shown to you."
+ ],
+ "ChatHelp": [
+ "There are two main types of chat: out-of-character (OOC) and in-character (IC)",
+ "Mixing these two types is not proper roleplay. See {1} for info.",
+ "Some chat commands: {1}",
+ "Some have shorter names available ({1} to talk, {2} to shout, etc)"
+ ],
+ "ServerRulesHelp": [
+ "Unrealistic actions (powergaming) are not allowed. You aren't superman.",
+ "No terrorist or terrorism roleplay is allowed.",
+ "Always follow instructions given by moderators and admins.",
+ "Do not mix the chats (metagaming). You can't use info in IC that was received OOC",
+ "Keep English in main chats. If you aren't good at English, use {1}"
+ ],
+ "AnimationHelp": [
+ "Animations allow you to enhance roleplay with visual actions",
+ "Use {1} or {2} with a name to use an animation.",
+ "To see a list of animations, use {1}"
+ ],
+ "WeaponHelp": [
+ "Visit an gun store to buy weapons. Use {1} to find one.",
+ "Buying a weapon requires a weapon license.",
+ "Weapon licenses are managed by the police department. Apply there to get one.",
+ "Weapons can also be purchased illegally from some businesses, weapon dealers, and clans."
+ ],
+ "SkinHelp": [
+ "At a clothing store, use {1} to purchase clothes",
+ "When you have a clothing item, equip and use it like any other item to show the skin selection (check {1} to learn how to use items)",
+ "Some skins are restricted to jobs, clans, or for other reasons."
+ ],
+ "KeyBindHelp": [
+ "You can set your own key binds. Use {1} to see your binded keys.",
+ "Use {1} to add a new keybind and {2} to remove one.",
+ "Default keys are: {1} for vehicle engine, {1} for lights, and {3} for lock/unlock",
+ "Press {1} to see your items and {2} to equip an item or {3} to unequip all.",
+ "Press {1} to use the item you're holding, press {2} to drop it, or press {3} to pickup an item from the ground."
+ ],
+ "BusinessHelp": [
+ "Use {1} to purchase items or {2} to see a list of what's for sale at any business",
+ "Businesses are shown with blue names above the icon at their entrance.",
+ "Business owner commands: {1}",
+ "A new car for sale will appear when you drive away from the dealer."
+ ],
+ "ClanHelp": [
+ "Ask an administrator to create a clan (Similar to factions/groups/families)",
+ "Clan owners have full control over their clan once it's created",
+ "Clan commands: {1}",
+ "More clan commands: {1}"
+ ],
+ "RadioStationHelp": [
+ "Use {1} to set the station for your vehicle, house, or business",
+ "Use {2} to see a list of stations",
+ "You can change your radio streaming volume using {1} with 0-100 as the percent"
+ ],
+ "WealthAndTaxHelp": [
+ "Your taxes on payday are {1} percent of your calculated wealth.",
+ "Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.",
+ "Each vehicle is {1}, each house is {2}, and each business is {3}",
+ "Use {1} to see your current wealth, and {2} to see how much you'll pay in tax each payday"
+ ],
+ "MustBeInAVehicle": "You need to be in a vehicle!",
+ "MustBeInOrNearVehicle": "You need to be in or near a vehicle!",
+ "MustBeInVehicleFrontSeat": "You need to be in the vehicle front seats!",
+ "MustBeInVehicleDriverSeat": "You need to be the driver!",
+ "DontHaveVehicleKey": "You don't have a key for this vehicle!",
+ "NoGateAccess": "You don't have access to this gate!",
+ "GateBroken": "This gate is broken!",
+ "GateHacked": "The gate does not respond!",
+ "RadioJammed": "You hear only static from the radio.",
+ "VehicleNotForSale": "This vehicle is not for sale!",
+ "VehicleNotForRent": "This vehicle is not for rent!",
+ "BusinessNotForSale": "This business is not for sale!",
+ "BusinessNotForRent": "This business is not for rent!",
+ "HouseNotForSale": "This house is not for sale!",
+ "HouseNotForRent": "This house is not for rent!",
+ "DealershipPurchaseTestDrive": "Drive the vehicle away from the dealership to buy it, or get out to cancel.",
+ "DealershipPurchaseExitedVehicle": "You canceled the vehicle purchase by exiting the vehicle!",
+ "VehiclePurchaseComplete": "This vehicle is now yours! It will save wherever you leave it.",
+ "VehiclePurchaseNotEnoughMoney": "You don't have enough money to buy this vehicle!",
+ "HousePurchaseNotEnoughMoney": "You don't have enough money to buy this house!",
+ "BusinessPurchaseNotEnoughMoney": "You don't have enough money to buy this business!",
+ "Locales": {
+ "English": "English",
+ "Russian": "Russian",
+ "Spanish": "Spanish",
+ "German": "German",
+ "Dutch": "Dutch",
+ "Polish": "Polish"
+ },
+
+ "ADDED-21JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
+ "HeaderPlayerHousesList": "Player Houses ({1})",
+ "HeaderPlayerStaffFlagsList": "Player Staff Flags ({1})",
+ "HeaderStaffFlagsList": "Staff Flags",
+ "NonRPName": "Non-RP name! Choose a new one:",
+ "InvalidStaffFlag": "Staff flag not found!",
+ "InvalidClanFlag": "Clan flag not found!",
+ "InvalidLocale": "Language not found!",
+ "HeaderJobUniformList": "Job Uniforms ({1})",
+ "HeaderJobEquipmentList": "Job Equipment ({1})",
+ "InvalidJobUniform": "Job uniform not found!",
+ "InvalidJobEquipment": "Job equipment not found!",
+ "HeaderVehiclesInRangeList": "Vehicles within {1}",
+ "NoVehiclesWithInRange": "There are no vehicles within {1}",
+ "AmountNotNumber": "The amount must be a number!",
+ "NeedToBeWorking": "You need to be working! Use {1} at a job location or near a job vehicle.",
+ "NeedToBeOnJobRoute": "You need to be doing a job route! Use {1} in a job vehicle",
+ "CurrentJobRouteDeleted": "The job route you were on has been deleted by an admin",
+ "CurrentJobRouteVehicleColoursChanged": "Your job route's vehicle colours were changed by an admin",
+ "NotYourJob": "This is not your job!",
+ "JobPoints": "You can get a job by going the yellow points on the map.",
+ "QuitJobToTakeAnother": "If you want this job, use {1} to quit your current job.",
+ "NotAJobVehicle": "This is not a job vehicle!",
+ "NotYourJobVehicle": "This is not your job's vehicle!",
+ "JobRouteDisabled": "The job route you were on has been disabled by an admin",
+ "HeaderPickupTypes": "Pickup Types",
+ "HeaderBlipTypes": "Map Icon Types",
+ "InvalidGPSLocation": "There are no locations with that name or type",
+ "HeaderBusinessList": "Businesses",
+ "VehicleForSale": "This {1} is buyable for {2}! Use {3} if you want to buy it",
+ "VehicleForRent": "This {1} is rentable for {2}! Use {3} if you want to rent it",
+
+ "ADDED-31JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
+ "LoginFailedInvalidPassword": "Invalid password! {1} attempts remaining",
+ "LoginFailedNoPassword": "You must enter a password! ! {1} attempts remaining",
+ "RegistrationFailedNoPassword": "You must enter a password!",
+ "RegistrationFailedNoPasswordConfirm": "You must confirm the password!",
+ "RegistrationFailedNoEmail": "You must enter an email!",
+ "AccountNameAlreadyRegistered": "Your name is already registered!",
+ "AlreadyLoggedIn": "You are already logged in!",
+ "RegistrationFailedInvalidEmail": "That email is invalid!",
+ "RegistrationFailedPasswordMismatch": "The passwords don't match!",
+ "RegistrationFailedCreateError": "Your account couldn't be created!",
+ "RegistrationSuccess": "Your account has been created!",
+ "RegistrationEmailVerifyReminder": "Don't forget to verify your email! A verification code has been sent to you.",
+ "RegistrationCreateCharReminder": "To play on the server, you will need to make a character.",
+ "NoCharactersGUIMessage": "You have no characters. Would you like to make one?",
+ "NoCharactersGUIWindowTitle": "No characters",
+ "NoCharactersChatMessage": "You have no characters. Use {1} to make one.",
+ "NeedEmailFor2FA": "You need to add your email to your account to use two-factor authentication.",
+ "NeedEmailVerifiedFor2FA": "You need to verify your email to use two-factor authentication.",
+ "SetEmailHelpTip": "Use {1} to set your email.",
+ "VerifyEmailHelpTip": "Use {1} to verify your email.",
+
+ "ADDED-13FEB2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
+ "NearbyRadio": "Nearby radio",
+ "FromRadio": "From radio",
+ "ToRadio": "To radio",
+ "NeedToEnterPropertyCommand": "You need to enter the {1} first! Use {2} to enter and exit",
+ "NeedToEnterPropertyKeyPress": "You need to enter the {1} first! Press {2} to enter and exit",
+ "InventoryFullCantCarry": "You don't have any space to carry this (full inventory)!",
+ "NotEnoughCashNeedAmountMore": "You don't have enough money! You need {1} more!",
+ "AmountMustBeMoreThan": "The amount must be more than {1}!",
+ "WeaponBanned": "You are not allowed to buy or use weapons!",
+ "TimeNotNumber": "The time must be a number",
+ "HeaderDefaultBusinessItemTypes": "Business Item Templates",
+ "FixingStuck": "Fixing your position and virtual world ...",
+ "CantUseCommandYet": "You must wait before you can use this command again!",
+ "NotATester": "You are not a tester!",
+ "AccessDenied": "AccessDenied",
+ "InvalidSkin": "That skin is invalid!",
+ "HeaderInteriorTypes": "Interiors List",
+ "ViewInventoryKeyPressTip": "Press {1} to see your items",
+ "ViewInventoryCommandTip": "Use {1} to see your items",
+ "GUIAccountSettingToggle": "You have turned {1} GUI"
+}
From 11e76becc6e9c4027a233769bebfad298a81bf94 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 13 Mar 2022 05:33:57 -0500
Subject: [PATCH 021/609] Fix spanish locale native name
---
locale/spanish.json | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/locale/spanish.json b/locale/spanish.json
index 795432a1..d87a0eb5 100644
--- a/locale/spanish.json
+++ b/locale/spanish.json
@@ -1,7 +1,8 @@
{
"TranslationProvidedBy": "PerikiyoXD",
- "LocaleEnglishName": "Espaรฑol",
- "LocaleNativeName": "Inglรฉs",
+ "LocaleEnglishName": "Spanish",
+
+ "LocaleNativeName": "Espaรฑol",
"LocaleOffer": "Este servidor se encuentra disponible en Espaรฑol. Utilice {1} para usarlo",
"LocaleChanged1": "El idioma se ha configurado a {1}",
"LocaleChanged2": "El servidor mostrarรก los mensajes en {1}",
From 96b6d58708a38ec42c8eba06570e4d27f33b3fdf Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 13 Mar 2022 05:34:24 -0500
Subject: [PATCH 022/609] Separate first two lines (they're for information)
---
locale/chinese.json | 1 +
locale/english.json | 1 +
locale/polish.json | 1 +
locale/russian.json | 1 +
4 files changed, 4 insertions(+)
diff --git a/locale/chinese.json b/locale/chinese.json
index b3636ef5..2f7d82c4 100644
--- a/locale/chinese.json
+++ b/locale/chinese.json
@@ -1,6 +1,7 @@
{
"TranslationProvidedBy": "Renzuka Ctone",
"LocaleEnglishName": "Chinese",
+
"LocaleNativeName": "Chinese",
"LocaleOffer": "This server is available in English. Use {1} to use it.",
"LocaleChanged1": "Your language is now set to {1}",
diff --git a/locale/english.json b/locale/english.json
index b7f6d5bd..7046953c 100644
--- a/locale/english.json
+++ b/locale/english.json
@@ -1,6 +1,7 @@
{
"TranslationProvidedBy": "Vortrex",
"LocaleEnglishName": "English",
+
"LocaleNativeName": "English",
"LocaleOffer": "This server is available in English. Use {1} to use it.",
"LocaleChanged1": "Your language is now set to {1}",
diff --git a/locale/polish.json b/locale/polish.json
index 5057588a..714cf328 100644
--- a/locale/polish.json
+++ b/locale/polish.json
@@ -1,6 +1,7 @@
{
"TranslationProvidedBy": "Suprise444",
"LocaleEnglishName": "Polish",
+
"LocaleNativeName": "Polski",
"LocaleOffer": "Ten serwer jest dostฤpny w jฤzyku Polskim. Uลผyj {1} aby go uลผyฤ.",
"LocaleChanged1": "Twรณj jฤzyk jest ustawiony na {1}",
diff --git a/locale/russian.json b/locale/russian.json
index c5e92804..bb26e69e 100644
--- a/locale/russian.json
+++ b/locale/russian.json
@@ -1,6 +1,7 @@
{
"TranslationProvidedBy": "VNDTTS",
"LocaleEnglishName": "Russian",
+
"LocaleNativeName": "ะ ัััะบะธะน",
"LocaleOffer": "ะญัะพั ัะตัะฒะตั ะดะพัััะฟะตะฝ ะฝะฐ ััััะบะพะผ. ะัะฟะพะปัะทัะนัะต {1} ััะพะฑั ะตะณะพ ะธัะฟะพะปัะทะพะฒะฐัั.",
"LocaleChanged1": "ะะฐั ัะทัะบ ะฑัะป ัััะฐะฝะพะฒะปะตะฝ ะฝะฐ {1}",
From 5ce0ec2a111ae73063c7a17e92530b02fcf277af Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:15:21 -0500
Subject: [PATCH 023/609] Display nametags in IV
---
scripts/client/startup.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/client/startup.js b/scripts/client/startup.js
index 76cd14a7..c0e59f71 100644
--- a/scripts/client/startup.js
+++ b/scripts/client/startup.js
@@ -126,11 +126,11 @@ function setUpInitialGame() {
//natives.displayHud(false);
//natives.displayRadar(false);
//natives.displayAreaName(false);
- //natives.displayPlayerNames(false);
+ natives.displayPlayerNames(true);
natives.setPoliceRadarBlips(false);
natives.removeTemporaryRadarBlipsForPickups();
natives.displayNonMinigameHelpMessages(false);
- natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
+ natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), true);
// Item/Money Dropping
natives.setMoneyCarriedByAllNewPeds(0);
@@ -156,6 +156,7 @@ function setUpInitialGame() {
natives.startNewScript("spcellphone", 0);
//natives.setMessagesWaiting(false);
+ // Animation libraries
natives.requestAnims("DANCING");
return true;
}
From a9ff7bd4d4376d9ecc664add8658a12c48b4833c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:15:40 -0500
Subject: [PATCH 024/609] Only set interior if different than main world
---
scripts/client/utilities.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 1a120772..6bcd7048 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -357,8 +357,10 @@ function setLocalPlayerInterior(interior) {
localPlayer.interior = interior;
game.cameraInterior = interior;
} else {
- let interiorId = natives.getInteriorAtCoords(localPlayer.position);
- natives.activateInterior(interiorId, true);
+ if(getGameConfig().mainWorldInterior != interior) {
+ let interiorId = natives.getInteriorAtCoords(localPlayer.position);
+ natives.activateInterior(interiorId, true);
+ }
}
}
From e912a97d83210dcecbc52ebdcee0b1ac4e91ff1e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:15:48 -0500
Subject: [PATCH 025/609] Some testing stuff
---
scripts/server/subaccount.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js
index af332474..6f6ebfba 100644
--- a/scripts/server/subaccount.js
+++ b/scripts/server/subaccount.js
@@ -375,11 +375,13 @@ function selectCharacter(client, characterId = -1) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else if(getGame() == VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
+ //clearPlayerWeapons(client);
//setPlayerSkin(client, skin);
//setPlayerPosition(client, spawnPosition);
//setPlayerHeading(client, spawnHeading);
//setPlayerInterior(client, spawnInterior);
//setPlayerDimension(client, spawnDimension);
+ //restorePlayerCamera(client);
} else if(getGame() >= VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
}
From 0afc5856cf3b174d7c497412709d87bef6c99b76 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:16:03 -0500
Subject: [PATCH 026/609] Woops had GUI check backward
---
scripts/server/account.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/server/account.js b/scripts/server/account.js
index 549fcdff..01a57bf0 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -94,13 +94,13 @@ function toggleAutoSelectLastCharacterCommand(command, params, client) {
function toggleAccountGUICommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("NoGUI");
- if(!doesPlayerHaveGUIEnabled(client)) {
+ if(doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}`));
+ messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
} else {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
- messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}`));
+ messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
}
From 10b4251ca696d0c2c55b70df22d599c333d72824 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:16:14 -0500
Subject: [PATCH 027/609] Test skin stuff for IV
---
scripts/client/server.js | 13 ++++++++++++-
scripts/client/skin-select.js | 22 ++++++++++++++++------
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/scripts/client/server.js b/scripts/client/server.js
index 5410a2fb..a56df057 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -292,8 +292,19 @@ function setLocalPlayerInfiniteRun(state) {
// ===========================================================================
function setLocalPlayerSkin(skinId) {
+ logToConsole(LOG_INFO, skinId);
if(getGame() == VRR_GAME_GTA_IV) {
- natives.changePlayerModel(natives.getPlayerId(), skinId);
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+
+ //natives.requestModel(skinId);
+ //natives.changePlayerModel(natives.getPlayerId(), skinId);
+
//localPlayer.skin = allowedSkins[skinSelectorIndex][0];
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
} else {
diff --git a/scripts/client/skin-select.js b/scripts/client/skin-select.js
index 2b361383..13af8975 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -54,9 +54,14 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
- //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
- //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- //localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
+ let skinId = allowedSkins[skinSelectorIndex][1];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
@@ -69,9 +74,14 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
- //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
- //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- //localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
+ let skinId = allowedSkins[skinSelectorIndex][1];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
From 5ce26de7c3107891872bdf0101e9b67eabcd7c1a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:16:23 -0500
Subject: [PATCH 028/609] Format
---
scripts/server/event.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index b7dea80a..4f4e1ccc 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -410,6 +410,7 @@ function onPlayerDeath(client, position) {
if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
+
updatePlayerSpawnedState(client, true);
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
From b74deeca509043b88ccd088a0c214cbae8b5c775 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 14 Mar 2022 05:45:48 -0500
Subject: [PATCH 029/609] Fix for IV skin change
---
scripts/client/skin-select.js | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/client/skin-select.js b/scripts/client/skin-select.js
index 13af8975..abd8cc52 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -54,7 +54,7 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
- let skinId = allowedSkins[skinSelectorIndex][1];
+ let skinId = allowedSkins[skinSelectorIndex][0];
if(natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
natives.loadAllObjectsNow();
@@ -74,7 +74,7 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
- let skinId = allowedSkins[skinSelectorIndex][1];
+ let skinId = allowedSkins[skinSelectorIndex][0];
if(natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
natives.loadAllObjectsNow();
@@ -132,8 +132,14 @@ function toggleSkinSelect(state) {
}
if(getGame() == VRR_GAME_GTA_IV) {
- //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
From 0bacc0964c7e2b975655e6853753a06bb54ba030 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:14:57 -0500
Subject: [PATCH 030/609] Draw house/job checkpoints
---
scripts/client/label.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/client/label.js b/scripts/client/label.js
index 4f20d67a..973bf20f 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -255,6 +255,18 @@ function processLabelRendering() {
natives.drawColouredCylinder(getPosBelowPos(businesses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
}
}
+
+ for(let i in houses) {
+ if(getDistance(localPlayer.position, houses[i].entrancePosition) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(houses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
+ }
+ }
+
+ for(let i in jobs) {
+ if(getDistance(localPlayer.position, jobs[i].position) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(jobs[i].position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
+ }
+ }
}
}
From d56422bac64cfe21ef478c4a7741a3ea5c7f226d Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:15:17 -0500
Subject: [PATCH 031/609] Client job script
---
scripts/client/job.js | 104 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 102 insertions(+), 2 deletions(-)
diff --git a/scripts/client/job.js b/scripts/client/job.js
index c993aa16..022e9862 100644
--- a/scripts/client/job.js
+++ b/scripts/client/job.js
@@ -14,6 +14,20 @@ let jobRouteLocationSphere = null;
// ===========================================================================
+class JobData {
+ constructor(jobId, name, position, blipModel, pickupModel) {
+ this.index = -1;
+ this.jobId = jobId;
+ this.name = name;
+ this.position = position;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.blipId = -1;
+ }
+}
+
+// ===========================================================================
+
function initJobScript() {
logToConsole(LOG_DEBUG, "[VRR.Job]: Initializing job script ...");
logToConsole(LOG_DEBUG, "[VRR.Job]: Job script initialized!");
@@ -22,14 +36,14 @@ function initJobScript() {
// ===========================================================================
function setLocalPlayerJobType(tempJobType) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Set local player job type to ${tempJobType}`);
+ logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
localPlayerJobType = tempJobType;
}
// ===========================================================================
function setLocalPlayerWorkingState(tempWorking) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Setting working state to ${tempWorking}`);
+ logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
localPlayerWorking = tempWorking;
}
@@ -92,4 +106,90 @@ function hideJobRouteLocation() {
jobRouteLocationBlip = null;
}
+// ===========================================================================
+
+function receiveJobFromServer(jobId, name, position, blipModel, pickupModel) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
+
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(getJobData(jobId) != false) {
+ let jobData = getJobData(jobId);
+ jobData.name = name;
+ jobData.position = position;
+ jobData.blipModel = blipModel;
+ jobData.pickupModel = pickupModel;
+
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(jobData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ jobData.blipId = -1;
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
+ }
+ } else {
+ if(jobData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(jobData.blipId, jobData.position);
+ natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
+ natives.setBlipMarkerLongDistance(jobData.blipId, false);
+ natives.setBlipAsShortRange(jobData.blipId, true);
+ natives.changeBlipNameFromAscii(jobData.blipId, `${jobData.name.substr(0, 24)}${(jobData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(jobData.blipModel, jobData.position, jobData.name);
+ if(blipId != -1) {
+ jobData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} doesn't exist. Adding ...`);
+ let tempJobData = new JobData(jobId, name, position, blipModel, pickupModel);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(tempJobData.blipModel, tempJobData.position, tempJobData.name);
+ if(blipId != -1) {
+ tempJobData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} has no blip.`);
+ }
+ jobs.push(tempJobData);
+ setAllJobDataIndexes();
+ }
+ }
+}
+
+// ===========================================================================
+
+/**
+ * @param {number} job - The ID of the job (initially provided by server)
+ * @return {JobData} The job's data (class instance)
+ */
+ function getJobData(jobId) {
+ for(let i in jobs) {
+ if(jobs[i].jobId == jobId) {
+ return jobs[i];
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function setAllJobDataIndexes() {
+ for(let i in jobs) {
+ jobs[i].index = i;
+ }
+}
+
// ===========================================================================
\ No newline at end of file
From 7ad41f939a20f311a11dbf34a2b4f6e12c89b578 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:15:28 -0500
Subject: [PATCH 032/609] Update client house script
---
scripts/client/house.js | 74 ++++++++++++++++++++++++++++-------------
1 file changed, 50 insertions(+), 24 deletions(-)
diff --git a/scripts/client/house.js b/scripts/client/house.js
index 19631aad..47d4157e 100644
--- a/scripts/client/house.js
+++ b/scripts/client/house.js
@@ -22,37 +22,58 @@ class HouseData {
// ===========================================================================
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
+ logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
+
if(getGame() == VRR_GAME_GTA_IV) {
if(getHouseData(houseId) != false) {
+ let houseData = getHouseData(houseId);
+ houseData.entrancePosition = entrancePosition;
+ houseData.blipModel = blipModel;
+ houseData.pickupModel = pickupModel;
+ houseData.hasInterior = hasInterior;
+
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
if(blipModel == -1) {
- natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
- getHouseData(houseId).blipId = -1;
- //houses.splice(getHouseData(houseId).index, 1);
- //setAllHouseDataIndexes();
- } else {
- if(getHouseData(houseId).blipId != -1) {
- natives.setBlipCoordinates(getHouseData(houseId).blipId, getHouseData(houseId).entrancePosition);
- natives.changeBlipSprite(getHouseData(houseId).blipId, getHouseData(houseId).blipModel);
- //natives.changeBlipNameFromAscii(getHouseData(houseId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
+ if(houseData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ houseData.blipId = -1;
} else {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
- getHouseData(houseId).blipId = blipId;
- natives.changeBlipSprite(blipId, blipModel);
- natives.setBlipMarkerLongDistance(blipId, false);
- }
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
+ }
+ } else {
+ if(houseData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
+ natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
+ natives.setBlipMarkerLongDistance(houseData.blipId, false);
+ natives.setBlipAsShortRange(houseData.blipId, true);
+ natives.changeBlipNameFromAscii(houseData.blipId, `${houseData.name.substr(0, 24)}${(houseData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(houseData.blipModel, houseData.entrancePosition, houseData.name);
+ if(blipId != -1) {
+ houseData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
}
}
} else {
- let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} doesn't exist. Adding ...`);
+ let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior);
if(blipModel != -1) {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
+ let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
+ if(blipId != -1) {
tempHouseData.blipId = blipId;
- natives.changeBlipSprite(blipId, blipModel);
- natives.setBlipMarkerLongDistance(blipId, false);
- //natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
}
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
}
houses.push(tempHouseData);
setAllHouseDataIndexes();
@@ -66,9 +87,14 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
* @param {number} houseId - The ID of the house (initially provided by server)
* @return {HouseData} The house's data (class instance)
*/
-function getHouseData(houseId) {
- let tempHouseData = houses.find((h) => h.houseId == houseId);
- return (typeof tempHouseData != "undefined") ? tempHouseData : false;
+ function getHouseData(houseId) {
+ for(let i in houses) {
+ if(houses[i].houseId == houseId) {
+ return houses[i];
+ }
+ }
+
+ return false;
}
// ===========================================================================
From eba1487ac4de131de54298dc9c2d2f540011be1a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:15:47 -0500
Subject: [PATCH 033/609] Fix some client business stuff
---
scripts/client/business.js | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/scripts/client/business.js b/scripts/client/business.js
index 69a73600..a2d15e04 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -40,7 +40,11 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
if(blipModel == -1) {
if(businessData.blipId != -1) {
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
- natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
businessData.blipId = -1;
//businesses.splice(businessData.index, 1);
//setAllBusinessDataIndexes();
@@ -50,20 +54,18 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
} else {
if(businessData.blipId != -1) {
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
- natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
- natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
- natives.setBlipMarkerLongDistance(businessData.blipId, false);
- natives.setBlipAsShortRange(tempBusinessData.blipId, true);
- natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
- } else {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
- businessData.blipId = blipId;
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
- natives.setBlipMarkerLongDistance(businessData.blipId, false);
+ natives.setBlipMarkerLongDistance(businessData.blipId, false);
natives.setBlipAsShortRange(tempBusinessData.blipId, true);
natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
}
+ } else {
+ let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
+ if(blipId != -1) {
+ tempBusinessData.blipId = blipId;
+ }
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
}
}
@@ -71,13 +73,9 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
if(blipModel != -1) {
- let blipId = natives.addBlipForCoord(entrancePosition);
- if(blipId) {
+ let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
+ if(blipId != -1) {
tempBusinessData.blipId = blipId;
- natives.changeBlipSprite(tempBusinessData.blipId, blipModel);
- natives.setBlipMarkerLongDistance(tempBusinessData.blipId, false);
- natives.setBlipAsShortRange(tempBusinessData.blipId, true);
- natives.changeBlipNameFromAscii(tempBusinessData.blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
}
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
} else {
From 8e2c69c1b1b5a739713fdbbf920bab39cfd66b4a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:16:13 -0500
Subject: [PATCH 034/609] Wrap some native stuff
---
scripts/client/native/connected.js | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js
index f62b24bc..72054b5f 100644
--- a/scripts/client/native/connected.js
+++ b/scripts/client/native/connected.js
@@ -20,7 +20,11 @@ function getPlayerPosition() {
// ===========================================================================
function setPlayerPosition(position) {
- localPlayer.position = position;
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setCharCoordinates(localPlayer, position);
+ } else {
+ localPlayer.position = position;
+ }
}
// ===========================================================================
@@ -141,4 +145,21 @@ function getVehiclesInRange(position, range) {
return inRangeVehicles;
}
+// ===========================================================================
+
+function createGameBlip(blipModel, position, name = "") {
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let blipId = natives.addBlipForCoord(position);
+ if(blipId) {
+ natives.changeBlipSprite(blipId, blipModel);
+ natives.setBlipMarkerLongDistance(blipId, false);
+ natives.setBlipAsShortRange(blipId, true);
+ natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
+ return blipId;
+ }
+ }
+
+ return -1;
+}
+
// ===========================================================================
\ No newline at end of file
From 50616b7c8aee65b25b11e47be32e7faf22007702 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:16:28 -0500
Subject: [PATCH 035/609] Cutscene interior net events
---
scripts/client/server.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/scripts/client/server.js b/scripts/client/server.js
index a56df057..8ca4741d 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -87,6 +87,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
+ addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior);
addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
addNetworkEventHandler("vrr.elementPosition", setElementPosition);
@@ -326,4 +327,19 @@ function sendLocalPlayerNetworkIdToServer() {
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
}
+// ===========================================================================
+
+function setCutsceneInterior(cutsceneName) {
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(cutsceneName == "") {
+ natives.clearCutscene();
+ } else {
+ if(natives.isInteriorScene()) {
+ natives.clearCutscene();
+ }
+ natives.initCutscene(cutsceneName);
+ }
+ }
+}
+
// ===========================================================================
\ No newline at end of file
From ef1ba1dd9985d3144cfd43800e746771ee9f3ffe Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:16:51 -0500
Subject: [PATCH 036/609] Cutscene interior stuff
---
scripts/server/business.js | 15 +++++++++++----
scripts/server/class.js | 13 +++++++++++++
scripts/server/client.js | 18 ++++++++++++++++++
scripts/server/house.js | 5 +++++
4 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index 3e9faaa2..cfaccd8e 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -11,8 +11,6 @@ function initBusinessScript() {
logToConsole(LOG_INFO, "[VRR.Business]: Initializing business script ...");
getServerData().businesses = loadBusinessesFromDatabase();
-
-
createAllBusinessPickups();
createAllBusinessBlips();
@@ -139,7 +137,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
// ===========================================================================
function createBusinessCommand(command, params, client) {
- let tempBusinessData = createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].Business, getGameConfig().blipSprites[getServerGame()].Business, getPlayerInterior(client), getPlayerDimension(client));
+ let tempBusinessData = createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].Business, getGameConfig().blipSprites[getServerGame()].Business, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorCutscene);
tempBusinessData.needsSaved = true;
let businessId = getServerData().businesses.push(tempBusinessData);
setAllBusinessIndexes();
@@ -182,7 +180,7 @@ function createBusinessLocationCommand(command, params, client) {
// ===========================================================================
-function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInteriorId = 0, entranceVirtualWorld = 0, exitInteriorId = -1, exitVirtualWorld = -1, exitPickupModel = -1, exitBlipModel = -1) {
+function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInteriorId = 0, entranceVirtualWorld = 0, exitInteriorId = -1, exitVirtualWorld = -1, exitPickupModel = -1, exitBlipModel = -1, entranceCutscene = "") {
let tempBusinessData = new BusinessData(false);
tempBusinessData.name = name;
@@ -192,6 +190,7 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
tempBusinessData.entranceBlipModel = entranceBlipModel;
tempBusinessData.entranceInterior = entranceInteriorId;
tempBusinessData.entranceDimension = entranceVirtualWorld;
+ tempBusinessData.entranceCutscene = entranceCutscene;
tempBusinessData.exitPosition = exitPosition;
tempBusinessData.exitRotation = 0.0;
@@ -717,6 +716,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
getBusinessData(businessId).exitDimension = 0;
getBusinessData(businessId).exitInterior = -1;
getBusinessData(businessId).hasInterior = false;
+ getBusinessData(businessId).interiorCutscene = "";
getBusinessData(businessId).exitPickupModel = -1;
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`);
return false;
@@ -738,6 +738,9 @@ function setBusinessInteriorTypeCommand(command, params, client) {
getBusinessData(businessId).exitInterior = getGameConfig().interiors[getServerGame()][typeParam][1];
getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId+getGlobalConfig().businessDimensionStart;
getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getServerGame()].Exit;
+ if(getGameConfig().interiors[getServerGame()][typeParam].length == 3) {
+ getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getServerGame()][typeParam][2];
+ }
getBusinessData(businessId).hasInterior = true;
}
@@ -1256,6 +1259,8 @@ function saveBusinessToDatabase(businessId) {
let dbConnection = connectToDatabase();
if(dbConnection) {
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
+ let safeExitCutscene = escapeDatabaseString(dbConnection, tempBusinessData.exitCustscene);
+ let safeEntranceCutscene = escapeDatabaseString(dbConnection, tempBusinessData.entranceCutscene);
let data = [
["biz_server", getServerId()],
@@ -1273,6 +1278,7 @@ function saveBusinessToDatabase(businessId) {
["biz_entrance_vw", tempBusinessData.entranceDimension],
["biz_entrance_pickup", tempBusinessData.entrancePickupModel],
["biz_entrance_blip", tempBusinessData.entranceBlipModel],
+ ["biz_entrance_cutscene", safeEntranceCutscene],
["biz_exit_pos_x", tempBusinessData.exitPosition.x],
["biz_exit_pos_y", tempBusinessData.exitPosition.y],
["biz_exit_pos_z", tempBusinessData.exitPosition.z],
@@ -1281,6 +1287,7 @@ function saveBusinessToDatabase(businessId) {
["biz_exit_vw", tempBusinessData.exitDimension],
["biz_exit_pickup", tempBusinessData.exitPickupModel],
["biz_exit_blip", tempBusinessData.exitBlipModel],
+ ["biz_exit_cutscene", safeExitCutscene],
["biz_has_interior", boolToInt(tempBusinessData.hasInterior)],
["biz_interior_lights", boolToInt(tempBusinessData.interiorLights)],
["biz_label_help_type", tempBusinessData.labelHelpType],
diff --git a/scripts/server/class.js b/scripts/server/class.js
index 5ece105d..011ceef4 100644
--- a/scripts/server/class.js
+++ b/scripts/server/class.js
@@ -239,6 +239,10 @@ class ClientData {
this.locale = 0;
this.enteringVehicle = null;
+
+ this.customDisconnectReason = "";
+
+ this.interiorCutscene = "";
}
};
@@ -524,6 +528,7 @@ class BusinessData {
this.entranceBlipModel = -1;
this.entrancePickup = null;
this.entranceBlip = null;
+ this.entranceCutscene = "";
this.exitPosition = false;
this.exitRotation = 0.0;
@@ -533,6 +538,7 @@ class BusinessData {
this.exitBlipModel = -1;
this.exitPickup = null;
this.exitBlip = null;
+ this.exitCutscene = "";
this.entranceFee = 0;
this.till = 0;
@@ -557,6 +563,7 @@ class BusinessData {
this.entranceDimension = toInteger(dbAssoc["biz_entrance_vw"]);
this.entrancePickupModel = toInteger(dbAssoc["biz_entrance_pickup"]);
this.entranceBlipModel = toInteger(dbAssoc["biz_entrance_blip"]);
+ this.entranceCutscene = toString(dbAssoc["biz_entrance_cutscene"]);
this.exitPosition = toVector3(dbAssoc["biz_exit_pos_x"], dbAssoc["biz_exit_pos_y"], dbAssoc["biz_exit_pos_z"]);
this.exitRotation = toInteger(dbAssoc["biz_exit_rot_z"]);
@@ -564,12 +571,14 @@ class BusinessData {
this.exitDimension = toInteger(dbAssoc["biz_exit_vw"]);
this.exitPickupModel = toInteger(dbAssoc["biz_exit_pickup"]);
this.exitBlipModel = toInteger(dbAssoc["biz_exit_blip"]);
+ this.exitCutscene = toString(dbAssoc["biz_exit_cutscene"]);
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
this.till = toInteger(dbAssoc["biz_till"]);
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
this.streamingRadioStation = toInteger(dbAssoc["biz_radiostation"]);
+
}
};
};
@@ -658,6 +667,7 @@ class HouseData {
this.entranceBlipModel = -1;
this.entrancePickup = null;
this.entranceBlip = null;
+ this.entranceCutscene = "";
this.exitPosition = false;
this.exitRotation = 0.0;
@@ -667,6 +677,7 @@ class HouseData {
this.exitBlipModel = -1;
this.exitPickup = null;
this.exitBlip = null;
+ this.exitCutscene = "";
this.streamingRadioStation = -1;
@@ -688,6 +699,7 @@ class HouseData {
this.entranceDimension = toInteger(dbAssoc["house_entrance_vw"]);
this.entrancePickupModel = toInteger(dbAssoc["house_entrance_pickup"]);
this.entranceBlipModel = toInteger(dbAssoc["house_entrance_blip"]);
+ this.entranceCutscene = toString(dbAssoc["house_entrance_cutscene"]);
this.exitPosition = toVector3(toFloat(dbAssoc["house_exit_pos_x"]), toFloat(dbAssoc["house_exit_pos_y"]), toFloat(dbAssoc["house_exit_pos_z"]));
this.exitRotation = toFloat(dbAssoc["house_exit_rot_z"]);
@@ -695,6 +707,7 @@ class HouseData {
this.exitDimension = toInteger(dbAssoc["house_exit_vw"]);
this.exitPickupModel = toInteger(dbAssoc["house_exit_pickup"]);
this.exitBlipModel = toInteger(dbAssoc["house_exit_blip"]);
+ this.exitCutscene = toString(dbAssoc["house_exit_cutscene"]);
}
}
};
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 5bd79c7c..3ec3f077 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -1143,6 +1143,17 @@ function sendAllHousesToPlayer(client) {
// ==========================================================================
+function sendAllJobsToPlayer(client) {
+ //let jobs = getServerData().jobs;
+ //for(let i in jobs) {
+ // for(let j in jobs[i].locations) {
+ // sendJobToPlayer(client, jobs[i].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].blipModel);
+ // }
+ //}
+}
+
+// ==========================================================================
+
function makePlayerHoldObjectModel(client, modelIndex) {
sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).ped, modelIndex);
}
@@ -1159,4 +1170,11 @@ function requestPlayerPedNetworkId(client) {
sendNetworkEventToPlayer("vrr.playerPedId", client);
}
+// ==========================================================================
+
+function setPlayerInCutsceneInterior(client, cutsceneName) {
+ getPlayerData(client).interiorCutscene = cutsceneName;
+ sendNetworkEventToPlayer("vrr.cutsceneInterior", client, cutsceneName);
+}
+
// ==========================================================================
\ No newline at end of file
diff --git a/scripts/server/house.js b/scripts/server/house.js
index b9dee72c..6fb30280 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -737,6 +737,8 @@ function saveHouseToDatabase(houseId) {
let dbConnection = connectToDatabase();
if(dbConnection) {
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
+ let safeExitCutscene = escapeDatabaseString(dbConnection, tempHouseData.exitCutscene);
+ let safeEntranceCutscene = escapeDatabaseString(dbConnection, tempHouseData.entranceCutscene);
let data = [
["house_server", getServerId()],
@@ -753,6 +755,7 @@ function saveHouseToDatabase(houseId) {
["house_entrance_vw", tempHouseData.entranceDimension],
["house_entrance_pickup", tempHouseData.entrancePickupModel],
["house_entrance_blip", tempHouseData.entranceBlipModel],
+ ["house_entrance_cutscene", safeEntranceCutscene],
["house_exit_pos_x", tempHouseData.exitPosition.x],
["house_exit_pos_y", tempHouseData.exitPosition.y],
["house_exit_pos_z", tempHouseData.exitPosition.z],
@@ -761,10 +764,12 @@ function saveHouseToDatabase(houseId) {
["house_exit_vw", tempHouseData.exitDimension],
["house_exit_pickup", tempHouseData.exitPickupModel],
["house_exit_blip", tempHouseData.exitBlipModel],
+ ["house_exit_cutscene", safeExitCutscene],
["house_buy_price", tempHouseData.buyPrice],
["house_rent_price", tempHouseData.rentPrice],
["house_has_interior", boolToInt(tempHouseData.hasInterior)],
["house_interior_lights", boolToInt(tempHouseData.interiorLights)],
+
];
let dbQuery = null;
From f12051bfb67ed253453593db613906cce082a2ae Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:17:00 -0500
Subject: [PATCH 037/609] Fix for job blips
---
scripts/server/job.js | 54 ++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 19 deletions(-)
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 3f6ee78e..748ef560 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -2291,24 +2291,33 @@ function createJobLocationPickup(jobId, locationId) {
return false;
}
- if(getJobData(jobId).pickupModel != -1) {
+ let tempJobData = getJobData(jobId);
+
+ if(tempJobData.pickupModel != -1) {
let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job;
- if(getJobData(jobId).pickupModel != 0) {
- pickupModelId = getJobData(jobId).pickupModel;
+ if(tempJobData.pickupModel != 0) {
+ pickupModelId = tempJobData.pickupModel;
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${getServerData().jobs[jobId].name} job`);
+ logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
- getJobData(jobId).locations[locationId].pickup = createGamePickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
- setElementDimension(getJobData(jobId).locations[locationId].pickup, getJobData(jobId).locations[locationId].dimension);
- setElementOnAllDimensions(getJobData(jobId).locations[locationId].pickup, false);
- setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
- setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false);
- setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
- setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.name", getJobData(jobId).name, true);
- setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.jobType", getJobData(jobId).databaseId, true);
- addToWorld(getJobData(jobId).locations[locationId].pickup);
+ if(areServerElementsSupported()) {
+ let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
+ if(pickup != false) {
+ tempJobData.locations[locationId].pickup = pickup;
+ setElementDimension(pickup, tempJobData.locations[locationId].dimension);
+ setElementOnAllDimensions(pickup, false);
+ setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
+ setEntityData(pickup, "vrr.owner.id", locationId, false);
+ setEntityData(pickup, "vrr.label.type", VRR_LABEL_JOB, true);
+ setEntityData(pickup, "vrr.label.name", tempJobData.name, true);
+ setEntityData(pickup, "vrr.label.jobType", tempJobData.databaseId, true);
+ addToWorld(pickup);
+ }
+ } else {
+ // sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, pickupModel);
+ }
}
}
@@ -2319,6 +2328,8 @@ function createJobLocationBlip(jobId, locationId) {
return false;
}
+ let tempJobData = getJobData(jobId);
+
if(getJobData(jobId).blipModel != -1) {
let blipModelId = getGameConfig().blipSprites[getServerGame()].Job;
@@ -2326,12 +2337,17 @@ function createJobLocationBlip(jobId, locationId) {
blipModelId = getJobData(jobId).blipModel;
}
- getJobData(jobId).locations[locationId].blip = createGameBlip(getJobData(jobId).locations[locationId].position, blipModelId, getColourByType("job"));
- //setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, 30);
- //setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, 40);
- setElementOnAllDimensions(getJobData(jobId).locations[locationId].blip, false);
- setElementDimension(getJobData(jobId).locations[locationId].blip, getJobData(jobId).locations[locationId].dimension);
- addToWorld(getJobData(jobId).locations[locationId].blip);
+ if(areServerElementsSupported()) {
+ let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, getColourByType("job"));
+ if(blip != false) {
+ tempJobData.locations[locationId].blip = blip;
+ }
+ setElementOnAllDimensions(blip, false);
+ setElementDimension(blip, tempJobData.locations[locationId].dimension);
+ addToWorld(blip);
+ } else {
+ sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
+ }
}
}
From c89cc5cd3e7b49d3f77cde6fbc7c9b4ab289a8c9 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:17:19 -0500
Subject: [PATCH 038/609] Load objects when setting cutscene interior
---
scripts/client/utilities.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 6bcd7048..82a1276c 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -282,7 +282,7 @@ function enterVehicleAsPassenger() {
} else {
for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
- natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 1);
+ natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 10000);
}
}
}
@@ -360,6 +360,7 @@ function setLocalPlayerInterior(interior) {
if(getGameConfig().mainWorldInterior != interior) {
let interiorId = natives.getInteriorAtCoords(localPlayer.position);
natives.activateInterior(interiorId, true);
+ natives.loadAllObjectsNow();
}
}
}
From e8fa5089bc68b59f4a13f589e50140eac609ccdc Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:17:34 -0500
Subject: [PATCH 039/609] Change some IV gamedata interiors and skins
---
scripts/shared/gamedata.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index eb6c8d05..a39525ec 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -1338,7 +1338,7 @@ let gameData = {
[-1902758612,"Male Gym Worker" , true],
[-356904519 ,"Mechanic 2," , true],
[-1056268969,"Male Modo Worker" , true],
- [ 1201610759,"Helicopter Pilot" , false],
+ [ 1201610759,"Helicopter Pilot 2" , false],
[-151000142 ,"Perseus" , true],
[ 501136335 ,"Generic Male 1," , true],
[ 186619473 ,"Generic Male 2," , true],
@@ -4436,15 +4436,15 @@ let gameData = {
{ // GTA IV
Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
- House1: [toVector3(-426.16, 1466.52, 38.971), 0],
- House2: [toVector3(-969.77, 883.27, 18.817), 0],
- House3: [toVector3(95.75, 851.68, 45.051), 0],
- House4: [toVector3(603.04, 1404.06, 17.479), 0],
- House5: [toVector3(892.56, -502.13, 19.407), 0],
- House6: [toVector3(-524.09, 830.54, 23.627), 0],
- House7: [toVector3(806.36, 146.68, 29.243), 0],
- House8: [toVector3(356.91, 1511.28, 21.432), 0],
- House9: [toVector3(1319.40, -847.02, 8.872), 0],
+ PlayBoyXHouse: [toVector3(-426.16, 1466.52, 38.971), 0, "playboyx"],
+ RaySafeHouse: [toVector3(-969.77, 883.27, 18.817), 0],
+ RomanHouse2: [toVector3(95.75, 851.68, 45.051), 0],
+ SouthBohanHouse: [toVector3(603.04, 1404.06, 17.479), 0],
+ HoveBeachHouse: [toVector3(892.56, -502.13, 19.407), 0, "bronxsave"],
+ House6: [toVector3(-524.09, 830.54, 23.627), 0, "shootapt"],
+ BrucieHouse: [toVector3(806.36, 146.68, 29.243), 0, "brucieloft"],
+ ElizabetaHouse: [toVector3(356.91, 1511.28, 21.432), 0, "shootapt"],
+ House9DontUse: [toVector3(1319.40, -847.02, 8.872), 0],
House10: [toVector3(1331.40, 126.60, 36.558), 0],
House11: [toVector3(1387.81, 622.66, 35.857), 0],
House12: [toVector3(932.74, -189.29, 35.143), 0],
@@ -4452,7 +4452,7 @@ let gameData = {
House14: [toVector3(806.36, 146.68, 29.243), 0],
House15: [toVector3(-526.49, 829.41, 23.627), 0],
Gym: [toVector3(403.31, 1480.32, 11.834), 0],
- PoliceStation: [toVector3(-406.52, 286.57, 13.682), 0],
+ PoliceStation: [toVector3(-406.52, 286.57, 13.682), 0, "copshop"],
FancyRestaurant: [toVector3(-118.24, -259.06, 12.654), 0],
Basement: [toVector3(1304.38, -856.66, 5.490), 0],
Office1: [toVector3(-409.31, 285.49, 18.592), 0],
From 47764b0a767bf2664f487013fc336efd3305ed2b Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:17:46 -0500
Subject: [PATCH 040/609] Cutscene interior stuff
---
scripts/server/misc.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 2b0b84ee..1f342c26 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -221,8 +221,10 @@ function enterExitPropertyCommand(command, params, client) {
if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
+ setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
updateInteriorLightsForPlayer(client, closestProperty.interiorLights);
}, 1000);
+ //setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
//updateAllInteriorVehiclesForPlayer(client, closestProperty.exitInterior, closestProperty.exitDimension);
}, 1100);
if(closestProperty.streamingRadioStation != -1) {
@@ -257,11 +259,14 @@ function enterExitPropertyCommand(command, params, client) {
if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
}
+ setPlayerInCutsceneInterior(client, closestProperty.entranceCutscene);
updateInteriorLightsForPlayer(client, true);
}, 1000);
}, 1100);
+ //setPlayerInCutsceneInterior(client, closestProperty.entranceCutscene);
stopRadioStreamForPlayer(client);
getPlayerData(client).streamingRadioStation = -1;
+
//logToConsole(LOG_DEBUG, `[VRR.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
return true;
}
From 297ab6f8f807716a70153105a7c18668213b0dd2 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 15 Mar 2022 04:17:58 -0500
Subject: [PATCH 041/609] Custom disconnect reason
---
scripts/server/account.js | 1 +
scripts/server/event.js | 13 +++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/server/account.js b/scripts/server/account.js
index 01a57bf0..ebead70e 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -569,6 +569,7 @@ function loginSuccess(client) {
if(doesServerHaveTesterOnlyEnabled()) {
if(!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
setTimeout(function() {
+ getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
client.disconnect();
}, 3500);
diff --git a/scripts/server/event.js b/scripts/server/event.js
index 4f4e1ccc..b10b1780 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -60,7 +60,8 @@ function onPlayerJoin(event, client) {
fadeCamera(client, true, 1.0);
}
- messageDiscordEventChannel(`๐ ${getPlayerDisplayForConsole(client)} has joined the server.`);
+ messageAdmins(`${client.name} is joining the server ...`);
+ //messageDiscordEventChannel(`๐ ${getPlayerDisplayForConsole(client)} has joined the server.`);
}
// ===========================================================================
@@ -97,7 +98,11 @@ function onPlayerQuit(event, client, quitReasonId) {
updateConnectionLogOnQuit(client, quitReasonId);
if(isPlayerLoggedIn(client)) {
- messagePlayerNormal(null, `๐ ${getPlayerName(client)} has left the server (${disconnectReasons[quitReasonId]})`, getColourByName("softYellow"));
+ let reasonText = disconnectReasons[quitReasonId];
+ if(getPlayerData(client).customDisconnectReason != "") {
+ reasonText = getPlayerData(client).customDisconnectReason;
+ }
+ messagePlayerNormal(null, `๐ ${getPlayerName(client)} has left the server (${reasonText})`, getColourByName("softYellow"));
savePlayerToDatabase(client);
resetClientStuff(client);
getServerData().clients[client.index] = null;
@@ -587,8 +592,8 @@ function onPlayerSpawn(client) {
if(!areServerElementsSupported()) {
sendAllBusinessesToPlayer(client);
- //sendAllHousesToPlayer(client);
- //sendAllJobLocationsToPlayer(client);
+ sendAllHousesToPlayer(client);
+ sendAllJobsToPlayer(client);
//sendAllVehiclesToPlayer(client);
requestPlayerPedNetworkId(client);
From efc72dffe19275d6db21d34171c1c36f96e09427 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 16 Mar 2022 17:02:33 -0500
Subject: [PATCH 042/609] Mass convert indentation + add ped speech cmd
---
scripts/client/afk.js | 2 +-
scripts/client/animation.js | 96 +-
scripts/client/business.js | 164 +-
scripts/client/chatbox.js | 74 +-
scripts/client/content.js | 74 +-
scripts/client/event.js | 214 +-
scripts/client/gui.js | 6 +-
scripts/client/house.js | 148 +-
scripts/client/item.js | 46 +-
scripts/client/job.js | 228 +-
scripts/client/jsconfig.json | 16 +-
scripts/client/keybind.js | 80 +-
scripts/client/label.js | 380 +-
scripts/client/logo.js | 30 +-
scripts/client/messaging.js | 66 +-
scripts/client/mousecam.js | 8 +-
scripts/client/nametag.js | 50 +-
scripts/client/native/connected.js | 28 +-
scripts/client/radio.js | 32 +-
scripts/client/scoreboard.js | 2 +-
scripts/client/server.js | 385 +-
scripts/client/skin-select.js | 182 +-
scripts/client/startup.js | 283 +-
scripts/client/sync.js | 634 +--
scripts/client/utilities.js | 994 ++---
scripts/server/accent.js | 16 +-
scripts/server/account.js | 6 +-
scripts/server/animation.js | 18 +-
scripts/server/anticheat.js | 4 +-
scripts/server/ban.js | 291 +-
scripts/server/bitflag.js | 48 +-
scripts/server/business.js | 26 +-
scripts/server/business/casino.js | 106 +-
scripts/server/chat.js | 12 +-
scripts/server/clan.js | 64 +-
scripts/server/class.js | 8 +-
scripts/server/client.js | 878 ++--
scripts/server/command.js | 1182 +++---
scripts/server/config.js | 72 +-
scripts/server/database.js | 1 -
scripts/server/developer.js | 6 +-
scripts/server/discord.js | 118 +-
scripts/server/economy.js | 14 +-
scripts/server/email.js | 42 +-
scripts/server/event.js | 780 ++--
scripts/server/gate.js | 12 +-
scripts/server/gui.js | 138 +-
scripts/server/help.js | 414 +-
scripts/server/house.js | 44 +-
scripts/server/item.js | 46 +-
scripts/server/job.js | 286 +-
scripts/server/jsconfig.json | 20 +-
scripts/server/keybind.js | 226 +-
scripts/server/locale.js | 116 +-
scripts/server/messaging.js | 198 +-
scripts/server/misc.js | 187 +-
scripts/server/npc.js | 4 +-
scripts/server/npc/taxi.js | 24 +-
scripts/server/radio.js | 2 +-
scripts/server/staff.js | 258 +-
scripts/server/subaccount.js | 2 +-
scripts/server/timers.js | 24 +-
scripts/server/trigger.js | 76 +-
scripts/server/tutorial.js | 4 +-
scripts/server/utilities.js | 10 +-
scripts/server/vehicle.js | 160 +-
scripts/shared/gamedata.js | 6138 ++++++++++++++--------------
scripts/shared/utilities.js | 410 +-
68 files changed, 8401 insertions(+), 8312 deletions(-)
diff --git a/scripts/client/afk.js b/scripts/client/afk.js
index 95cbd995..973b9cef 100644
--- a/scripts/client/afk.js
+++ b/scripts/client/afk.js
@@ -21,7 +21,7 @@ function processLostFocusAFK(event) {
// ===========================================================================
function processFocusAFK(event) {
- sendServerNewAFKStatus(false);
+ sendServerNewAFKStatus(false);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/animation.js b/scripts/client/animation.js
index 2d5760e5..1c9a2d2c 100644
--- a/scripts/client/animation.js
+++ b/scripts/client/animation.js
@@ -8,68 +8,68 @@
// ===========================================================================
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, freezePlayer) {
- logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
- if(getGame() < VRR_GAME_GTA_IV) {
- if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
- if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
- getElementFromId(pedId).clearAnimations();
- } else {
- getElementFromId(pedId).clearObjective();
- }
- getElementFromId(pedId).addAnimation(animGroup, animId);
+ logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
+ if(getGame() < VRR_GAME_GTA_IV) {
+ if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
+ if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
+ getElementFromId(pedId).clearAnimations();
+ } else {
+ getElementFromId(pedId).clearObjective();
+ }
+ getElementFromId(pedId).addAnimation(animGroup, animId);
- if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
- inAnimation = true;
- setLocalPlayerControlState(false, false);
- localPlayer.collisionsEnabled = false;
- }
- } else if(animType == VRR_ANIMTYPE_BLEND) {
- getElementFromId(pedId).position = getElementFromId(pedId).position;
- getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
- }
- } else {
- natives.requestAnims(animGroup);
- natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
- }
+ if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
+ inAnimation = true;
+ setLocalPlayerControlState(false, false);
+ localPlayer.collisionsEnabled = false;
+ }
+ } else if(animType == VRR_ANIMTYPE_BLEND) {
+ getElementFromId(pedId).position = getElementFromId(pedId).position;
+ getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
+ }
+ } else {
+ natives.requestAnims(animGroup);
+ natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
+ }
}
// ===========================================================================
function forcePedAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
- if(getGame() < VRR_GAME_GTA_IV) {
- forcedAnimation = [animGroup, animId];
- getElementFromId(pedId).position = getElementFromId(pedId).position;
- getElementFromId(pedId).addAnimation(animGroup, animId);
+ if(getGame() < VRR_GAME_GTA_IV) {
+ forcedAnimation = [animGroup, animId];
+ getElementFromId(pedId).position = getElementFromId(pedId).position;
+ getElementFromId(pedId).addAnimation(animGroup, animId);
- if(getElementFromId(pedId) == localPlayer) {
- inAnimation = true;
- setLocalPlayerControlState(false, false);
- localPlayer.collisionsEnabled = false;
- }
- }
+ if(getElementFromId(pedId) == localPlayer) {
+ inAnimation = true;
+ setLocalPlayerControlState(false, false);
+ localPlayer.collisionsEnabled = false;
+ }
+ }
}
// ===========================================================================
function makePedStopAnimation(pedId) {
- if(getElementFromId(pedId) == null) {
- return false;
- }
+ if(getElementFromId(pedId) == null) {
+ return false;
+ }
- if(getGame() != VRR_GAME_GTA_IV) {
- if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
- getElementFromId(pedId).clearAnimations();
- } else {
- getElementFromId(pedId).clearObjective();
- }
- }
+ if(getGame() != VRR_GAME_GTA_IV) {
+ if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
+ getElementFromId(pedId).clearAnimations();
+ } else {
+ getElementFromId(pedId).clearObjective();
+ }
+ }
- if(getElementFromId(pedId) == localPlayer) {
- if(getGame() != VRR_GAME_GTA_IV) {
- localPlayer.collisionsEnabled = true;
- }
- setLocalPlayerControlState(true, false);
- }
+ if(getElementFromId(pedId) == localPlayer) {
+ if(getGame() != VRR_GAME_GTA_IV) {
+ localPlayer.collisionsEnabled = true;
+ }
+ setLocalPlayerControlState(true, false);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/business.js b/scripts/client/business.js
index a2d15e04..29f712f7 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -8,83 +8,83 @@
// ===========================================================================
class BusinessData {
- constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- this.index = -1;
- this.businessId = businessId;
- this.name = name;
- this.entrancePosition = entrancePosition;
- this.blipModel = blipModel;
- this.pickupModel = pickupModel;
- this.hasInterior = hasInterior;
- this.hasItems = hasItems;
- this.blipId = -1;
- }
+ constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
+ this.index = -1;
+ this.businessId = businessId;
+ this.name = name;
+ this.entrancePosition = entrancePosition;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.hasInterior = hasInterior;
+ this.hasItems = hasItems;
+ this.blipId = -1;
+ }
}
// ===========================================================================
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
-
- if(getGame() == VRR_GAME_GTA_IV) {
- if(getBusinessData(businessId) != false) {
- let businessData = getBusinessData(businessId);
- businessData.name = name;
- businessData.entrancePosition = entrancePosition;
- businessData.blipModel = blipModel;
- businessData.pickupModel = pickupModel;
- businessData.hasInterior = hasInterior;
- businessData.hasItems = hasItems;
+ logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
- if(blipModel == -1) {
- if(businessData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
- } else {
- destroyElement(getElementFromId(blipId));
- }
- businessData.blipId = -1;
- //businesses.splice(businessData.index, 1);
- //setAllBusinessDataIndexes();
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
- }
- } else {
- if(businessData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
- natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
- natives.setBlipMarkerLongDistance(businessData.blipId, false);
- natives.setBlipAsShortRange(tempBusinessData.blipId, true);
- natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
- }
- } else {
- let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
- if(blipId != -1) {
- tempBusinessData.blipId = blipId;
- }
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- }
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
- let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
- if(blipModel != -1) {
- let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
- if(blipId != -1) {
- tempBusinessData.blipId = blipId;
- }
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
- }
- businesses.push(tempBusinessData);
- setAllBusinessDataIndexes();
- }
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(getBusinessData(businessId) != false) {
+ let businessData = getBusinessData(businessId);
+ businessData.name = name;
+ businessData.entrancePosition = entrancePosition;
+ businessData.blipModel = blipModel;
+ businessData.pickupModel = pickupModel;
+ businessData.hasInterior = hasInterior;
+ businessData.hasItems = hasItems;
+
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(businessData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ businessData.blipId = -1;
+ //businesses.splice(businessData.index, 1);
+ //setAllBusinessDataIndexes();
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
+ }
+ } else {
+ if(businessData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
+ natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
+ natives.setBlipMarkerLongDistance(businessData.blipId, false);
+ natives.setBlipAsShortRange(tempBusinessData.blipId, true);
+ natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
+ if(blipId != -1) {
+ tempBusinessData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
+ let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
+ if(blipId != -1) {
+ tempBusinessData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
+ }
+ businesses.push(tempBusinessData);
+ setAllBusinessDataIndexes();
+ }
+ }
}
// ===========================================================================
@@ -94,23 +94,23 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
* @return {BusinessData} The business's data (class instance)
*/
function getBusinessData(businessId) {
- //let tempBusinessData = businesses.find((b) => b.businessId == businessId);
- //return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
- for(let i in businesses) {
- if(businesses[i].businessId == businessId) {
- return businesses[i];
- }
- }
+ //let tempBusinessData = businesses.find((b) => b.businessId == businessId);
+ //return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
+ for(let i in businesses) {
+ if(businesses[i].businessId == businessId) {
+ return businesses[i];
+ }
+ }
- return false;
+ return false;
}
// ===========================================================================
function setAllBusinessDataIndexes() {
- for(let i in businesses) {
- businesses[i].index = i;
- }
+ for(let i in businesses) {
+ businesses[i].index = i;
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/chatbox.js b/scripts/client/chatbox.js
index 64e454f6..28408a28 100644
--- a/scripts/client/chatbox.js
+++ b/scripts/client/chatbox.js
@@ -22,89 +22,89 @@ let scrollDownKey = false;
// ===========================================================================
function initChatBoxScript() {
- logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
- scrollUpKey = getKeyIdFromParams("pageup");
- scrollDownKey = getKeyIdFromParams("pagedown");
- bindChatBoxKeys();
- logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
+ scrollUpKey = getKeyIdFromParams("pageup");
+ scrollDownKey = getKeyIdFromParams("pagedown");
+ bindChatBoxKeys();
+ logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
}
// ===========================================================================
function bindChatBoxKeys() {
- bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
- bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
+ bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
+ bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
}
// ===========================================================================
function unBindChatBoxKeys() {
- unbindKey(toInteger(scrollUpKey));
- unbindKey(toInteger(scrollDownKey));
+ unbindKey(toInteger(scrollUpKey));
+ unbindKey(toInteger(scrollDownKey));
}
// ===========================================================================
function receiveChatBoxMessageFromServer(messageString, colour) {
- logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Received chatbox message from server: ${messageString}`);
- let colouredString = replaceColoursInMessage(messageString);
+ logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Received chatbox message from server: ${messageString}`);
+ let colouredString = replaceColoursInMessage(messageString);
- if(bottomMessageIndex >= chatBoxHistory.length-1) {
- message(colouredString, colour);
- bottomMessageIndex = chatBoxHistory.length-1;
- }
- addToChatBoxHistory(colouredString, colour);
+ if(bottomMessageIndex >= chatBoxHistory.length-1) {
+ message(colouredString, colour);
+ bottomMessageIndex = chatBoxHistory.length-1;
+ }
+ addToChatBoxHistory(colouredString, colour);
}
// ===========================================================================
function setChatScrollLines(amount) {
- scrollAmount = amount;
+ scrollAmount = amount;
}
// ===========================================================================
function addToChatBoxHistory(messageString, colour) {
- chatBoxHistory.push([messageString, colour]);
+ chatBoxHistory.push([messageString, colour]);
}
// ===========================================================================
function chatBoxScrollUp() {
- if(bottomMessageIndex > maxChatBoxLines) {
- bottomMessageIndex = bottomMessageIndex-scrollAmount;
- updateChatBox();
- }
+ if(bottomMessageIndex > maxChatBoxLines) {
+ bottomMessageIndex = bottomMessageIndex-scrollAmount;
+ updateChatBox();
+ }
}
// ===========================================================================
function chatBoxScrollDown() {
- if(bottomMessageIndex < chatBoxHistory.length-1) {
- bottomMessageIndex = bottomMessageIndex+scrollAmount;
- updateChatBox();
- }
+ if(bottomMessageIndex < chatBoxHistory.length-1) {
+ bottomMessageIndex = bottomMessageIndex+scrollAmount;
+ updateChatBox();
+ }
}
// ===========================================================================
function clearChatBox() {
- for(let i = 0 ; i <= maxChatBoxLines ; i++) {
- message("", COLOUR_WHITE);
- }
+ for(let i = 0 ; i <= maxChatBoxLines ; i++) {
+ message("", COLOUR_WHITE);
+ }
}
// ===========================================================================
function updateChatBox() {
- clearChatBox();
- for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
- if(typeof chatBoxHistory[i] != "undefined") {
- message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
- } else {
- message("", COLOUR_WHITE);
- }
- }
+ clearChatBox();
+ for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
+ if(typeof chatBoxHistory[i] != "undefined") {
+ message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
+ } else {
+ message("", COLOUR_WHITE);
+ }
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/content.js b/scripts/client/content.js
index 214655ea..bcae54d0 100644
--- a/scripts/client/content.js
+++ b/scripts/client/content.js
@@ -8,58 +8,58 @@
// ===========================================================================
function getCustomImage(imageName) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- let image = contentResource.exports.getCustomImage(imageName);
- if(image != null) {
- return image;
- }
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ let image = contentResource.exports.getCustomImage(imageName);
+ if(image != null) {
+ return image;
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
function getCustomFont(fontName) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- let font = contentResource.exports.getCustomFont(fontName);
- if(font != null) {
- return font;
- }
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ let font = contentResource.exports.getCustomFont(fontName);
+ if(font != null) {
+ return font;
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
function getCustomAudio(audioName) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- let audioFile = contentResource.exports.getCustomAudio(audioName);
- if(audioFile != null) {
- return audioFile;
- }
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ let audioFile = contentResource.exports.getCustomAudio(audioName);
+ if(audioFile != null) {
+ return audioFile;
+ }
+ }
+ }
+ return false;
}
// ===========================================================================
function playCustomAudio(audioName, volume = 0.5, loop = false) {
- let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
- if(contentResource != null) {
- if(contentResource.isStarted) {
- contentResource.exports.playCustomAudio(audioName, volume, loop);
- }
- }
- return false;
+ let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
+ if(contentResource != null) {
+ if(contentResource.isStarted) {
+ contentResource.exports.playCustomAudio(audioName, volume, loop);
+ }
+ }
+ return false;
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 2bc8a09d..91d1e502 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -8,210 +8,210 @@
// ===========================================================================
function initEventScript() {
- logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
- addCustomEvents();
- addAllEventHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
+ addCustomEvents();
+ addAllEventHandlers();
+ logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
}
// ===========================================================================
function addCustomEvents() {
- addEvent("OnLocalPlayerEnterSphere", 1);
- addEvent("OnLocalPlayerExitSphere", 1);
- addEvent("OnLocalPlayerEnteredVehicle", 1);
- addEvent("OnLocalPlayerExitedVehicle", 1);
- addEvent("OnLocalPlayerSwitchWeapon", 2);
+ addEvent("OnLocalPlayerEnterSphere", 1);
+ addEvent("OnLocalPlayerExitSphere", 1);
+ addEvent("OnLocalPlayerEnteredVehicle", 1);
+ addEvent("OnLocalPlayerExitedVehicle", 1);
+ addEvent("OnLocalPlayerSwitchWeapon", 2);
}
// ===========================================================================
function addAllEventHandlers() {
- bindEventHandler("OnResourceStart", thisResource, onResourceStart);
- bindEventHandler("OnResourceReady", thisResource, onResourceReady);
- bindEventHandler("OnResourceStop", thisResource, onResourceStop);
+ bindEventHandler("OnResourceStart", thisResource, onResourceStart);
+ bindEventHandler("OnResourceReady", thisResource, onResourceReady);
+ bindEventHandler("OnResourceStop", thisResource, onResourceStop);
- addEventHandler("OnProcess", onProcess);
- addEventHandler("OnKeyUp", onKeyUp);
- addEventHandler("OnDrawnHUD", onDrawnHUD);
+ addEventHandler("OnProcess", onProcess);
+ addEventHandler("OnKeyUp", onKeyUp);
+ addEventHandler("OnDrawnHUD", onDrawnHUD);
- addEventHandler("OnPedWasted", onPedWasted);
+ addEventHandler("OnPedWasted", onPedWasted);
- addEventHandler("OnElementStreamIn", onElementStreamIn);
+ addEventHandler("OnElementStreamIn", onElementStreamIn);
- addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
- addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
- addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
- addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
- addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
+ addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
+ addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
+ addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
+ addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
+ addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
- addEventHandler("OnPedInflictDamage", onPedInflictDamage);
+ addEventHandler("OnPedInflictDamage", onPedInflictDamage);
- addEventHandler("OnLostFocus", onLostFocus);
- addEventHandler("OnFocus", onFocus);
+ addEventHandler("OnLostFocus", onLostFocus);
+ addEventHandler("OnFocus", onFocus);
- addEventHandler("OnCameraProcess", onCameraProcess);
+ addEventHandler("OnCameraProcess", onCameraProcess);
}
// ===========================================================================
function onResourceStart(event, resource) {
- sendResourceStartedSignalToServer();
- setUpInitialGame();
- garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
+ sendResourceStartedSignalToServer();
+ setUpInitialGame();
+ garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
}
// ===========================================================================
function onResourceStop(event, resource) {
- sendResourceStoppedSignalToServer();
+ sendResourceStoppedSignalToServer();
}
// ===========================================================================
function onResourceReady(event, resource) {
- sendResourceReadySignalToServer();
+ sendResourceReadySignalToServer();
}
// ===========================================================================
function onProcess(event, deltaTime) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
- if(!isSpawned) {
- return false;
- }
+ if(!isSpawned) {
+ return false;
+ }
- processSync();
- processLocalPlayerControlState();
- processLocalPlayerVehicleControlState();
- processLocalPlayerSphereEntryExitHandling();
- processLocalPlayerVehicleEntryExitHandling();
- processJobRouteSphere();
- forceLocalPlayerEquippedWeaponItem();
- processWantedLevelReset();
- processGameSpecifics();
- processNearbyPickups();
- processVehiclePurchasing();
- //processVehicleFires();
+ processSync();
+ processLocalPlayerControlState();
+ processLocalPlayerVehicleControlState();
+ processLocalPlayerSphereEntryExitHandling();
+ processLocalPlayerVehicleEntryExitHandling();
+ processJobRouteSphere();
+ forceLocalPlayerEquippedWeaponItem();
+ processWantedLevelReset();
+ processGameSpecifics();
+ processNearbyPickups();
+ processVehiclePurchasing();
+ //processVehicleFires();
}
// ===========================================================================
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
- processSkinSelectKeyPress(keyCode);
- //processKeyDuringAnimation();
- processGUIKeyPress(keyCode);
- processToggleGUIKeyPress(keyCode);
+ processSkinSelectKeyPress(keyCode);
+ //processKeyDuringAnimation();
+ processGUIKeyPress(keyCode);
+ processToggleGUIKeyPress(keyCode);
}
// ===========================================================================
function onDrawnHUD(event) {
- if(!renderHUD) {
- return false;
- }
+ if(!renderHUD) {
+ return false;
+ }
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
- processSmallGameMessageRendering();
- processScoreBoardRendering();
- processLabelRendering();
- processLogoRendering();
- processItemActionRendering();
- processSkinSelectRendering();
- processNameTagRendering();
- processInteriorLightsRendering();
+ processSmallGameMessageRendering();
+ processScoreBoardRendering();
+ processLabelRendering();
+ processLogoRendering();
+ processItemActionRendering();
+ processSkinSelectRendering();
+ processNameTagRendering();
+ processInteriorLightsRendering();
}
// ===========================================================================
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
- wastedPed.clearWeapons();
+ logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
+ wastedPed.clearWeapons();
}
// ===========================================================================
function onElementStreamIn(event, element) {
- syncElementProperties(element);
+ syncElementProperties(element);
}
// ===========================================================================
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
- sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
+ sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
- if(inVehicleSeat) {
- parkedVehiclePosition = false;
- parkedVehicleHeading = false;
- }
+ if(inVehicleSeat) {
+ parkedVehiclePosition = false;
+ parkedVehicleHeading = false;
+ }
}
// ===========================================================================
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
- sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
- if(inVehicleSeat == 0) {
- inVehicle.engine = false;
- if(!inVehicle.engine) {
- parkedVehiclePosition = inVehicle.position;
- parkedVehicleHeading = inVehicle.heading;
- }
- }
+ if(inVehicleSeat == 0) {
+ inVehicle.engine = false;
+ if(!inVehicle.engine) {
+ parkedVehiclePosition = inVehicle.position;
+ parkedVehicleHeading = inVehicle.heading;
+ }
+ }
}
// ===========================================================================
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
- //let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
- //let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
- //logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
- if(!isNull(damagedEntity) && !isNull(damagerEntity)) {
- if(damagedEntity.isType(ELEMENT_PLAYER)) {
- if(damagedEntity == localPlayer) {
- //if(!weaponDamageEnabled[damagerEntity.name]) {
- event.preventDefault();
- sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
- //}
- }
- }
- }
+ //let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
+ //let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
+ //logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
+ if(!isNull(damagedEntity) && !isNull(damagerEntity)) {
+ if(damagedEntity.isType(ELEMENT_PLAYER)) {
+ if(damagedEntity == localPlayer) {
+ //if(!weaponDamageEnabled[damagerEntity.name]) {
+ event.preventDefault();
+ sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
+ //}
+ }
+ }
+ }
}
// ===========================================================================
function onLocalPlayerEnterSphere(event, sphere) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
- if(sphere == jobRouteLocationSphere) {
- enteredJobRouteSphere();
- }
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
+ if(sphere == jobRouteLocationSphere) {
+ enteredJobRouteSphere();
+ }
}
// ===========================================================================
function onLocalPlayerExitSphere(event, sphere) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited sphere`);
+ logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited sphere`);
}
// ===========================================================================
function onLostFocus(event) {
- processLostFocusAFK();
+ processLostFocusAFK();
}
// ===========================================================================
function onFocus(event) {
- processFocusAFK();
+ processFocusAFK();
}
// ===========================================================================
@@ -227,8 +227,8 @@ function onCameraProcess(event) {
// ===========================================================================
function onChatOutput(event, messageText, colour) {
- //event.preventDefault();
- //receiveChatBoxMessageFromServer(messageText, colour);
+ //event.preventDefault();
+ //receiveChatBoxMessageFromServer(messageText, colour);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 86bd4cf3..676fde38 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -104,7 +104,7 @@ function closeAllWindows() {
listDialog.window.shown = false;
resetPassword.window.shown = false;
passwordChange.window.shown = false;
-
+
mexui.setInput(false);
mexui.focusedControl = false;
@@ -284,8 +284,8 @@ addNetworkEventHandler("vrr.guiInit", function() {
// ===========================================================================
function hideAllGUI() {
- closeAllWindows();
- setChatWindowEnabled(true);
+ closeAllWindows();
+ setChatWindowEnabled(true);
guiSubmitKey = false;
}
diff --git a/scripts/client/house.js b/scripts/client/house.js
index 47d4157e..5b74ef03 100644
--- a/scripts/client/house.js
+++ b/scripts/client/house.js
@@ -8,77 +8,77 @@
// ===========================================================================
class HouseData {
- constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- this.index = -1;
- this.houseId = houseId;
- this.entrancePosition = entrancePosition;
- this.blipModel = blipModel;
- this.pickupModel = pickupModel;
- this.hasInterior = hasInterior;
- this.blipId = -1;
- }
+ constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
+ this.index = -1;
+ this.houseId = houseId;
+ this.entrancePosition = entrancePosition;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.hasInterior = hasInterior;
+ this.blipId = -1;
+ }
}
// ===========================================================================
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
-
- if(getGame() == VRR_GAME_GTA_IV) {
- if(getHouseData(houseId) != false) {
- let houseData = getHouseData(houseId);
- houseData.entrancePosition = entrancePosition;
- houseData.blipModel = blipModel;
- houseData.pickupModel = pickupModel;
- houseData.hasInterior = hasInterior;
+ logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
- if(blipModel == -1) {
- if(houseData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been removed by the server`);
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
- } else {
- destroyElement(getElementFromId(blipId));
- }
- houseData.blipId = -1;
- } else {
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
- }
- } else {
- if(houseData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been changed by the server`);
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
- natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
- natives.setBlipMarkerLongDistance(houseData.blipId, false);
- natives.setBlipAsShortRange(houseData.blipId, true);
- natives.changeBlipNameFromAscii(houseData.blipId, `${houseData.name.substr(0, 24)}${(houseData.name.length > 24) ? " ...": ""}`);
- }
- } else {
- let blipId = createGameBlip(houseData.blipModel, houseData.entrancePosition, houseData.name);
- if(blipId != -1) {
- houseData.blipId = blipId;
- }
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- }
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} doesn't exist. Adding ...`);
- let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior);
- if(blipModel != -1) {
- let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
- if(blipId != -1) {
- tempHouseData.blipId = blipId;
- }
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
- }
- houses.push(tempHouseData);
- setAllHouseDataIndexes();
- }
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(getHouseData(houseId) != false) {
+ let houseData = getHouseData(houseId);
+ houseData.entrancePosition = entrancePosition;
+ houseData.blipModel = blipModel;
+ houseData.pickupModel = pickupModel;
+ houseData.hasInterior = hasInterior;
+
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(houseData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ houseData.blipId = -1;
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
+ }
+ } else {
+ if(houseData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
+ natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
+ natives.setBlipMarkerLongDistance(houseData.blipId, false);
+ natives.setBlipAsShortRange(houseData.blipId, true);
+ natives.changeBlipNameFromAscii(houseData.blipId, `${houseData.name.substr(0, 24)}${(houseData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(houseData.blipModel, houseData.entrancePosition, houseData.name);
+ if(blipId != -1) {
+ houseData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} doesn't exist. Adding ...`);
+ let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
+ if(blipId != -1) {
+ tempHouseData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
+ }
+ houses.push(tempHouseData);
+ setAllHouseDataIndexes();
+ }
+ }
}
// ===========================================================================
@@ -88,21 +88,21 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
* @return {HouseData} The house's data (class instance)
*/
function getHouseData(houseId) {
- for(let i in houses) {
- if(houses[i].houseId == houseId) {
- return houses[i];
- }
- }
+ for(let i in houses) {
+ if(houses[i].houseId == houseId) {
+ return houses[i];
+ }
+ }
- return false;
+ return false;
}
// ===========================================================================
function setAllHouseDataIndexes() {
- for(let i in houses) {
- houses[i].index = i;
- }
+ for(let i in houses) {
+ houses[i].index = i;
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/item.js b/scripts/client/item.js
index a1735ae0..783426eb 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -23,40 +23,40 @@ function initItemScript() {
// ===========================================================================
function processItemActionRendering() {
- if(renderItemActionDelay) {
- if(itemActionDelayEnabled) {
- let finishTime = itemActionDelayStart+itemActionDelayDuration;
- if(sdl.ticks >= finishTime) {
- itemActionDelayEnabled = false;
- itemActionDelayDuration = 0;
- itemActionDelayStart = 0;
- tellServerItemActionDelayComplete();
- } else {
- let currentTick = sdl.ticks-itemActionDelayStart;
- let progressPercent = Math.ceil(currentTick*100/itemActionDelayDuration);
- let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
+ if(renderItemActionDelay) {
+ if(itemActionDelayEnabled) {
+ let finishTime = itemActionDelayStart+itemActionDelayDuration;
+ if(sdl.ticks >= finishTime) {
+ itemActionDelayEnabled = false;
+ itemActionDelayDuration = 0;
+ itemActionDelayStart = 0;
+ tellServerItemActionDelayComplete();
+ } else {
+ let currentTick = sdl.ticks-itemActionDelayStart;
+ let progressPercent = Math.ceil(currentTick*100/itemActionDelayDuration);
+ let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
- let backgroundColour = toColour(0, 0, 0, 255);
- graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2)-1, itemActionDelayPosition.y-(itemActionDelaySize.y/2)-1], [itemActionDelaySize.x+2, itemActionDelaySize.y+2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
- graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2), itemActionDelayPosition.y-(itemActionDelaySize.y/2)-2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
- }
- }
- }
+ let backgroundColour = toColour(0, 0, 0, 255);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2)-1, itemActionDelayPosition.y-(itemActionDelaySize.y/2)-1], [itemActionDelaySize.x+2, itemActionDelaySize.y+2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2), itemActionDelayPosition.y-(itemActionDelaySize.y/2)-2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
+ }
+ }
+ }
}
// ===========================================================================
function updatePlayerHotBar(activeSlot, itemsArray) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
+ logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
}
// ===========================================================================
function showItemActionDelay(duration) {
- itemActionDelayDuration = duration;
- itemActionDelayStart = sdl.ticks;
- itemActionDelayEnabled = true;
- logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
+ itemActionDelayDuration = duration;
+ itemActionDelayStart = sdl.ticks;
+ itemActionDelayEnabled = true;
+ logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/job.js b/scripts/client/job.js
index 022e9862..ce5575da 100644
--- a/scripts/client/job.js
+++ b/scripts/client/job.js
@@ -15,15 +15,15 @@ let jobRouteLocationSphere = null;
// ===========================================================================
class JobData {
- constructor(jobId, name, position, blipModel, pickupModel) {
- this.index = -1;
- this.jobId = jobId;
- this.name = name;
- this.position = position;
- this.blipModel = blipModel;
- this.pickupModel = pickupModel;
- this.blipId = -1;
- }
+ constructor(jobId, name, position, blipModel, pickupModel) {
+ this.index = -1;
+ this.jobId = jobId;
+ this.name = name;
+ this.position = position;
+ this.blipModel = blipModel;
+ this.pickupModel = pickupModel;
+ this.blipId = -1;
+ }
}
// ===========================================================================
@@ -36,136 +36,136 @@ function initJobScript() {
// ===========================================================================
function setLocalPlayerJobType(tempJobType) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
- localPlayerJobType = tempJobType;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
+ localPlayerJobType = tempJobType;
}
// ===========================================================================
function setLocalPlayerWorkingState(tempWorking) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
- localPlayerWorking = tempWorking;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
+ localPlayerWorking = tempWorking;
}
// ===========================================================================
function showJobRouteLocation(position, colour) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- if(game.game == VRR_GAME_GTA_SA) {
- jobRouteLocationSphere = game.createPickup(1318, position, 1);
- } else {
- jobRouteLocationSphere = game.createSphere(position, 3);
- jobRouteLocationSphere.colour = colour;
- }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ if(game.game == VRR_GAME_GTA_SA) {
+ jobRouteLocationSphere = game.createPickup(1318, position, 1);
+ } else {
+ jobRouteLocationSphere = game.createSphere(position, 3);
+ jobRouteLocationSphere.colour = colour;
+ }
- if(jobRouteLocationBlip != null) {
- destroyElement(jobRouteLocationBlip);
- }
+ if(jobRouteLocationBlip != null) {
+ destroyElement(jobRouteLocationBlip);
+ }
- blinkJobRouteLocationBlip(10, position, colour);
- }
+ blinkJobRouteLocationBlip(10, position, colour);
+ }
}
// ===========================================================================
function enteredJobRouteSphere() {
- logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
- tellServerPlayerArrivedAtJobRouteLocation();
- destroyElement(jobRouteLocationSphere);
- destroyElement(jobRouteLocationBlip);
- jobRouteLocationSphere = null;
- jobRouteLocationBlip = null;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
+ tellServerPlayerArrivedAtJobRouteLocation();
+ destroyElement(jobRouteLocationSphere);
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationSphere = null;
+ jobRouteLocationBlip = null;
}
// ===========================================================================
function blinkJobRouteLocationBlip(times, position, colour) {
- for(let i = 1 ; i <= times ; i++) {
- setTimeout(function() {
- if(jobRouteLocationBlip != null) {
- destroyElement(jobRouteLocationBlip);
- jobRouteLocationBlip = null;
- } else {
- jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
- }
- }, 500*i);
- }
+ for(let i = 1 ; i <= times ; i++) {
+ setTimeout(function() {
+ if(jobRouteLocationBlip != null) {
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationBlip = null;
+ } else {
+ jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
+ }
+ }, 500*i);
+ }
- setTimeout(function() {
- jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
- }, 500*times+1);
+ setTimeout(function() {
+ jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
+ }, 500*times+1);
}
// ===========================================================================
function hideJobRouteLocation() {
- destroyElement(jobRouteLocationSphere);
- destroyElement(jobRouteLocationBlip);
- jobRouteLocationSphere = null;
- jobRouteLocationBlip = null;
+ destroyElement(jobRouteLocationSphere);
+ destroyElement(jobRouteLocationBlip);
+ jobRouteLocationSphere = null;
+ jobRouteLocationBlip = null;
}
// ===========================================================================
function receiveJobFromServer(jobId, name, position, blipModel, pickupModel) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
-
- if(getGame() == VRR_GAME_GTA_IV) {
- if(getJobData(jobId) != false) {
- let jobData = getJobData(jobId);
- jobData.name = name;
- jobData.position = position;
- jobData.blipModel = blipModel;
- jobData.pickupModel = pickupModel;
+ logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
- if(blipModel == -1) {
- if(jobData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been removed by the server`);
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
- } else {
- destroyElement(getElementFromId(blipId));
- }
- jobData.blipId = -1;
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
- }
- } else {
- if(jobData.blipId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been changed by the server`);
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.setBlipCoordinates(jobData.blipId, jobData.position);
- natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
- natives.setBlipMarkerLongDistance(jobData.blipId, false);
- natives.setBlipAsShortRange(jobData.blipId, true);
- natives.changeBlipNameFromAscii(jobData.blipId, `${jobData.name.substr(0, 24)}${(jobData.name.length > 24) ? " ...": ""}`);
- }
- } else {
- let blipId = createGameBlip(jobData.blipModel, jobData.position, jobData.name);
- if(blipId != -1) {
- jobData.blipId = blipId;
- }
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- }
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} doesn't exist. Adding ...`);
- let tempJobData = new JobData(jobId, name, position, blipModel, pickupModel);
- if(blipModel != -1) {
- let blipId = createGameBlip(tempJobData.blipModel, tempJobData.position, tempJobData.name);
- if(blipId != -1) {
- tempJobData.blipId = blipId;
- }
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} has no blip.`);
- }
- jobs.push(tempJobData);
- setAllJobDataIndexes();
- }
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(getJobData(jobId) != false) {
+ let jobData = getJobData(jobId);
+ jobData.name = name;
+ jobData.position = position;
+ jobData.blipModel = blipModel;
+ jobData.pickupModel = pickupModel;
+
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
+ if(blipModel == -1) {
+ if(jobData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been removed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
+ } else {
+ destroyElement(getElementFromId(blipId));
+ }
+ jobData.blipId = -1;
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
+ }
+ } else {
+ if(jobData.blipId != -1) {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been changed by the server`);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setBlipCoordinates(jobData.blipId, jobData.position);
+ natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
+ natives.setBlipMarkerLongDistance(jobData.blipId, false);
+ natives.setBlipAsShortRange(jobData.blipId, true);
+ natives.changeBlipNameFromAscii(jobData.blipId, `${jobData.name.substr(0, 24)}${(jobData.name.length > 24) ? " ...": ""}`);
+ }
+ } else {
+ let blipId = createGameBlip(jobData.blipModel, jobData.position, jobData.name);
+ if(blipId != -1) {
+ jobData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ }
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} doesn't exist. Adding ...`);
+ let tempJobData = new JobData(jobId, name, position, blipModel, pickupModel);
+ if(blipModel != -1) {
+ let blipId = createGameBlip(tempJobData.blipModel, tempJobData.position, tempJobData.name);
+ if(blipId != -1) {
+ tempJobData.blipId = blipId;
+ }
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} has no blip.`);
+ }
+ jobs.push(tempJobData);
+ setAllJobDataIndexes();
+ }
+ }
}
// ===========================================================================
@@ -175,21 +175,21 @@ function receiveJobFromServer(jobId, name, position, blipModel, pickupModel) {
* @return {JobData} The job's data (class instance)
*/
function getJobData(jobId) {
- for(let i in jobs) {
- if(jobs[i].jobId == jobId) {
- return jobs[i];
- }
- }
+ for(let i in jobs) {
+ if(jobs[i].jobId == jobId) {
+ return jobs[i];
+ }
+ }
- return false;
+ return false;
}
// ===========================================================================
function setAllJobDataIndexes() {
- for(let i in jobs) {
- jobs[i].index = i;
- }
+ for(let i in jobs) {
+ jobs[i].index = i;
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/jsconfig.json b/scripts/client/jsconfig.json
index a5e369f2..f8c14e94 100644
--- a/scripts/client/jsconfig.json
+++ b/scripts/client/jsconfig.json
@@ -1,14 +1,14 @@
{
"compilerOptions": {
- "module": "commonjs",
- "target": "es6",
- "moduleResolution": "classic"
+ "module": "commonjs",
+ "target": "es6",
+ "moduleResolution": "classic"
},
"include": [
- "*.js",
- "gui/*.js",
- "native/*.js",
- "../shared/*.js",
- "../third-party/mexui/*"
+ "*.js",
+ "gui/*.js",
+ "native/*.js",
+ "../shared/*.js",
+ "../third-party/mexui/*"
]
}
\ No newline at end of file
diff --git a/scripts/client/keybind.js b/scripts/client/keybind.js
index 4c8c2d9c..ecc4bcb8 100644
--- a/scripts/client/keybind.js
+++ b/scripts/client/keybind.js
@@ -23,71 +23,71 @@ function initKeyBindScript() {
// ===========================================================================
function bindAccountKey(key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
- keyBinds.push(toInteger(key));
- bindKey(toInteger(key), keyState, function(event) {
- if(isAnyGUIActive()) {
- return false;
- }
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ keyBinds.push(toInteger(key));
+ bindKey(toInteger(key), keyState, function(event) {
+ if(isAnyGUIActive()) {
+ return false;
+ }
- if(hasKeyBindDelayElapsed()) {
- if(canLocalPlayerUseKeyBinds()) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
- lastKeyBindUse = sdl.ticks;
- tellServerPlayerUsedKeyBind(key);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
- }
- });
+ if(hasKeyBindDelayElapsed()) {
+ if(canLocalPlayerUseKeyBinds()) {
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ lastKeyBindUse = sdl.ticks;
+ tellServerPlayerUsedKeyBind(key);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
+ }
+ });
}
// ===========================================================================
function unBindAccountKey(key) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
- unbindKey(key);
- keyBinds.splice(keyBinds.indexOf(key), 1);
- return true;
+ logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ unbindKey(key);
+ keyBinds.splice(keyBinds.indexOf(key), 1);
+ return true;
}
// ===========================================================================
function hasKeyBindDelayElapsed() {
- if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
- return true;
- }
+ if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function canLocalPlayerUseKeyBinds() {
- if(isAnyGUIActive()) {
- return false;
- }
+ if(isAnyGUIActive()) {
+ return false;
+ }
- if(!isSpawned) {
- return false;
- }
+ if(!isSpawned) {
+ return false;
+ }
- if(itemActionDelayEnabled) {
- return false;
- }
+ if(itemActionDelayEnabled) {
+ return false;
+ }
- return true;
+ return true;
}
// ===========================================================================
function clearKeyBinds() {
- for(let i in keyBinds) {
- unbindKey(keyBinds[i]);
- }
- keyBinds = [];
+ for(let i in keyBinds) {
+ unbindKey(keyBinds[i]);
+ }
+ keyBinds = [];
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/label.js b/scripts/client/label.js
index 973bf20f..428fda7a 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -42,280 +42,280 @@ function initLabelScript() {
// ===========================================================================
function initLabelPropertyNameFont() {
- return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
+ return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
}
// ===========================================================================
function initLabelPropertyLockedFont() {
- return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
+ return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
}
// ===========================================================================
function initLabelJobNameFont() {
- return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
+ return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
}
// ===========================================================================
function initLabelJobHelpFont() {
- return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
+ return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
}
// ===========================================================================
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
if(propertyLabelNameFont == null) {
return false;
- }
+ }
if(propertyLabelLockedFont == null) {
return false;
- }
+ }
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
- let screenPosition = getScreenFromWorldPosition(tempPosition);
+ let tempPosition = position;
+ tempPosition.z = tempPosition.z + propertyLabelHeight;
+ let screenPosition = getScreenFromWorldPosition(tempPosition);
- if(screenPosition.x < 0 || screenPosition.x > game.width) {
- return false;
- }
+ if(screenPosition.x < 0 || screenPosition.x > game.width) {
+ return false;
+ }
- let text = "";
- if(price > "0") {
- text = `For sale: $${price}`;
- let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
+ let text = "";
+ if(price > "0") {
+ text = `For sale: $${price}`;
+ let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
- screenPosition.y -= propertyLabelPriceOffset;
- }
+ screenPosition.y -= propertyLabelPriceOffset;
+ }
- text = "";
- if(rentPrice != "0") {
- text = `For rent: $${rentPrice} every payday`;
- let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
+ text = "";
+ if(rentPrice != "0") {
+ text = `For rent: $${rentPrice} every payday`;
+ let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
- screenPosition.y -= propertyLabelPriceOffset;
- }
+ screenPosition.y -= propertyLabelPriceOffset;
+ }
- if(isBusiness) {
- text = (locked) ? "CLOSED" : "OPEN";
- } else {
- text = (locked) ? "LOCKED" : "UNLOCKED";
- }
+ if(isBusiness) {
+ text = (locked) ? "CLOSED" : "OPEN";
+ } else {
+ text = (locked) ? "LOCKED" : "UNLOCKED";
+ }
- if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
- let infoText = "";
- switch(labelInfoType) {
- case VRR_PROPLABEL_INFO_ENTER:
- if(enterPropertyKey) {
- infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
- } else {
- infoText = `Use /enter to enter`;
- }
- break;
+ if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
+ let infoText = "";
+ switch(labelInfoType) {
+ case VRR_PROPLABEL_INFO_ENTER:
+ if(enterPropertyKey) {
+ infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
+ } else {
+ infoText = `Use /enter to enter`;
+ }
+ break;
- case VRR_PROPLABEL_INFO_BUY:
- infoText = `Use /buy to purchase items`;
- break;
+ case VRR_PROPLABEL_INFO_BUY:
+ infoText = `Use /buy to purchase items`;
+ break;
- case VRR_PROPLABEL_INFO_BUYBIZ:
- infoText = `Use /buy to purchase items`;
- break;
+ case VRR_PROPLABEL_INFO_BUYBIZ:
+ infoText = `Use /buy to purchase items`;
+ break;
- //case VRR_PROPLABEL_INFO_RENTBIZ:
- // infoText = `Use /bizrent to buy this business`;
- // break;
+ //case VRR_PROPLABEL_INFO_RENTBIZ:
+ // infoText = `Use /bizrent to buy this business`;
+ // break;
- case VRR_PROPLABEL_INFO_BUYHOUSE:
- infoText = `Use /housebuy to buy this house`;
- break;
+ case VRR_PROPLABEL_INFO_BUYHOUSE:
+ infoText = `Use /housebuy to buy this house`;
+ break;
- case VRR_PROPLABEL_INFO_RENTHOUSE:
- infoText = `Use /houserent to rent this house`;
- break;
+ case VRR_PROPLABEL_INFO_RENTHOUSE:
+ infoText = `Use /houserent to rent this house`;
+ break;
- case VRR_PROPLABEL_INFO_ENTERVEH:
- infoText = "Enter a vehicle in the parking lot to buy it";
- break;
+ case VRR_PROPLABEL_INFO_ENTERVEH:
+ infoText = "Enter a vehicle in the parking lot to buy it";
+ break;
- case VRR_PROPLABEL_INFO_NONE:
- default:
- infoText = "";
- break;
- }
- if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
- let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
- screenPosition.y -= propertyLabelLockedOffset;
- }
- }
+ case VRR_PROPLABEL_INFO_NONE:
+ default:
+ infoText = "";
+ break;
+ }
+ if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
+ let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
+ screenPosition.y -= propertyLabelLockedOffset;
+ }
+ }
- let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
- propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
+ let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
+ propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
- screenPosition.y -= propertyLabelNameOffset;
+ screenPosition.y -= propertyLabelNameOffset;
- text = name || " ";
- size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
- propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
+ text = name || " ";
+ size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
+ propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
}
// -------------------------------------------------------------------------
function renderPropertyExitLabel(position) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
if(propertyLabelNameFont == null) {
return false;
- }
+ }
if(propertyLabelLockedFont == null) {
return false;
}
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
- let screenPosition = getScreenFromWorldPosition(tempPosition);
+ let tempPosition = position;
+ tempPosition.z = tempPosition.z + propertyLabelHeight;
+ let screenPosition = getScreenFromWorldPosition(tempPosition);
- if(screenPosition.x < 0 || screenPosition.x > game.width) {
- return false;
- }
+ if(screenPosition.x < 0 || screenPosition.x > game.width) {
+ return false;
+ }
- let text = "EXIT";
- let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
- propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
+ let text = "EXIT";
+ let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
+ propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
}
// -------------------------------------------------------------------------
function renderJobLabel(name, position, jobType) {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
if(jobNameLabelFont == null) {
return false;
- }
+ }
if(jobHelpLabelFont == null) {
return false;
}
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
- let screenPosition = getScreenFromWorldPosition(tempPosition);
+ let tempPosition = position;
+ tempPosition.z = tempPosition.z + propertyLabelHeight;
+ let screenPosition = getScreenFromWorldPosition(tempPosition);
- if(screenPosition.x < 0 || screenPosition.x > game.width) {
- return false;
- }
+ if(screenPosition.x < 0 || screenPosition.x > game.width) {
+ return false;
+ }
- let text = "";
- if(jobType == localPlayerJobType) {
- if(localPlayerWorking) {
- text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
- } else {
- text = "Use /startwork to go on duty";
- }
- } else {
- if(localPlayerJobType == 0) {
- text = "Use /takejob to work here";
- } else {
- text = "You already have a job. Use /quitjob if you want this one";
- }
- }
+ let text = "";
+ if(jobType == localPlayerJobType) {
+ if(localPlayerWorking) {
+ text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
+ } else {
+ text = "Use /startwork to go on duty";
+ }
+ } else {
+ if(localPlayerJobType == 0) {
+ text = "Use /takejob to work here";
+ } else {
+ text = "You already have a job. Use /quitjob if you want this one";
+ }
+ }
- let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
- jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
+ let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
+ jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
- screenPosition.y -= 18;
+ screenPosition.y -= 18;
- text = name + " Job";
- size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
- jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
+ text = name + " Job";
+ size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
+ jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
}
// -------------------------------------------------------------------------
function processLabelRendering() {
- if(renderLabels) {
- if(!areServerElementsSupported()) {
- if(localPlayer != null) {
- for(let i in businesses) {
- if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(businesses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
- }
- }
+ if(renderLabels) {
+ if(!areServerElementsSupported()) {
+ if(localPlayer != null) {
+ for(let i in businesses) {
+ if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(businesses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
+ }
+ }
- for(let i in houses) {
- if(getDistance(localPlayer.position, houses[i].entrancePosition) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(houses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
- }
- }
-
- for(let i in jobs) {
- if(getDistance(localPlayer.position, jobs[i].position) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(jobs[i].position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
- }
- }
- }
- }
-
- if(areWorldLabelsSupported()) {
- if(localPlayer != null) {
- let pickups = getElementsByType(ELEMENT_PICKUP);
- for(let i in pickups) {
- if(pickups[i].getData("vrr.label.type") != null) {
- if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
- if(!pickups[i].isOnScreen) {
- let price = "0";
- let rentPrice = "0";
- let labelInfoType = VRR_PROPLABEL_INFO_NONE;
- if(pickups[i].getData("vrr.label.price") != null) {
- price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
- }
-
- if(pickups[i].getData("vrr.label.rentprice") != null) {
- rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
- }
-
- if(pickups[i].getData("vrr.label.help") != null) {
- labelInfoType = pickups[i].getData("vrr.label.help");
- }
-
- switch(pickups[i].getData("vrr.label.type")) {
- case VRR_LABEL_BUSINESS:
- renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
- break;
-
- case VRR_LABEL_HOUSE:
- renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
- break;
-
- case VRR_LABEL_JOB:
- renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
- break;
-
- case VRR_LABEL_EXIT:
- renderPropertyExitLabel(pickups[i].position);
- break;
- }
- }
- }
- }
- }
- }
- }
- }
+ for(let i in houses) {
+ if(getDistance(localPlayer.position, houses[i].entrancePosition) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(houses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
+ }
+ }
+
+ for(let i in jobs) {
+ if(getDistance(localPlayer.position, jobs[i].position) <= 75.0) {
+ natives.drawColouredCylinder(getPosBelowPos(jobs[i].position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
+ }
+ }
+ }
+ }
+
+ if(areWorldLabelsSupported()) {
+ if(localPlayer != null) {
+ let pickups = getElementsByType(ELEMENT_PICKUP);
+ for(let i in pickups) {
+ if(pickups[i].getData("vrr.label.type") != null) {
+ if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
+ if(!pickups[i].isOnScreen) {
+ let price = "0";
+ let rentPrice = "0";
+ let labelInfoType = VRR_PROPLABEL_INFO_NONE;
+ if(pickups[i].getData("vrr.label.price") != null) {
+ price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
+ }
+
+ if(pickups[i].getData("vrr.label.rentprice") != null) {
+ rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
+ }
+
+ if(pickups[i].getData("vrr.label.help") != null) {
+ labelInfoType = pickups[i].getData("vrr.label.help");
+ }
+
+ switch(pickups[i].getData("vrr.label.type")) {
+ case VRR_LABEL_BUSINESS:
+ renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
+ break;
+
+ case VRR_LABEL_HOUSE:
+ renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
+ break;
+
+ case VRR_LABEL_JOB:
+ renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
+ break;
+
+ case VRR_LABEL_EXIT:
+ renderPropertyExitLabel(pickups[i].position);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
// -------------------------------------------------------------------------
\ No newline at end of file
diff --git a/scripts/client/logo.js b/scripts/client/logo.js
index 286e38e1..9a23f20b 100644
--- a/scripts/client/logo.js
+++ b/scripts/client/logo.js
@@ -15,38 +15,38 @@ let logoSize = toVector2(128, 128);
function initLogoScript() {
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
- //logoImage = loadLogoImage();
+ //logoImage = loadLogoImage();
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
}
// ===========================================================================
function loadLogoImage() {
- let logoStream = openFile(mainLogoPath);
- let tempLogoImage = null;
- if(logoStream != null) {
- tempLogoImage = graphics.loadPNG(logoStream);
- logoStream.close();
- }
+ let logoStream = openFile(mainLogoPath);
+ let tempLogoImage = null;
+ if(logoStream != null) {
+ tempLogoImage = graphics.loadPNG(logoStream);
+ logoStream.close();
+ }
- return tempLogoImage;
+ return tempLogoImage;
}
// ===========================================================================
function processLogoRendering() {
- if(renderLogo) {
- if(logoImage != null) {
- graphics.drawRectangle(logoImage, logoPos, logoSize);
- }
- }
+ if(renderLogo) {
+ if(logoImage != null) {
+ graphics.drawRectangle(logoImage, logoPos, logoSize);
+ }
+ }
}
// ===========================================================================
function setServerLogoRenderState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
- renderLogo = state;
+ logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
+ renderLogo = state;
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/messaging.js b/scripts/client/messaging.js
index a2c97cfd..11c17b71 100644
--- a/scripts/client/messaging.js
+++ b/scripts/client/messaging.js
@@ -16,64 +16,64 @@ let smallGameMessageTimer = null;
function initMessagingScript() {
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Initializing messaging script ...");
- smallGameMessageFont = loadSmallGameMessageFont();
+ smallGameMessageFont = loadSmallGameMessageFont();
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Messaging script initialized!");
}
// ===========================================================================
function loadSmallGameMessageFont() {
- let tempSmallGameMessageFont = null;
- let fontStream = openFile("files/fonts/pricedown.ttf");
- if(fontStream != null) {
- tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
- fontStream.close();
- }
+ let tempSmallGameMessageFont = null;
+ let fontStream = openFile("files/fonts/pricedown.ttf");
+ if(fontStream != null) {
+ tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
+ fontStream.close();
+ }
- return tempSmallGameMessageFont;
+ return tempSmallGameMessageFont;
}
// ===========================================================================
function loadBigGameMessageFont() {
- let tempBigGameMessageFont = null;
- let fontStream = openFile("files/fonts/pricedown.ttf");
- if(fontStream != null) {
- tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
- fontStream.close();
- }
+ let tempBigGameMessageFont = null;
+ let fontStream = openFile("files/fonts/pricedown.ttf");
+ if(fontStream != null) {
+ tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
+ fontStream.close();
+ }
- return tempBigGameMessageFont;
+ return tempBigGameMessageFont;
}
// ===========================================================================
function processSmallGameMessageRendering() {
- if(renderSmallGameMessage) {
- if(smallGameMessageFont != null) {
- if(smallGameMessageFont != "") {
- smallGameMessageFont.render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
- }
- }
- }
+ if(renderSmallGameMessage) {
+ if(smallGameMessageFont != null) {
+ if(smallGameMessageFont != "") {
+ smallGameMessageFont.render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
+ }
+ }
+ }
}
// ===========================================================================
function showSmallGameMessage(text, colour, duration) {
- logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
- if(smallGameMessageText != "") {
- clearTimeout(smallGameMessageTimer);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
+ if(smallGameMessageText != "") {
+ clearTimeout(smallGameMessageTimer);
+ }
- smallGameMessageColour = colour;
- smallGameMessageText = text;
+ smallGameMessageColour = colour;
+ smallGameMessageText = text;
- smallGameMessageTimer = setTimeout(function() {
- smallGameMessageText = "";
- smallGameMessageColour = COLOUR_WHITE;
- smallGameMessageTimer = null;
- }, duration);
+ smallGameMessageTimer = setTimeout(function() {
+ smallGameMessageText = "";
+ smallGameMessageColour = COLOUR_WHITE;
+ smallGameMessageTimer = null;
+ }, duration);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/mousecam.js b/scripts/client/mousecam.js
index cd4bfd7b..edb85550 100644
--- a/scripts/client/mousecam.js
+++ b/scripts/client/mousecam.js
@@ -632,10 +632,10 @@ function update()
addEventHandler("OnCameraProcess", (event) =>
{
- if(mouseCameraEnabled) {
- update();
- event.preventDefault();
- }
+ if(mouseCameraEnabled) {
+ update();
+ event.preventDefault();
+ }
});
function toggleMouseCamera() {
diff --git a/scripts/client/nametag.js b/scripts/client/nametag.js
index 7009f884..757683b2 100644
--- a/scripts/client/nametag.js
+++ b/scripts/client/nametag.js
@@ -74,11 +74,11 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
alpha *= 0.75;
let width = nametagWidth;
health = Math.max(0.0, Math.min(1.0, health));
- armour = Math.max(0.0, Math.min(1.0, armour));
+ armour = Math.max(0.0, Math.min(1.0, armour));
- // Starts at bottom and works it's way up
- // -------------------------------------------
- // Health Bar
+ // Starts at bottom and works it's way up
+ // -------------------------------------------
+ // Health Bar
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
if(game.game == VRR_GAME_GTA_III) {
@@ -104,7 +104,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
}
- // Armour Bar
+ // Armour Bar
if (armour > 0.0)
{
// Go up 10 pixels to draw the next part
@@ -119,16 +119,16 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
y -= 20;
- // Nametag
+ // Nametag
if(nametagFont != null) {
let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false);
nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true);
}
- // Go up another 10 pixels for the next part
- y -= 20;
+ // Go up another 10 pixels for the next part
+ y -= 20;
- // AFK Status
+ // AFK Status
if(afkStatusFont != null) {
if(afk) {
let size = afkStatusFont.measure("PAUSED", game.width, 0.0, 0.0, afkStatusFont.size, false, false);
@@ -147,7 +147,7 @@ function updateNametags(element) {
if(localPlayer != null) {
let playerPos = localPlayer.position;
let elementPos = element.position;
- let client = getClientFromPlayerElement(element);
+ let client = getClientFromPlayerElement(element);
elementPos[2] += 0.9;
@@ -173,26 +173,26 @@ function updateNametags(element) {
}
if(element.type == ELEMENT_PLAYER) {
- let name = element.name;
- let colour = COLOUR_WHITE;
+ let name = element.name;
+ let colour = COLOUR_WHITE;
let paused = false;
let ping = -1;
- if(typeof playerNames[element.name] != "undefined") {
- name = playerNames[element.name];
- }
-
- if(typeof playerPaused[element.name] != "undefined") {
- paused = playerPaused[element.name];
- }
-
- if(typeof playerColours[element.name] != "undefined") {
- colour = playerColours[element.name];
+ if(typeof playerNames[element.name] != "undefined") {
+ name = playerNames[element.name];
}
- if(typeof playerPing[element.name] != "undefined") {
- ping = playerPing[element.name];
- }
+ if(typeof playerPaused[element.name] != "undefined") {
+ paused = playerPaused[element.name];
+ }
+
+ if(typeof playerColours[element.name] != "undefined") {
+ colour = playerColours[element.name];
+ }
+
+ if(typeof playerPing[element.name] != "undefined") {
+ ping = playerPing[element.name];
+ }
drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin);
}
diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js
index 72054b5f..358735f3 100644
--- a/scripts/client/native/connected.js
+++ b/scripts/client/native/connected.js
@@ -8,13 +8,13 @@
// ===========================================================================
function sendNetworkEventToPlayer(networkEvent, client, ...args) {
- triggerNetworkEvent.apply(null, networkEvent, client, args);
+ triggerNetworkEvent.apply(null, networkEvent, client, args);
}
// ===========================================================================
function getPlayerPosition() {
- return localPlayer.position;
+ return localPlayer.position;
}
// ===========================================================================
@@ -30,39 +30,39 @@ function setPlayerPosition(position) {
// ===========================================================================
function getElementPosition(element) {
- return element.position;
+ return element.position;
}
// ===========================================================================
function setElementPosition(element, position) {
- if(!element.isSyncer) {
- return false;
- }
+ if(!element.isSyncer) {
+ return false;
+ }
- element.position = position;
+ element.position = position;
}
// ===========================================================================
function deleteGameElement(element, position) {
- if(!element.isOwner) {
- return false;
- }
+ if(!element.isOwner) {
+ return false;
+ }
- destroyGameElement(element);
+ destroyGameElement(element);
}
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
- return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
+ return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
}
// ===========================================================================
function addNetworkEventHandler(eventName, handlerFunction) {
- addNetworkHandler(eventName, handlerFunction);
+ addNetworkHandler(eventName, handlerFunction);
}
// ===========================================================================
@@ -156,7 +156,7 @@ function createGameBlip(blipModel, position, name = "") {
natives.setBlipAsShortRange(blipId, true);
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
return blipId;
- }
+ }
}
return -1;
diff --git a/scripts/client/radio.js b/scripts/client/radio.js
index 2608e834..a9ea993d 100644
--- a/scripts/client/radio.js
+++ b/scripts/client/radio.js
@@ -8,39 +8,39 @@
// ===========================================================================
function playStreamingRadio(url, loop, volume, element = false) {
- if(streamingRadio != null) {
- streamingRadio.stop();
- }
+ if(streamingRadio != null) {
+ streamingRadio.stop();
+ }
- streamingRadioVolume = volume;
+ streamingRadioVolume = volume;
- streamingRadio = audio.createSoundFromURL(url, loop);
- streamingRadio.volume = volume/100;
- streamingRadio.play();
+ streamingRadio = audio.createSoundFromURL(url, loop);
+ streamingRadio.volume = volume/100;
+ streamingRadio.play();
}
// ===========================================================================
function stopStreamingRadio() {
- if(streamingRadio != null) {
- streamingRadio.stop();
- }
- streamingRadio = null;
+ if(streamingRadio != null) {
+ streamingRadio.stop();
+ }
+ streamingRadio = null;
}
// ===========================================================================
function setStreamingRadioVolume(volume) {
- if(streamingRadio != null) {
- streamingRadioVolume = volume;
- streamingRadio.volume = volume/100;
- }
+ if(streamingRadio != null) {
+ streamingRadioVolume = volume;
+ streamingRadio.volume = volume/100;
+ }
}
// ===========================================================================
function playAudioFile(audioName, loop, volume) {
- playCustomAudio(audioName, volume/100, loop);
+ playCustomAudio(audioName, volume/100, loop);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/scoreboard.js b/scripts/client/scoreboard.js
index 5007d78b..04dd9630 100644
--- a/scripts/client/scoreboard.js
+++ b/scripts/client/scoreboard.js
@@ -43,7 +43,7 @@ function processScoreBoardRendering() {
}
if(renderScoreBoard) {
- if(isKeyDown(SDLK_TAB)) {
+ if(isKeyDown(SDLK_TAB)) {
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
let titleSize = scoreBoardTitleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
diff --git a/scripts/client/server.js b/scripts/client/server.js
index 8ca4741d..5dc99b72 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -8,198 +8,186 @@
// ===========================================================================
function initServerScript() {
- logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
- addAllNetworkHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
+ addAllNetworkHandlers();
+ logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
}
// ===========================================================================
function addAllNetworkHandlers() {
- logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
+ logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
- addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
- addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
- addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
- addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
-
- addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
- addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
- addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
- addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
- addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
- addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
- addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
- addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
- addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
- addNetworkEventHandler("vrr.runCode", runClientCode);
- addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
- addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
- addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
- addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
- addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
- addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
- addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
- addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
- addNetworkEventHandler("vrr.snow", setSnowState);
- addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
- addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
- addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
- addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
- addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
- addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
- addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
- addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
- addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
- addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
- addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
- addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
- addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
- addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
- addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
- addNetworkEventHandler("vrr.money", setLocalPlayerCash);
- addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
- addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
-
- addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
- addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
- addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
-
- addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
- addNetworkEventHandler("vrr.ping", updatePlayerPing);
-
- addNetworkEventHandler("vrr.m", receiveChatBoxMessageFromServer);
- addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
-
- addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
- addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
- addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
- addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
-
- addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
- addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
- addNetworkEventHandler("vrr.veh.repair", repairVehicle);
-
- addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
- addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
- addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
- addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
- addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
- addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
- addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
- addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior);
-
- addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
- addNetworkEventHandler("vrr.elementPosition", setElementPosition);
- addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
-
- addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
-
- addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
- addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
- addNetworkEventHandler("vrr.showLogin", showLoginGUI);
-
- addNetworkEventHandler("vrr.logLevel", setLogLevel);
- addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
-
- addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
- addNetworkEventHandler("vrr.house", receiveHouseFromServer);
-
- addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
-
- addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
-
- addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps);
+ addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
+ addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
+ addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
+ addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
+ addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
+ addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
+ addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
+ addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
+ addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
+ addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
+ addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
+ addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
+ addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
+ addNetworkEventHandler("vrr.runCode", runClientCode);
+ addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
+ addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
+ addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
+ addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
+ addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
+ addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
+ addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
+ addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
+ addNetworkEventHandler("vrr.snow", setSnowState);
+ addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
+ addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
+ addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
+ addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
+ addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
+ addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
+ addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
+ addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
+ addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
+ addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
+ addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
+ addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
+ addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
+ addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
+ addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
+ addNetworkEventHandler("vrr.money", setLocalPlayerCash);
+ addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
+ addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
+ addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
+ addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
+ addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
+ addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
+ addNetworkEventHandler("vrr.ping", updatePlayerPing);
+ addNetworkEventHandler("vrr.m", receiveChatBoxMessageFromServer);
+ addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
+ addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
+ addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
+ addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
+ addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
+ addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
+ addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
+ addNetworkEventHandler("vrr.veh.repair", repairVehicle);
+ addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
+ addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
+ addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
+ addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
+ addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
+ addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
+ addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
+ addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior);
+ addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
+ addNetworkEventHandler("vrr.elementPosition", setElementPosition);
+ addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
+ addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
+ addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
+ addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
+ addNetworkEventHandler("vrr.showLogin", showLoginGUI);
+ addNetworkEventHandler("vrr.logLevel", setLogLevel);
+ addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
+ addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
+ addNetworkEventHandler("vrr.house", receiveHouseFromServer);
+ addNetworkEventHandler("vrr.job", receiveJobFromServer);
+ addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer);
+ addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
+ addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
+ addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps);
+ addNetworkEventHandler("vrr.pedSpeak", makePlayerPedSpeak);
}
// ===========================================================================
function sendResourceReadySignalToServer() {
- sendNetworkEventToServer("vrr.clientReady");
+ sendNetworkEventToServer("vrr.clientReady");
}
// ===========================================================================
function sendResourceStartedSignalToServer() {
- sendNetworkEventToServer("vrr.clientStarted");
+ sendNetworkEventToServer("vrr.clientStarted");
}
// ===========================================================================
function sendResourceStoppedSignalToServer() {
- if(isConnected) {
- sendNetworkEventToServer("vrr.clientStopped");
- }
+ if(isConnected) {
+ sendNetworkEventToServer("vrr.clientStopped");
+ }
}
// ===========================================================================
function setPlayer2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
- renderHUD = hudState;
+ logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
+ renderHUD = hudState;
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.displayCash(hudState);
- natives.displayAmmo(hudState);
- natives.displayHud(hudState);
- natives.displayRadar(hudState);
- natives.displayAreaName(hudState);
- } else {
- if(typeof setHUDEnabled != "undefined") {
- setHUDEnabled(hudState);
- }
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.displayCash(hudState);
+ natives.displayAmmo(hudState);
+ natives.displayHud(hudState);
+ natives.displayRadar(hudState);
+ natives.displayAreaName(hudState);
+ } else {
+ if(typeof setHUDEnabled != "undefined") {
+ setHUDEnabled(hudState);
+ }
+ }
- renderLabels = labelState;
- renderSmallGameMessage = smallGameMessageState;
- renderScoreBoard = scoreboardState;
- renderHotBar = hotBarState;
- renderItemActionDelay = itemActionDelayState;
+ renderLabels = labelState;
+ renderSmallGameMessage = smallGameMessageState;
+ renderScoreBoard = scoreboardState;
+ renderHotBar = hotBarState;
+ renderItemActionDelay = itemActionDelayState;
}
// ===========================================================================
function onServerSpawnedPlayer(state) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
- isSpawned = state;
- if(state) {
- setUpInitialGame();
- calledDeathEvent = false;
- }
+ logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
+ isSpawned = state;
+ if(state) {
+ setUpInitialGame();
+ calledDeathEvent = false;
+ }
}
// ===========================================================================
function tellServerPlayerUsedKeyBind(key) {
- sendNetworkEventToServer("vrr.useKeyBind", key);
+ sendNetworkEventToServer("vrr.useKeyBind", key);
}
// ===========================================================================
function tellServerPlayerArrivedAtJobRouteLocation() {
- sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
+ sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
}
// ===========================================================================
function tellServerItemActionDelayComplete() {
- sendNetworkEventToServer("vrr.itemActionDelayComplete");
+ sendNetworkEventToServer("vrr.itemActionDelayComplete");
}
// ===========================================================================
function sendServerClientInfo() {
- let clientVersion = "0.0.0.0";
- if(typeof CLIENT_VERSION_MAJOR != "undefined") {
- clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
- }
- sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
+ let clientVersion = "0.0.0.0";
+ if(typeof CLIENT_VERSION_MAJOR != "undefined") {
+ clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
+ }
+ sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
}
// ===========================================================================
function sendServerNewAFKStatus(state) {
- sendNetworkEventToServer("vrr.afk", state);
+ sendNetworkEventToServer("vrr.afk", state);
}
// ===========================================================================
@@ -211,135 +199,144 @@ function anchorBoat(vehicleId) {
// ===========================================================================
function setEnterPropertyKey(key) {
- enterPropertyKey = key;
+ enterPropertyKey = key;
}
// ===========================================================================
function serverRequestedClientInfo() {
- sendServerClientInfo();
+ sendServerClientInfo();
}
// ===========================================================================
function updateInteriorLightsState(state) {
- interiorLightsEnabled = state;
+ interiorLightsEnabled = state;
}
// ===========================================================================
function forceSyncElementProperties(elementId) {
- if(getElementFromId(elementId) == null) {
- return false;
- }
+ if(getElementFromId(elementId) == null) {
+ return false;
+ }
- syncElementProperties(getElementFromId(elementId));
+ syncElementProperties(getElementFromId(elementId));
}
// ===========================================================================
function setElementPosition(elementId, position) {
- if(getElementFromId(elementId) == null) {
- return false;
- }
+ if(getElementFromId(elementId) == null) {
+ return false;
+ }
- if(!getElementFromId(elementId).isSyncer) {
- return false;
- }
+ if(!getElementFromId(elementId).isSyncer) {
+ return false;
+ }
- getElementFromId(elementId).position = position;
+ getElementFromId(elementId).position = position;
}
// ===========================================================================
function setElementCollisionsEnabled(elementId, state) {
- if(getElementFromId(elementId) == null) {
- return false;
- }
+ if(getElementFromId(elementId) == null) {
+ return false;
+ }
- getElementFromId(elementId).collisionsEnabled = state;
+ getElementFromId(elementId).collisionsEnabled = state;
}
// ===========================================================================
function setLocalPlayerArmour(armour) {
- if(typeof localPlayer.armour != "undefined") {
- localPlayer.armour = armour;
- }
+ if(typeof localPlayer.armour != "undefined") {
+ localPlayer.armour = armour;
+ }
}
// ===========================================================================
function forceLocalPlayerWantedLevel(wantedLevel) {
- forceWantedLevel = toInteger(wantedLevel);
+ forceWantedLevel = toInteger(wantedLevel);
}
// ===========================================================================
function setLogLevel(level) {
- logLevel = level;
+ logLevel = level;
}
// ===========================================================================
function setLocalPlayerInfiniteRun(state) {
- if(localPlayer != null) {
- if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
- game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
- }
- }
+ if(localPlayer != null) {
+ if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
+ game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
+ }
+ }
}
// ===========================================================================
function setLocalPlayerSkin(skinId) {
- logToConsole(LOG_INFO, skinId);
- if(getGame() == VRR_GAME_GTA_IV) {
- if(natives.isModelInCdimage(skinId)) {
- natives.requestModel(skinId);
- natives.loadAllObjectsNow();
- if(natives.hasModelLoaded(skinId)) {
- natives.changePlayerModel(natives.getPlayerId(), skinId);
- }
- }
-
- //natives.requestModel(skinId);
- //natives.changePlayerModel(natives.getPlayerId(), skinId);
-
- //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- //localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
- } else {
- localPlayer.skin = skinId;
- }
+ logToConsole(LOG_INFO, skinId);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = skinId;
+ }
}
// ===========================================================================
function makePedHoldObject(pedId, modelIndex) {
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
+ }
}
// ===========================================================================
function sendLocalPlayerNetworkIdToServer() {
- sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
+ sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
}
// ===========================================================================
function setCutsceneInterior(cutsceneName) {
- if(getGame() == VRR_GAME_GTA_IV) {
- if(cutsceneName == "") {
- natives.clearCutscene();
- } else {
- if(natives.isInteriorScene()) {
- natives.clearCutscene();
- }
- natives.initCutscene(cutsceneName);
- }
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(cutsceneName == "") {
+ natives.clearCutscene();
+ } else {
+ if(natives.isInteriorScene()) {
+ natives.clearCutscene();
+ }
+ natives.initCutscene(cutsceneName);
+ }
+ }
+}
+
+// ===========================================================================
+
+function makePlayerPedSpeak(speechName) {
+ if(getGame() == VRR_GAME_GTA_IV) {
+ // if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
+ // Only speeches with _MEGAPHONE will have the bullhorn effect
+ // Afaik it only works on police voices anyway
+ if(localPlayer.vehicle != null) {
+ natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
+ } else {
+ natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
+ }
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/skin-select.js b/scripts/client/skin-select.js
index abd8cc52..bc0fd1e9 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -45,111 +45,111 @@ function loadSkinSelectMessageFontBottom() {
function processSkinSelectKeyPress(keyCode) {
if(usingSkinSelector) {
- if(keyCode == SDLK_PAGEUP) {
- if(skinSelectorIndex >= allowedSkins.length-1) {
- skinSelectorIndex = 1;
- } else {
- skinSelectorIndex = skinSelectorIndex + 1;
- }
- logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
- skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
- if(getGame() == VRR_GAME_GTA_IV) {
- let skinId = allowedSkins[skinSelectorIndex][0];
- if(natives.isModelInCdimage(skinId)) {
- natives.requestModel(skinId);
- natives.loadAllObjectsNow();
- if(natives.hasModelLoaded(skinId)) {
- natives.changePlayerModel(natives.getPlayerId(), skinId);
- }
- }
- } else {
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- }
- } else if(keyCode == SDLK_PAGEDOWN) {
- if(skinSelectorIndex <= 0) {
- skinSelectorIndex = allowedSkins.length-1;
- } else {
- skinSelectorIndex = skinSelectorIndex - 1;
- }
- logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
- skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
- if(getGame() == VRR_GAME_GTA_IV) {
- let skinId = allowedSkins[skinSelectorIndex][0];
- if(natives.isModelInCdimage(skinId)) {
- natives.requestModel(skinId);
- natives.loadAllObjectsNow();
- if(natives.hasModelLoaded(skinId)) {
- natives.changePlayerModel(natives.getPlayerId(), skinId);
- }
- }
- } else {
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- }
- } else if(keyCode == SDLK_RETURN) {
- sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
- toggleSkinSelect(false);
- return true;
- } else if(keyCode == SDLK_BACKSPACE) {
- sendNetworkEventToServer("vrr.skinSelected", -1);
- toggleSkinSelect(false);
- return true;
- }
- localPlayer.heading = skinSelectHeading;
- }
+ if(keyCode == SDLK_PAGEUP) {
+ if(skinSelectorIndex >= allowedSkins.length-1) {
+ skinSelectorIndex = 1;
+ } else {
+ skinSelectorIndex = skinSelectorIndex + 1;
+ }
+ logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
+ skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ }
+ } else if(keyCode == SDLK_PAGEDOWN) {
+ if(skinSelectorIndex <= 0) {
+ skinSelectorIndex = allowedSkins.length-1;
+ } else {
+ skinSelectorIndex = skinSelectorIndex - 1;
+ }
+ logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
+ skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ }
+ } else if(keyCode == SDLK_RETURN) {
+ sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
+ toggleSkinSelect(false);
+ return true;
+ } else if(keyCode == SDLK_BACKSPACE) {
+ sendNetworkEventToServer("vrr.skinSelected", -1);
+ toggleSkinSelect(false);
+ return true;
+ }
+ localPlayer.heading = skinSelectHeading;
+ }
}
// ===========================================================================
function processSkinSelectRendering() {
if(usingSkinSelector) {
- if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
- if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
- skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
- skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
- }
- }
- }
+ if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
+ if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
+ skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
+ skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
+ }
+ }
+ }
}
// ===========================================================================
function toggleSkinSelect(state) {
- if(state) {
- skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
- if(!skinSelectorIndex) {
- skinSelectorIndex = 0;
- }
+ if(state) {
+ skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
+ if(!skinSelectorIndex) {
+ skinSelectorIndex = 0;
+ }
- usingSkinSelector = true;
- skinSelectPosition = localPlayer.position;
- skinSelectHeading = localPlayer.heading;
+ usingSkinSelector = true;
+ skinSelectPosition = localPlayer.position;
+ skinSelectHeading = localPlayer.heading;
- if(isCustomCameraSupported()) {
- let tempPosition = localPlayer.position;
- tempPosition.z += 0.5;
- let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
- game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
- }
+ if(isCustomCameraSupported()) {
+ let tempPosition = localPlayer.position;
+ tempPosition.z += 0.5;
+ let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
+ game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- let skinId = allowedSkins[skinSelectorIndex][0];
- if(natives.isModelInCdimage(skinId)) {
- natives.requestModel(skinId);
- natives.loadAllObjectsNow();
- if(natives.hasModelLoaded(skinId)) {
- natives.changePlayerModel(natives.getPlayerId(), skinId);
- }
- }
- } else {
- localPlayer.skin = allowedSkins[skinSelectorIndex][0];
- }
-
- skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
- setLocalPlayerControlState(false, false);
- } else {
- usingSkinSelector = false;
- setLocalPlayerControlState(false, false);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ let skinId = allowedSkins[skinSelectorIndex][0];
+ if(natives.isModelInCdimage(skinId)) {
+ natives.requestModel(skinId);
+ natives.loadAllObjectsNow();
+ if(natives.hasModelLoaded(skinId)) {
+ natives.changePlayerModel(natives.getPlayerId(), skinId);
+ }
+ }
+ } else {
+ localPlayer.skin = allowedSkins[skinSelectorIndex][0];
+ }
+
+ skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
+ setLocalPlayerControlState(false, false);
+ } else {
+ usingSkinSelector = false;
+ setLocalPlayerControlState(false, false);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/startup.js b/scripts/client/startup.js
index c0e59f71..e8f4b94f 100644
--- a/scripts/client/startup.js
+++ b/scripts/client/startup.js
@@ -8,164 +8,165 @@
// ===========================================================================
function initClientScripts() {
- initGUIScript();
- initNameTagScript();
- initScoreBoardScript();
- initMessagingScript();
- initServerScript();
- initLogoScript();
- initLabelScript();
- initChatBoxScript();
- initAFKScript();
- initKeyBindScript();
- initEventScript();
- initSkinSelectScript();
+ initGUIScript();
+ initNameTagScript();
+ initScoreBoardScript();
+ initMessagingScript();
+ initServerScript();
+ initLogoScript();
+ initLabelScript();
+ initChatBoxScript();
+ initAFKScript();
+ initKeyBindScript();
+ initEventScript();
+ initSkinSelectScript();
}
// ===========================================================================
function setUpInitialGame() {
- if(getGame() == VRR_GAME_GTA_III) {
- game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
- game.setGameStat(STAT_PROGRESSMADE, 9999);
- game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
- game.SET_CAR_DENSITY_MULTIPLIER(3.0);
- game.SET_PED_DENSITY_MULTIPLIER(3.0);
- game.onMission = true;
- SetStandardControlsEnabled(true);
- return true;
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
+ game.setGameStat(STAT_PROGRESSMADE, 9999);
+ game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
+ game.SET_CAR_DENSITY_MULTIPLIER(3.0);
+ game.SET_PED_DENSITY_MULTIPLIER(3.0);
+ game.onMission = true;
+ SetStandardControlsEnabled(true);
+ return true;
+ }
- if(getGame() == VRR_GAME_GTA_VC) {
- game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
- game.setGameStat(STAT_PROGRESSMADE, 9999);
- game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
- game.SET_CAR_DENSITY_MULTIPLIER(3.0);
- game.SET_PED_DENSITY_MULTIPLIER(3.0);
+ if(getGame() == VRR_GAME_GTA_VC) {
+ game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
+ game.setGameStat(STAT_PROGRESSMADE, 9999);
+ game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
+ game.SET_CAR_DENSITY_MULTIPLIER(3.0);
+ game.SET_PED_DENSITY_MULTIPLIER(3.0);
- game.REQUEST_ANIMATION("bikev");
- game.REQUEST_ANIMATION("bikeh");
- game.REQUEST_ANIMATION("biked");
- game.REQUEST_ANIMATION("knife");
- game.REQUEST_ANIMATION("python");
- game.REQUEST_ANIMATION("shotgun");
- game.REQUEST_ANIMATION("buddy");
- game.REQUEST_ANIMATION("tec");
- game.REQUEST_ANIMATION("uzi");
- game.REQUEST_ANIMATION("rifle");
- game.REQUEST_ANIMATION("m60");
- game.REQUEST_ANIMATION("sniper");
- game.REQUEST_ANIMATION("grenade");
- game.REQUEST_ANIMATION("flame");
- game.REQUEST_ANIMATION("medic");
- game.REQUEST_ANIMATION("sunbathe");
- //game.REQUEST_ANIMATION("playidles");
- game.REQUEST_ANIMATION("riot");
- game.REQUEST_ANIMATION("strip");
- game.REQUEST_ANIMATION("lance");
- game.REQUEST_ANIMATION("skate");
+ game.REQUEST_ANIMATION("bikev");
+ game.REQUEST_ANIMATION("bikeh");
+ game.REQUEST_ANIMATION("biked");
+ game.REQUEST_ANIMATION("knife");
+ game.REQUEST_ANIMATION("python");
+ game.REQUEST_ANIMATION("shotgun");
+ game.REQUEST_ANIMATION("buddy");
+ game.REQUEST_ANIMATION("tec");
+ game.REQUEST_ANIMATION("uzi");
+ game.REQUEST_ANIMATION("rifle");
+ game.REQUEST_ANIMATION("m60");
+ game.REQUEST_ANIMATION("sniper");
+ game.REQUEST_ANIMATION("grenade");
+ game.REQUEST_ANIMATION("flame");
+ game.REQUEST_ANIMATION("medic");
+ game.REQUEST_ANIMATION("sunbathe");
+ //game.REQUEST_ANIMATION("playidles");
+ game.REQUEST_ANIMATION("riot");
+ game.REQUEST_ANIMATION("strip");
+ game.REQUEST_ANIMATION("lance");
+ game.REQUEST_ANIMATION("skate");
- game.LOAD_ALL_MODELS_NOW();
- game.onMission = true;
- SetStandardControlsEnabled(true);
- return true;
- }
+ game.LOAD_ALL_MODELS_NOW();
+ game.onMission = true;
+ SetStandardControlsEnabled(true);
+ return true;
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
- game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
- game.setGameStat(STAT_DRIVING_SKILL, 9999);
- game.setGameStat(STAT_FAT, 9999);
- game.setGameStat(STAT_ENERGY, 9999);
- game.setGameStat(STAT_CYCLE_SKILL, 9999);
- game.setGameStat(STAT_BIKE_SKILL, 9999);
- game.setGameStat(STAT_GAMBLING, 9999);
- game.setGameStat(STAT_PROGRESS_MADE, 9999);
- game.setGameStat(STAT_RESPECT, 0);
- game.setGameStat(STAT_RESPECT_TOTAL, 0);
- game.setGameStat(STAT_SEX_APPEAL, 0);
- game.setGameStat(STAT_STAMINA, 9999);
- game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
- game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
- game.setGameStat(STAT_BODY_MUSCLE, 9999);
+ if(getGame() == VRR_GAME_GTA_SA) {
+ game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
+ game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
+ game.setGameStat(STAT_DRIVING_SKILL, 9999);
+ game.setGameStat(STAT_FAT, 9999);
+ game.setGameStat(STAT_ENERGY, 9999);
+ game.setGameStat(STAT_CYCLE_SKILL, 9999);
+ game.setGameStat(STAT_BIKE_SKILL, 9999);
+ game.setGameStat(STAT_GAMBLING, 9999);
+ game.setGameStat(STAT_PROGRESS_MADE, 9999);
+ game.setGameStat(STAT_RESPECT, 0);
+ game.setGameStat(STAT_RESPECT_TOTAL, 0);
+ game.setGameStat(STAT_SEX_APPEAL, 0);
+ game.setGameStat(STAT_STAMINA, 9999);
+ game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
+ game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
+ game.setGameStat(STAT_BODY_MUSCLE, 9999);
- game.setDefaultInteriors(false);
- game.onMission = true;
- return true;
- }
+ game.setDefaultInteriors(false);
+ game.onMission = true;
+ return true;
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.allowEmergencyServices(false);
- natives.setCreateRandomCops(true);
- natives.setMaxWantedLevel(0);
- natives.setWantedMultiplier(0.0);
- natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
- natives.setPlayerTeam(natives.getPlayerId(), 0);
- natives.loadAllObjectsNow();
- natives.setCellphoneRanked(false);
- natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
- natives.setSyncWeatherAndGameTime(false);
- natives.usePlayerColourInsteadOfTeamColour(true);
- natives.disablePauseMenu(true);
- natives.allowReactionAnims(localPlayer, true);
- natives.allowGameToPauseForStreaming(false);
- natives.allowStuntJumpsToTrigger(false);
- natives.setPickupsFixCars(false);
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.allowEmergencyServices(false);
+ natives.setCreateRandomCops(true);
+ natives.setMaxWantedLevel(0);
+ natives.setWantedMultiplier(0.0);
+ natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
+ natives.setPlayerTeam(natives.getPlayerId(), 0);
+ natives.loadAllObjectsNow();
+ natives.setCellphoneRanked(false);
+ natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
+ natives.setSyncWeatherAndGameTime(false);
+ natives.usePlayerColourInsteadOfTeamColour(true);
+ natives.disablePauseMenu(true);
+ natives.allowReactionAnims(localPlayer, false);
+ natives.allowGameToPauseForStreaming(false);
+ natives.allowStuntJumpsToTrigger(false);
+ natives.setPickupsFixCars(false);
+ natives.forceFullVoice(localPlayer);
- // HUD and Display
- //natives.displayCash(false);
- //natives.displayAmmo(false);
- //natives.displayHud(false);
- //natives.displayRadar(false);
- //natives.displayAreaName(false);
- natives.displayPlayerNames(true);
- natives.setPoliceRadarBlips(false);
- natives.removeTemporaryRadarBlipsForPickups();
- natives.displayNonMinigameHelpMessages(false);
- natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), true);
+ // HUD and Display
+ //natives.displayCash(false);
+ //natives.displayAmmo(false);
+ //natives.displayHud(false);
+ //natives.displayRadar(false);
+ //natives.displayAreaName(false);
+ natives.displayPlayerNames(true);
+ natives.setPoliceRadarBlips(false);
+ natives.removeTemporaryRadarBlipsForPickups();
+ natives.displayNonMinigameHelpMessages(false);
+ natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), true);
- // Item/Money Dropping
- natives.setMoneyCarriedByAllNewPeds(0);
- natives.setDeadPedsDropWeapons(false);
- natives.setPlayersDropMoneyInNetworkGame(false);
+ // Item/Money Dropping
+ natives.setMoneyCarriedByAllNewPeds(0);
+ natives.setDeadPedsDropWeapons(false);
+ natives.setPlayersDropMoneyInNetworkGame(false);
- // Population
- //natives.dontSuppressAnyCarModels(5.0);
- //natives.dontSuppressAnyPedModels(5.0);
- //natives.forceGenerateParkedCarsTooCloseToOthers(true);
- //natives.setParkedCarDensityMultiplier(5.0);
- //natives.setRandomCarDensityMultiplier(5.0);
- //natives.setPedDensityMultiplier(5.0);
- //natives.setCarDensityMultiplier(5.0);
- //natives.setScenarioPedDensityMultiplier(5.0, 5.0);
- natives.switchRandomTrains(true);
- natives.switchRandomBoats(true);
- natives.switchAmbientPlanes(true);
- natives.switchMadDrivers(false);
+ // Population
+ //natives.dontSuppressAnyCarModels(5.0);
+ //natives.dontSuppressAnyPedModels(5.0);
+ //natives.forceGenerateParkedCarsTooCloseToOthers(true);
+ //natives.setParkedCarDensityMultiplier(5.0);
+ //natives.setRandomCarDensityMultiplier(5.0);
+ //natives.setPedDensityMultiplier(5.0);
+ //natives.setCarDensityMultiplier(5.0);
+ //natives.setScenarioPedDensityMultiplier(5.0, 5.0);
+ natives.switchRandomTrains(true);
+ natives.switchRandomBoats(true);
+ natives.switchAmbientPlanes(true);
+ natives.switchMadDrivers(false);
- // Singleplayer Cellphone
- natives.requestScript("spcellphone");
- natives.startNewScript("spcellphone", 0);
- //natives.setMessagesWaiting(false);
+ // Singleplayer Cellphone
+ natives.requestScript("spcellphone");
+ natives.startNewScript("spcellphone", 0);
+ //natives.setMessagesWaiting(false);
- // Animation libraries
- natives.requestAnims("DANCING");
- return true;
- }
+ // Animation libraries
+ natives.requestAnims("DANCING");
+ return true;
+ }
- if(getGame() == VRR_GAME_MAFIA_ONE) {
- game.mapEnabled = false;
- game.setTrafficEnabled(false);
- return true;
- }
+ if(getGame() == VRR_GAME_MAFIA_ONE) {
+ game.mapEnabled = false;
+ game.setTrafficEnabled(false);
+ return true;
+ }
}
// ===========================================================================
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index 34a5e7b3..7a001b37 100644
--- a/scripts/client/sync.js
+++ b/scripts/client/sync.js
@@ -8,37 +8,37 @@
// ===========================================================================
function processSync(event, deltaTime) {
- if(localPlayer != null) {
- if(!areServerElementsSupported()) {
- sendNetworkEventToServer("vrr.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
- sendNetworkEventToServer("vrr.plr.rot", (localPlayer.vehicle != null) ? localPlayer.vehicle.heading : localPlayer.heading);
+ if(localPlayer != null) {
+ if(!areServerElementsSupported()) {
+ sendNetworkEventToServer("vrr.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
+ sendNetworkEventToServer("vrr.plr.rot", (localPlayer.vehicle != null) ? localPlayer.vehicle.heading : localPlayer.heading);
- //if(localPlayer.vehicle != null) {
- // sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
- // sendNetworkEventToServer("vrr.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
- //}
- }
+ //if(localPlayer.vehicle != null) {
+ // sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
+ // sendNetworkEventToServer("vrr.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
+ //}
+ }
- if(localPlayer.health <= 0) {
- if(!calledDeathEvent) {
- logToConsole(LOG_DEBUG, `Local player died`);
- localPlayer.clearWeapons();
- calledDeathEvent = true;
- sendNetworkEventToServer("vrr.playerDeath");
- }
- }
+ if(localPlayer.health <= 0) {
+ if(!calledDeathEvent) {
+ logToConsole(LOG_DEBUG, `Local player died`);
+ localPlayer.clearWeapons();
+ calledDeathEvent = true;
+ sendNetworkEventToServer("vrr.playerDeath");
+ }
+ }
- if(streamingRadioElement) {
- streamingRadio.position = getElementPosition(streamingRadioElement);
- //streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
- }
- }
+ if(streamingRadioElement) {
+ streamingRadio.position = getElementPosition(streamingRadioElement);
+ //streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
+ }
+ }
}
// ===========================================================================
function setVehicleEngine(vehicleId, state) {
- getElementFromId(vehicleId).engine = state;
+ getElementFromId(vehicleId).engine = state;
}
// ===========================================================================
@@ -46,370 +46,370 @@ function setVehicleEngine(vehicleId, state) {
function setVehicleLights(vehicleId, state) {
- if(getGame() != VRR_GAME_MAFIA_ONE) {
- if(!state) {
- getElementFromId(vehicleId).lightStatus = 2;
- } else {
- getElementFromId(vehicleId).lightStatus = 1;
- }
- } else if(getGame() == VRR_GAME_GTA_IV) {
- if(!state) {
- natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 0));
- } else {
- natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 1));
- }
- } else {
- if(!state) {
- getElementFromId(vehicleId).lights = false;
- } else {
- getElementFromId(vehicleId).lights = true;
- }
- }
+ if(getGame() != VRR_GAME_MAFIA_ONE) {
+ if(!state) {
+ getElementFromId(vehicleId).lightStatus = 2;
+ } else {
+ getElementFromId(vehicleId).lightStatus = 1;
+ }
+ } else if(getGame() == VRR_GAME_GTA_IV) {
+ if(!state) {
+ natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 0));
+ } else {
+ natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 1));
+ }
+ } else {
+ if(!state) {
+ getElementFromId(vehicleId).lights = false;
+ } else {
+ getElementFromId(vehicleId).lights = true;
+ }
+ }
}
// ===========================================================================
function repairVehicle(syncId) {
- getVehicleFromSyncId(syncId).fix();
+ getVehicleFromSyncId(syncId).fix();
}
// ===========================================================================
function syncVehicleProperties(vehicle) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(doesEntityDataExist(vehicle, "vrr.lights")) {
- let lightStatus = getEntityData(vehicle, "vrr.lights");
- if(!lightStatus) {
- vehicle.lightStatus = 2;
- } else {
- vehicle.lightStatus = 1;
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.lights")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lights");
+ if(!lightStatus) {
+ vehicle.lightStatus = 2;
+ } else {
+ vehicle.lightStatus = 1;
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.invincible")) {
- let invincible = getEntityData(vehicle, "vrr.invincible");
- element.setProofs(invincible, invincible, invincible, invincible, invincible);
- }
+ if(doesEntityDataExist(vehicle, "vrr.invincible")) {
+ let invincible = getEntityData(vehicle, "vrr.invincible");
+ element.setProofs(invincible, invincible, invincible, invincible, invincible);
+ }
- if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
- let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
- for(let i in panelsStatus) {
- vehicle.setPanelStatus(i, panelsStatus[i]);
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
+ let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
+ for(let i in panelsStatus) {
+ vehicle.setPanelStatus(i, panelsStatus[i]);
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
- let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
- for(let i in wheelsStatus) {
- vehicle.setWheelStatus(i, wheelsStatus[i]);
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
+ let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
+ for(let i in wheelsStatus) {
+ vehicle.setWheelStatus(i, wheelsStatus[i]);
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
- let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
- for(let i in lightStatus) {
- vehicle.setLightStatus(i, lightStatus[i]);
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
+ for(let i in lightStatus) {
+ vehicle.setLightStatus(i, lightStatus[i]);
+ }
+ }
- if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
- let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
- vehicle.setSuspensionHeight(suspensionHeight);
- }
+ if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
+ let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
+ vehicle.setSuspensionHeight(suspensionHeight);
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
- for(let i in allUpgrades) {
- vehicle.removeUpgrade(i);
- }
+ if(getGame() == VRR_GAME_GTA_SA) {
+ let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
+ for(let i in allUpgrades) {
+ vehicle.removeUpgrade(i);
+ }
- if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
- let upgrades = getEntityData(vehicle, "vrr.upgrades");
- for(let i in upgrades) {
- if(upgrades[i] != 0) {
- vehicle.addUpgrade(upgrades[i]);
- }
- }
- }
- }
+ if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
+ let upgrades = getEntityData(vehicle, "vrr.upgrades");
+ for(let i in upgrades) {
+ if(upgrades[i] != 0) {
+ vehicle.addUpgrade(upgrades[i]);
+ }
+ }
+ }
+ }
- if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(vehicle, "vrr.livery")) {
- let livery = getEntityData(vehicle, "vrr.livery");
- if(getGame() == VRR_GAME_GTA_SA) {
- vehicle.setPaintJob(livery);
- } else if(getGame() == VRR_GAME_GTA_IV) {
- vehicle.livery = livery;
- }
- }
- }
+ if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(vehicle, "vrr.livery")) {
+ let livery = getEntityData(vehicle, "vrr.livery");
+ if(getGame() == VRR_GAME_GTA_SA) {
+ vehicle.setPaintJob(livery);
+ } else if(getGame() == VRR_GAME_GTA_IV) {
+ vehicle.livery = livery;
+ }
+ }
+ }
}
// ===========================================================================
function syncCivilianProperties(civilian) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(getGame() == VRR_GAME_GTA_III) {
- if(doesEntityDataExist(civilian, "vrr.scale")) {
- let scaleFactor = getEntityData(civilian, "vrr.scale");
- let tempMatrix = civilian.matrix;
- tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
- let tempPosition = civilian.position;
- civilian.matrix = tempMatrix;
- tempPosition.z += scaleFactor.z;
- civilian.position = tempPosition;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(civilian, "vrr.scale")) {
+ let scaleFactor = getEntityData(civilian, "vrr.scale");
+ let tempMatrix = civilian.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = civilian.position;
+ civilian.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ civilian.position = tempPosition;
+ }
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
- let fightStyle = getEntityData(civilian, "vrr.fightStyle");
- civilian.setFightStyle(fightStyle[0], fightStyle[1]);
- }
- }
+ if(getGame() == VRR_GAME_GTA_SA) {
+ if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(civilian, "vrr.fightStyle");
+ civilian.setFightStyle(fightStyle[0], fightStyle[1]);
+ }
+ }
- if(getGame() == VRR_GAME_GTA_III) {
- if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
- let walkStyle = getEntityData(civilian, "vrr.walkStyle");
- civilian.walkStyle = walkStyle;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
+ let walkStyle = getEntityData(civilian, "vrr.walkStyle");
+ civilian.walkStyle = walkStyle;
+ }
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
- let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
- civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
+ civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
- let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
- civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
+ civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
- let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
- civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
+ civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
- let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
- civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
+ civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
- let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
- civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
+ civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
- let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
- civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
+ civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
- civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
+ civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
- civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
+ civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
- let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
- civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
+ civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
- let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
- civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
+ civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
+ }
- if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
- let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
- civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
- }
- }
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
+ civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
+ }
+ }
- if(doesEntityDataExist(civilian, "vrr.anim")) {
- let animData = getEntityData(vehicle, "vrr.anim");
- civilian.addAnimation(animData[0], animData[1]);
- }
+ if(doesEntityDataExist(civilian, "vrr.anim")) {
+ let animData = getEntityData(vehicle, "vrr.anim");
+ civilian.addAnimation(animData[0], animData[1]);
+ }
}
// ===========================================================================
function syncPlayerProperties(player) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(getGame() == VRR_GAME_GTA_III) {
- if(doesEntityDataExist(player, "vrr.scale")) {
- let scaleFactor = getEntityData(player, "vrr.scale");
- let tempMatrix = player.matrix;
- tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
- let tempPosition = player.position;
- player.matrix = tempMatrix;
- tempPosition.z += scaleFactor.z;
- player.position = tempPosition;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III) {
+ if(doesEntityDataExist(player, "vrr.scale")) {
+ let scaleFactor = getEntityData(player, "vrr.scale");
+ let tempMatrix = player.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = player.position;
+ player.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ player.position = tempPosition;
+ }
+ }
- if(getGame() == VRR_GAME_GTA_SA) {
- if(doesEntityDataExist(player, "vrr.fightStyle")) {
- let fightStyle = getEntityData(player, "vrr.fightStyle");
- player.setFightStyle(fightStyle[0], fightStyle[1]);
- }
- }
+ if(getGame() == VRR_GAME_GTA_SA) {
+ if(doesEntityDataExist(player, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(player, "vrr.fightStyle");
+ player.setFightStyle(fightStyle[0], fightStyle[1]);
+ }
+ }
- //if(getGame() == VRR_GAME_GTA_SA) {
- // if(doesEntityDataExist(player, "vrr.walkStyle")) {
- // let walkStyle = getEntityData(player, "vrr.walkStyle");
- // player.walkStyle = walkStyle;
- // }
- //}
+ //if(getGame() == VRR_GAME_GTA_SA) {
+ // if(doesEntityDataExist(player, "vrr.walkStyle")) {
+ // let walkStyle = getEntityData(player, "vrr.walkStyle");
+ // player.walkStyle = walkStyle;
+ // }
+ //}
- if(getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
- let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
- player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
+ player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
- let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
- player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
+ player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
- let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
- player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
+ let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
+ player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
- let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
- player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
- }
- }
+ if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
+ let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
+ player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
+ }
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
- let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
- player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
+ player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
- let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
- player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
+ player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
- let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
- player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
+ player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
- let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
- player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
+ player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
- let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
- player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
+ player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
- let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
- player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
+ player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
- player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
+ player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
- player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
+ player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
- let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
- player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
+ player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
- let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
- player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
+ player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
+ }
- if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
- let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
- player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
- }
- }
+ if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
+ player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
+ }
+ }
}
// ===========================================================================
function syncObjectProperties(object) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
- if(doesEntityDataExist(object, "vrr.scale")) {
- let scaleFactor = getEntityData(object, "vrr.scale");
- let tempMatrix = object.matrix;
- tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
- let tempPosition = object.position;
- object.matrix = tempMatrix;
- tempPosition.z += scaleFactor.z;
- object.position = tempPosition;
- }
- }
+ if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
+ if(doesEntityDataExist(object, "vrr.scale")) {
+ let scaleFactor = getEntityData(object, "vrr.scale");
+ let tempMatrix = object.matrix;
+ tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
+ let tempPosition = object.position;
+ object.matrix = tempMatrix;
+ tempPosition.z += scaleFactor.z;
+ object.position = tempPosition;
+ }
+ }
}
// ===========================================================================
function syncElementProperties(element) {
- if(!areServerElementsSupported()) {
- return false;
- }
+ if(!areServerElementsSupported()) {
+ return false;
+ }
- if(doesEntityDataExist(element, "vrr.interior")) {
- if(typeof element.interior != "undefined") {
- element.interior = getEntityData(element, "vrr.interior");
- }
- }
+ if(doesEntityDataExist(element, "vrr.interior")) {
+ if(typeof element.interior != "undefined") {
+ element.interior = getEntityData(element, "vrr.interior");
+ }
+ }
- switch(element.type) {
- case ELEMENT_VEHICLE:
- syncVehicleProperties(element);
- break;
+ switch(element.type) {
+ case ELEMENT_VEHICLE:
+ syncVehicleProperties(element);
+ break;
- case ELEMENT_PED:
- syncCivilianProperties(element);
- break;
+ case ELEMENT_PED:
+ syncCivilianProperties(element);
+ break;
- case ELEMENT_PLAYER:
- syncPlayerProperties(element);
- break;
+ case ELEMENT_PLAYER:
+ syncPlayerProperties(element);
+ break;
- case ELEMENT_OBJECT:
- syncObjectProperties(element);
- break;
+ case ELEMENT_OBJECT:
+ syncObjectProperties(element);
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
@@ -417,21 +417,21 @@ function syncElementProperties(element) {
// ===========================================================================
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- if(getGame() == VRR_GAME_GTA_IV) {
-
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+
+ }
}
// ===========================================================================
function setLocalPlayerPedPartsAndProps(parts, props) {
- for(let i in parts) {
- localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
- }
+ for(let i in parts) {
+ localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
+ }
- for(let j in props) {
- localPlayer.changeBodyProp(props[j][0], props[j][1]);
- }
+ for(let j in props) {
+ localPlayer.changeBodyProp(props[j][0], props[j][1]);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 82a1276c..a17297d0 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -8,253 +8,253 @@
// ===========================================================================
let weaponSlots = [
- false,
- [
- 0,
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11
- ],
- [
- 0,
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 2,
- 2,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 5,
- 6,
- 6,
- 8,
- 8,
- 7,
- 7,
- 7,
- 7,
- 9,
- -1,
- 9,
- ],
- [
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 8,
- 8,
- 8,
- -1,
- -1,
- -1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 5,
- 5,
- 4,
- 6,
- 6,
- 7,
- 7,
- 7,
- 7,
- 8,
- 12,
- 9,
- 9,
- 9,
- 9,
- 9,
- 11,
- 9,
- 9,
- 9,
- ],
+ false,
+ [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11
+ ],
+ [
+ 0,
+ 0,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 8,
+ 8,
+ 7,
+ 7,
+ 7,
+ 7,
+ 9,
+ -1,
+ 9,
+ ],
+ [
+ 0,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 8,
+ 8,
+ 8,
+ -1,
+ -1,
+ -1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 5,
+ 5,
+ 4,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 7,
+ 8,
+ 12,
+ 9,
+ 9,
+ 9,
+ 9,
+ 9,
+ 11,
+ 9,
+ 9,
+ 9,
+ ],
];
function openAllGarages() {
- switch(game.game) {
- case VRR_GAME_GTA_III:
- for(let i=0;i<=26;i++) {
- openGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
+ switch(game.game) {
+ case VRR_GAME_GTA_III:
+ for(let i=0;i<=26;i++) {
+ openGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
- case VRR_GAME_GTA_VC:
- for(let i=0;i<=32;i++) {
- openGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
+ case VRR_GAME_GTA_VC:
+ for(let i=0;i<=32;i++) {
+ openGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
- case VRR_GAME_GTA_SA:
- for(let i=0;i<=44;i++) {
- openGarage(i);
- }
- break;
+ case VRR_GAME_GTA_SA:
+ for(let i=0;i<=44;i++) {
+ openGarage(i);
+ }
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
// ===========================================================================
function closeAllGarages() {
- switch(game.game) {
- case VRR_GAME_GTA_III:
- for(let i=0;i<=26;i++) {
- closeGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
+ switch(game.game) {
+ case VRR_GAME_GTA_III:
+ for(let i=0;i<=26;i++) {
+ closeGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
- case VRR_GAME_GTA_VC:
- for(let i=0;i<=32;i++) {
- closeGarage(i);
- game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
- }
- break;
+ case VRR_GAME_GTA_VC:
+ for(let i=0;i<=32;i++) {
+ closeGarage(i);
+ game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
+ }
+ break;
- case VRR_GAME_GTA_SA:
- for(let i=0;i<=44;i++) {
- closeGarage(i);
- }
- break;
+ case VRR_GAME_GTA_SA:
+ for(let i=0;i<=44;i++) {
+ closeGarage(i);
+ }
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
// ===========================================================================
function setLocalPlayerFrozenState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
- gui.showCursor(state, !state);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
+ gui.showCursor(state, !state);
}
// ===========================================================================
function setLocalPlayerControlState(controlState, cursorState = false) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
- controlsEnabled = controlState;
- if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
- game.SET_PLAYER_CONTROL(localClient.index, boolToInt(controlState));
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
+ controlsEnabled = controlState;
+ if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
+ game.SET_PLAYER_CONTROL(localClient.index, boolToInt(controlState));
+ }
- if(getGame() != VRR_GAME_GTA_IV) {
- localPlayer.collisionsEnabled = controlState;
- localPlayer.invincible = true;
- }
+ if(getGame() != VRR_GAME_GTA_IV) {
+ localPlayer.collisionsEnabled = controlState;
+ localPlayer.invincible = true;
+ }
}
// ===========================================================================
function fadeLocalCamera(state, time) {
- if(isFadeCameraSupported()) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
+ if(isFadeCameraSupported()) {
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
- if(isFadeCameraSupported()) {
- game.fadeCamera(state, time);
- }
- }
+ if(isFadeCameraSupported()) {
+ game.fadeCamera(state, time);
+ }
+ }
}
// ===========================================================================
function removeLocalPlayerFromVehicle() {
- localPlayer.removeFromVehicle();
+ localPlayer.removeFromVehicle();
}
// ===========================================================================
function restoreLocalCamera() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
- if(isCustomCameraSupported()) {
- game.restoreCamera(true);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
+ if(isCustomCameraSupported()) {
+ game.restoreCamera(true);
+ }
};
// ===========================================================================
function clearLocalPlayerOwnedPeds() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`);
- clearSelfOwnedPeds();
- logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`);
+ clearSelfOwnedPeds();
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`);
};
// ===========================================================================
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
- if(isCustomCameraSupported()) {
- game.setCameraLookAt(cameraPosition, cameraLookAt, true);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
+ if(isCustomCameraSupported()) {
+ game.setCameraLookAt(cameraPosition, cameraLookAt, true);
+ }
}
// ===========================================================================
function setCityAmbienceState(state, clearElements = false) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
- game.setTrafficEnabled(state);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
+ game.setTrafficEnabled(state);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- game.setGenerateCarsAroundCamera(state);
- if(game.game != VRR_GAME_GTA_SA) {
- game.setCiviliansEnabled(state);
- }
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ game.setGenerateCarsAroundCamera(state);
+ if(game.game != VRR_GAME_GTA_SA) {
+ game.setCiviliansEnabled(state);
+ }
- if(clearElements) {
- clearSelfOwnedPeds();
- clearSelfOwnedVehicles();
- }
- }
+ if(clearElements) {
+ clearSelfOwnedPeds();
+ clearSelfOwnedVehicles();
+ }
+ }
}
// ===========================================================================
@@ -266,8 +266,8 @@ function runClientCode(code, returnTo) {
} catch(error) {
sendNetworkEventToServer("vrr.runCodeFail", returnTo, code);
return false;
- }
- sendNetworkEventToServer("vrr.runCodeSuccess", returnTo, code, returnValue);
+ }
+ sendNetworkEventToServer("vrr.runCodeSuccess", returnTo, code, returnValue);
}
// ===========================================================================
@@ -275,444 +275,446 @@ function runClientCode(code, returnTo) {
function enterVehicleAsPassenger() {
if(localPlayer.vehicle == null) {
let tempVehicle = getClosestVehicle(localPlayer.position);
- if(getGame() != VRR_GAME_GTA_IV) {
- if(tempVehicle != null) {
- localPlayer.enterVehicle(tempVehicle, false);
- }
- } else {
- for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
- if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
- natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 10000);
- }
- }
- }
+ if(getGame() != VRR_GAME_GTA_IV) {
+ if(tempVehicle != null) {
+ localPlayer.enterVehicle(tempVehicle, false);
+ }
+ } else {
+ // Disable for now. GTA IV has built-in passenger entry
+
+ //for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
+ // if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
+ // natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 10000);
+ // }
+ //}
+ }
}
}
// ===========================================================================
function giveLocalPlayerWeapon(weaponId, ammo, active) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
- forceWeapon = weaponId;
- if(getGame() == VRR_GAME_MAFIA_ONE) {
- localPlayer.giveWeapon(weaponId, 0, ammo);
- forceWeaponAmmo = 0;
- forceWeaponClipAmmo = ammo;
- } else {
- localPlayer.giveWeapon(weaponId, ammo, active);
- if(getGame() < VRR_GAME_GTA_IV) {
- forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
- forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
- } else {
- forceWeaponAmmo = ammo;
- forceWeaponClipAmmo = ammo;
- }
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
+ forceWeapon = weaponId;
+ if(getGame() == VRR_GAME_MAFIA_ONE) {
+ localPlayer.giveWeapon(weaponId, 0, ammo);
+ forceWeaponAmmo = 0;
+ forceWeaponClipAmmo = ammo;
+ } else {
+ localPlayer.giveWeapon(weaponId, ammo, active);
+ if(getGame() < VRR_GAME_GTA_IV) {
+ forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
+ forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
+ } else {
+ forceWeaponAmmo = ammo;
+ forceWeaponClipAmmo = ammo;
+ }
+ }
}
// ===========================================================================
function clearLocalPlayerWeapons() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing weapons`);
- localPlayer.clearWeapons();
- forceWeapon = 0;
- forceWeaponAmmo = 0;
- forceWeaponClipAmmo = 0;
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing weapons`);
+ localPlayer.clearWeapons();
+ forceWeapon = 0;
+ forceWeaponAmmo = 0;
+ forceWeaponClipAmmo = 0;
}
// ===========================================================================
function getClosestVehicle(pos) {
- return getElementsByType(ELEMENT_VEHICLE).reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
+ return getElementsByType(ELEMENT_VEHICLE).reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
}
// ===========================================================================
function setLocalPlayerPosition(position) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
- if(typeof localPlayer.velocity != "undefined") {
- localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
+ if(typeof localPlayer.velocity != "undefined") {
+ localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
+ }
- if(typeof localPlayer.position != "undefined") {
- localPlayer.position = position;
- }
+ if(typeof localPlayer.position != "undefined") {
+ localPlayer.position = position;
+ }
}
// ===========================================================================
function setLocalPlayerHeading(heading) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting heading to ${heading}`);
- if(typeof localPlayer.heading != "undefined") {
- localPlayer.heading = heading;
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting heading to ${heading}`);
+ if(typeof localPlayer.heading != "undefined") {
+ localPlayer.heading = heading;
+ }
}
// ===========================================================================
function setLocalPlayerInterior(interior) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- if(!isGTAIV()) {
- localPlayer.interior = interior;
- game.cameraInterior = interior;
- } else {
- if(getGameConfig().mainWorldInterior != interior) {
- let interiorId = natives.getInteriorAtCoords(localPlayer.position);
- natives.activateInterior(interiorId, true);
- natives.loadAllObjectsNow();
- }
- }
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ if(!isGTAIV()) {
+ localPlayer.interior = interior;
+ game.cameraInterior = interior;
+ } else {
+ if(getGameConfig().mainWorldInterior != interior) {
+ let interiorId = natives.getInteriorAtCoords(localPlayer.position);
+ natives.activateInterior(interiorId, true);
+ natives.loadAllObjectsNow();
+ }
+ }
+ }
- //let vehicles = getElementsByType(ELEMENT_VEHICLE);
- //for(let i in vehicles) {
- // if(getEntityData(vehicles[i], "vrr.interior")) {
- // vehicles[i].interior = getEntityData(vehicles[i], "vrr.interior");
- // }
- //}
+ //let vehicles = getElementsByType(ELEMENT_VEHICLE);
+ //for(let i in vehicles) {
+ // if(getEntityData(vehicles[i], "vrr.interior")) {
+ // vehicles[i].interior = getEntityData(vehicles[i], "vrr.interior");
+ // }
+ //}
}
// ===========================================================================
function setSnowState(falling, ground) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
- snowing = falling;
- if(ground) {
- forceSnowing(false);
- forceSnowing(ground);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
+ snowing = falling;
+ if(ground) {
+ forceSnowing(false);
+ forceSnowing(ground);
+ }
}
// ===========================================================================
function setLocalPlayerHealth(health) {
- localPlayer.health = health;
+ localPlayer.health = health;
}
// ===========================================================================
function isSnowEnabled() {
- return (typeof snowing != "undefined");
+ return (typeof snowing != "undefined");
}
// ===========================================================================
function playPedSpeech(pedName, speechId) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- game.SET_CHAR_SAY(int, int);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ game.SET_CHAR_SAY(int, int);
+ }
}
// ===========================================================================
function clearLocalPedState() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing local ped state`);
- localPlayer.clearObjective();
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing local ped state`);
+ localPlayer.clearObjective();
}
// ===========================================================================
function getWeaponSlot(weaponId) {
- if(getGame() == VRR_GAME_GTA_IV) {
- return false;
- }
-
+ if(getGame() == VRR_GAME_GTA_IV) {
+ return false;
+ }
+
return weaponSlots[getGame()][weaponId];
}
// ===========================================================================
function setLocalPlayerDrunkEffect(amount, duration) {
- if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration}ms`);
- drunkEffectAmount = 0;
- drunkEffectDurationTimer = setInterval(function() {
- drunkEffectAmount = drunkEffectAmount;
- if(drunkEffectAmount > 0) {
- //game.SET_MOTION_BLUR(drunkEffectAmount);
- game.SET_PLAYER_DRUNKENNESS(drunkEffectAmount, duration);
- } else {
- clearInterval(drunkEffectDurationTimer);
- drunkEffectDurationTimer = null;
- }
- }, 1000);
- }
+ if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration}ms`);
+ drunkEffectAmount = 0;
+ drunkEffectDurationTimer = setInterval(function() {
+ drunkEffectAmount = drunkEffectAmount;
+ if(drunkEffectAmount > 0) {
+ //game.SET_MOTION_BLUR(drunkEffectAmount);
+ game.SET_PLAYER_DRUNKENNESS(drunkEffectAmount, duration);
+ } else {
+ clearInterval(drunkEffectDurationTimer);
+ drunkEffectDurationTimer = null;
+ }
+ }, 1000);
+ }
}
// ===========================================================================
function getLocalPlayerVehicleSeat() {
- for(let i = 0 ; i <= 4 ; i++) {
- if(localPlayer.vehicle.getOccupant(i) == localPlayer) {
- return i;
- }
- }
+ for(let i = 0 ; i <= 4 ; i++) {
+ if(localPlayer.vehicle.getOccupant(i) == localPlayer) {
+ return i;
+ }
+ }
}
// ===========================================================================
function clearSelfOwnedPeds() {
- logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
- getElementsByType(ELEMENT_PED).forEach(function(ped) {
- //if(ped.isOwner) {
- destroyElement(ped);
- //}
- });
+ logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
+ getElementsByType(ELEMENT_PED).forEach(function(ped) {
+ //if(ped.isOwner) {
+ destroyElement(ped);
+ //}
+ });
}
// ===========================================================================
function clearSelfOwnedVehicles() {
- logToConsole(LOG_DEBUG, `Clearing self-owned vehicles`);
- getElementsByType(ELEMENT_VEHICLE).forEach(function(vehicle) {
- //if(vehicle.isOwner) {
- destroyElement(vehicle);
- //}
- });
+ logToConsole(LOG_DEBUG, `Clearing self-owned vehicles`);
+ getElementsByType(ELEMENT_VEHICLE).forEach(function(vehicle) {
+ //if(vehicle.isOwner) {
+ destroyElement(vehicle);
+ //}
+ });
}
// ===========================================================================
function setMouseCameraState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} mouse camera`);
- mouseCameraEnabled = state;
- SetStandardControlsEnabled(!mouseCameraEnabled);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} mouse camera`);
+ mouseCameraEnabled = state;
+ SetStandardControlsEnabled(!mouseCameraEnabled);
}
// ===========================================================================
function toggleMouseCursor() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
- gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
+ gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
}
// ===========================================================================
function toggleMouseCursor() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
- setMouseCameraState(!mouseCameraEnabled);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
+ setMouseCameraState(!mouseCameraEnabled);
}
// ===========================================================================
function setPlayerWeaponDamageEvent(clientName, eventType) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
- weaponDamageEvent[clientName] = eventType;
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
+ weaponDamageEvent[clientName] = eventType;
}
// ===========================================================================
function setPlayerWeaponDamageEnabled(clientName, state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} damage from ${clientName}`);
- weaponDamageEnabled[clientName] = state;
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} damage from ${clientName}`);
+ weaponDamageEnabled[clientName] = state;
}
// ===========================================================================
function setLocalPlayerCash(amount) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
- if(typeof localPlayer.money != "undefined") {
- localPlayer.money = toInteger(amount);
- }
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
+ if(typeof localPlayer.money != "undefined") {
+ localPlayer.money = toInteger(amount);
+ }
- if(getGame() == VRR_GAME_GTA_IV) {
- natives.setMultiplayerHudCash(amount);
- }
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.setMultiplayerHudCash(amount);
+ }
}
// ===========================================================================
function destroyAutoCreatedPickups() {
- if(typeof ELEMENT_PICKUP != "undefined") {
- getElementsByType(ELEMENT_PICKUP).forEach(function(pickup) {
- if(pickup.isOwner) {
- destroyElement(pickup);
- }
- });
- }
+ if(typeof ELEMENT_PICKUP != "undefined") {
+ getElementsByType(ELEMENT_PICKUP).forEach(function(pickup) {
+ if(pickup.isOwner) {
+ destroyElement(pickup);
+ }
+ });
+ }
}
// ===========================================================================
function processLocalPlayerControlState() {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
- if(isSpawned) {
- return false;
- }
+ if(isSpawned) {
+ return false;
+ }
- if(!controlsEnabled) {
- clearLocalPedState();
- }
+ if(!controlsEnabled) {
+ clearLocalPedState();
+ }
}
// ===========================================================================
function processWantedLevelReset() {
- if(localPlayer == null) {
- return false;
- }
+ if(localPlayer == null) {
+ return false;
+ }
- if(!isSpawned) {
- return false;
- }
+ if(!isSpawned) {
+ return false;
+ }
- if(typeof localPlayer.wantedLevel != "undefined") {
- localPlayer.wantedLevel = forceWantedLevel;
- }
+ if(typeof localPlayer.wantedLevel != "undefined") {
+ localPlayer.wantedLevel = forceWantedLevel;
+ }
}
// ===========================================================================
function processLocalPlayerVehicleControlState() {
- if(areServerElementsSupported()) {
- if(inVehicle && localPlayer.vehicle != null) {
- if(getEntityData(localPlayer.vehicle, "vrr.engine") == false) {
- localPlayer.vehicle.engine = false;
- }
+ if(areServerElementsSupported()) {
+ if(inVehicle && localPlayer.vehicle != null) {
+ if(getEntityData(localPlayer.vehicle, "vrr.engine") == false) {
+ localPlayer.vehicle.engine = false;
+ }
- if(!localPlayer.vehicle.engine) {
- if(typeof localPlayer.vehicle.velocity != "undefined") {
- localPlayer.vehicle.velocity = toVector3(0.0, 0.0, 0.0);
- localPlayer.vehicle.turnVelocity = toVector3(0.0, 0.0, 0.0);
- }
+ if(!localPlayer.vehicle.engine) {
+ if(typeof localPlayer.vehicle.velocity != "undefined") {
+ localPlayer.vehicle.velocity = toVector3(0.0, 0.0, 0.0);
+ localPlayer.vehicle.turnVelocity = toVector3(0.0, 0.0, 0.0);
+ }
- if(parkedVehiclePosition) {
- localPlayer.vehicle.position = parkedVehiclePosition;
- localPlayer.vehicle.heading = parkedVehicleHeading;
- }
- } else {
- if(parkedVehiclePosition) {
- parkedVehiclePosition = false;
- parkedVehicleHeading = false;
- }
- }
- }
- }
+ if(parkedVehiclePosition) {
+ localPlayer.vehicle.position = parkedVehiclePosition;
+ localPlayer.vehicle.heading = parkedVehicleHeading;
+ }
+ } else {
+ if(parkedVehiclePosition) {
+ parkedVehiclePosition = false;
+ parkedVehicleHeading = false;
+ }
+ }
+ }
+ }
}
// ===========================================================================
function processLocalPlayerSphereEntryExitHandling() {
- let position = getLocalPlayerPosition();
+ let position = getLocalPlayerPosition();
- if(areMarkersSupported()) {
- getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
- if(getDistance(position, sphere.position) <= sphere.radius) {
- if(!inSphere) {
- inSphere = sphere;
- triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
- }
- } else {
- if(inSphere) {
- inSphere = false;
- triggerEvent("OnLocalPlayerExitSphere", null, sphere);
- }
- }
- });
- }
+ if(areMarkersSupported()) {
+ getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
+ if(getDistance(position, sphere.position) <= sphere.radius) {
+ if(!inSphere) {
+ inSphere = sphere;
+ triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
+ }
+ } else {
+ if(inSphere) {
+ inSphere = false;
+ triggerEvent("OnLocalPlayerExitSphere", null, sphere);
+ }
+ }
+ });
+ }
}
// ===========================================================================
function processJobRouteSphere() {
- if(game.game == VRR_GAME_GTA_SA) {
- let position = getLocalPlayerPosition();
- if(jobRouteLocationSphere != null) {
- if(getDistance(position, jobRouteLocationSphere.position) <= 2.0) {
- enteredJobRouteSphere();
- }
- }
- }
+ if(game.game == VRR_GAME_GTA_SA) {
+ let position = getLocalPlayerPosition();
+ if(jobRouteLocationSphere != null) {
+ if(getDistance(position, jobRouteLocationSphere.position) <= 2.0) {
+ enteredJobRouteSphere();
+ }
+ }
+ }
}
// ===========================================================================
function forceLocalPlayerEquippedWeaponItem() {
- if(typeof localPlayer.weapon != "undefined") {
- if(forceWeapon != 0) {
- if(localPlayer.weapon != forceWeapon) {
- localPlayer.weapon = forceWeapon;
- if(getGame() < VRR_GAME_GTA_IV) {
- localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
- localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
- }
- } else {
- if(getGame() < VRR_GAME_GTA_IV) {
- forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
- forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
- }
- }
- } else {
- if(localPlayer.weapon > 0) {
- localPlayer.clearWeapons();
- }
- }
- }
+ if(typeof localPlayer.weapon != "undefined") {
+ if(forceWeapon != 0) {
+ if(localPlayer.weapon != forceWeapon) {
+ localPlayer.weapon = forceWeapon;
+ if(getGame() < VRR_GAME_GTA_IV) {
+ localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
+ localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
+ }
+ } else {
+ if(getGame() < VRR_GAME_GTA_IV) {
+ forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
+ forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
+ }
+ }
+ } else {
+ if(localPlayer.weapon > 0) {
+ localPlayer.clearWeapons();
+ }
+ }
+ }
}
// ===========================================================================
function getLocalPlayerPosition() {
- let position = localPlayer.position;
- if(localPlayer.vehicle) {
- position = localPlayer.vehicle.position;
- }
+ let position = localPlayer.position;
+ if(localPlayer.vehicle) {
+ position = localPlayer.vehicle.position;
+ }
- return position;
+ return position;
}
// ===========================================================================
function processLocalPlayerVehicleEntryExitHandling() {
- if(localPlayer.vehicle) {
- if(!inVehicle) {
- inVehicle = localPlayer.vehicle;
- inVehicleSeat = getLocalPlayerVehicleSeat();
- triggerEvent("OnLocalPlayerEnteredVehicle", inVehicle, inVehicleSeat);
- }
- } else {
- if(inVehicle) {
- triggerEvent("OnLocalPlayerExitedVehicle", inVehicle, inVehicleSeat);
- inVehicle = false;
- inVehicleSeat = false;
- }
- }
+ if(localPlayer.vehicle) {
+ if(!inVehicle) {
+ inVehicle = localPlayer.vehicle;
+ inVehicleSeat = getLocalPlayerVehicleSeat();
+ triggerEvent("OnLocalPlayerEnteredVehicle", inVehicle, inVehicleSeat);
+ }
+ } else {
+ if(inVehicle) {
+ triggerEvent("OnLocalPlayerExitedVehicle", inVehicle, inVehicleSeat);
+ inVehicle = false;
+ inVehicleSeat = false;
+ }
+ }
}
// ===========================================================================
function getVehicleForNetworkEvent(vehicle) {
- if(getGame() == VRR_GAME_GTA_IV) {
- return natives.getNetworkIdFromVehicle(vehicle);
- }
- return vehicle;
+ if(getGame() == VRR_GAME_GTA_IV) {
+ return natives.getNetworkIdFromVehicle(vehicle);
+ }
+ return vehicle;
}
// ===========================================================================
function setMinuteDuration(minuteDuration) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
+ logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
- if(isTimeSupported()) {
- game.time.minuteDuration = minuteDuration;
- }
+ if(isTimeSupported()) {
+ game.time.minuteDuration = minuteDuration;
+ }
}
// ===========================================================================
function getStreamingRadioVolumeForPosition(position) {
- return streamingRadioVolume;
+ return streamingRadioVolume;
}
// ===========================================================================
function getLocalPlayerLookAtPosition() {
- if(localPlayer != null) {
+ if(localPlayer != null) {
let centerCameraPos = getWorldFromScreenPosition(toVector3(game.width/2, game.height/2, 0));
return getWorldFromScreenPosition(toVector3(game.width/2, game.height/2, getDistance(centerCameraPos, localPlayer.position)+20));
}
@@ -721,11 +723,11 @@ function getLocalPlayerLookAtPosition() {
// ===========================================================================
function processInteriorLightsRendering() {
- if(renderInteriorLights) {
- if(!interiorLightsEnabled) {
- graphics.drawRectangle(null, toVector2(0.0, 0.0), toVector2(game.width, game.height), interiorLightsColour, interiorLightsColour, interiorLightsColour, interiorLightsColour);
- }
- }
+ if(renderInteriorLights) {
+ if(!interiorLightsEnabled) {
+ graphics.drawRectangle(null, toVector2(0.0, 0.0), toVector2(game.width, game.height), interiorLightsColour, interiorLightsColour, interiorLightsColour, interiorLightsColour);
+ }
+ }
}
// ===========================================================================
@@ -752,80 +754,80 @@ function getPlayerFromParams(params) {
// ===========================================================================
function processNearbyPickups() {
- if(typeof ELEMENT_PICKUP != "undefined") {
- let pickups = getElementsByType(ELEMENT_PICKUP);
- for(let i in pickups) {
- if(getDistance(pickups[i].position, localPlayer.position) < 5) {
- //if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
- if(currentPickup != pickups[i]) {
- currentPickup = pickups[i];
- sendNetworkEventToServer("vrr.pickup", pickups[i].id);
- }
- //}
- }
- }
- }
+ if(typeof ELEMENT_PICKUP != "undefined") {
+ let pickups = getElementsByType(ELEMENT_PICKUP);
+ for(let i in pickups) {
+ if(getDistance(pickups[i].position, localPlayer.position) < 5) {
+ //if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
+ if(currentPickup != pickups[i]) {
+ currentPickup = pickups[i];
+ sendNetworkEventToServer("vrr.pickup", pickups[i].id);
+ }
+ //}
+ }
+ }
+ }
}
// ===========================================================================
function processGameSpecifics() {
- if(game.game < VRR_GAME_GTA_IV) {
- game.clearMessages();
- }
+ if(game.game < VRR_GAME_GTA_IV) {
+ game.clearMessages();
+ }
- destroyAutoCreatedPickups();
+ destroyAutoCreatedPickups();
}
// ===========================================================================
function processVehiclePurchasing() {
- if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
- if(inVehicle == false) {
- vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
- sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
- return false;
- } else {
- if(vehiclePurchasing == inVehicle) {
- if(getDistance(inVehicle.position, vehiclePurchasePosition) >= 25) {
- vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
- sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
- }
- } else {
- vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
- sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
- }
- }
- }
+ if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
+ if(inVehicle == false) {
+ vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
+ sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
+ return false;
+ } else {
+ if(vehiclePurchasing == inVehicle) {
+ if(getDistance(inVehicle.position, vehiclePurchasePosition) >= 25) {
+ vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
+ sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
+ }
+ } else {
+ vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
+ sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
+ }
+ }
+ }
}
// ===========================================================================
function setVehiclePurchaseState(state, vehicleId, position) {
- vehiclePurchaseState = state;
+ vehiclePurchaseState = state;
- if(vehicleId != null) {
- vehiclePurchasing = getElementFromId(vehicleId);
- } else {
- vehiclePurchasing = null;
- }
+ if(vehicleId != null) {
+ vehiclePurchasing = getElementFromId(vehicleId);
+ } else {
+ vehiclePurchasing = null;
+ }
- vehiclePurchasePosition = position;
+ vehiclePurchasePosition = position;
}
// ===========================================================================
function processVehicleFires() {
- let vehicles = getElementsByType(ELEMENT_VEHICLE);
- for(let i in vehicles) {
- if(vehicles[i].isSyncer) {
- if(!doesEntityDataExist(vehicles[i], "vrr.fire")) {
- triggerNetworkEvent("vrr.vehFire", vehicles[i].id);
- } else {
- vehicles[i].health = 249;
- }
- }
- }
+ let vehicles = getElementsByType(ELEMENT_VEHICLE);
+ for(let i in vehicles) {
+ if(vehicles[i].isSyncer) {
+ if(!doesEntityDataExist(vehicles[i], "vrr.fire")) {
+ triggerNetworkEvent("vrr.vehFire", vehicles[i].id);
+ } else {
+ vehicles[i].health = 249;
+ }
+ }
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/accent.js b/scripts/server/accent.js
index 41cea951..30697e45 100644
--- a/scripts/server/accent.js
+++ b/scripts/server/accent.js
@@ -8,30 +8,30 @@
// ===========================================================================
function getPlayerAccentText(client) {
- return getPlayerCurrentSubAccount(client).accent;
+ return getPlayerCurrentSubAccount(client).accent;
}
// ===========================================================================
function setPlayerAccentText(client, text) {
- getPlayerCurrentSubAccount(client).accent = text;
+ getPlayerCurrentSubAccount(client).accent = text;
}
// ===========================================================================
function doesPlayerHaveAccent(client) {
- return (getPlayerCurrentSubAccount(client).accent != "");
+ return (getPlayerCurrentSubAccount(client).accent != "");
}
// ===========================================================================
function getPlayerAccentInlineOutput(client) {
- let outputText = "";
- if(doesPlayerHaveAccent(client)) {
- outputText = `[${getPlayerAccentText(client)}] `;
- }
+ let outputText = "";
+ if(doesPlayerHaveAccent(client)) {
+ outputText = `[${getPlayerAccentText(client)}] `;
+ }
- return outputText;
+ return outputText;
}
// ===========================================================================
diff --git a/scripts/server/account.js b/scripts/server/account.js
index ebead70e..aa125ce1 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -581,7 +581,7 @@ function loginSuccess(client) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
- }
+ }
}
}
@@ -948,7 +948,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode);
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
- }
+ }
if(doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
setTimeout(function() {
@@ -963,7 +963,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
- }
+ }
} else {
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index 4c18f00f..86556bb0 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -21,7 +21,7 @@ function playPlayerAnimationCommand(command, params, client) {
}
let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
- let animationPositionOffset = 1;
+ let animationPositionOffset = 1;
if(!animationSlot) {
messagePlayerError(client, getLocaleString(client, "AnimationNotFound"));
@@ -61,7 +61,7 @@ function stopPlayerAnimationCommand(command, params, client) {
getPlayerData(client).currentAnimation = -1;
getPlayerData(client).currentAnimationPositionOffset = false;
getPlayerData(client).currentAnimationPositionReturnTo = false;
- getPlayerData(client).animationStart = 0;
+ getPlayerData(client).animationStart = 0;
getPlayerData(client).animationForced = false;
setPlayerMouseCameraState(client, false);
@@ -88,7 +88,7 @@ function showAnimationListCommand(command, params, client) {
* @return {Array} The animation's data (array)
*/
function getAnimationData(animationSlot, gameId = getServerGame()) {
- return getGameConfig().animations[gameId][animationSlot];
+ return getGameConfig().animations[gameId][animationSlot];
}
// ===========================================================================
@@ -100,13 +100,13 @@ function isPlayerInForcedAnimation(client) {
// ===========================================================================
function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
- getPlayerData(client).currentAnimation = animationSlot;
+ getPlayerData(client).currentAnimation = animationSlot;
getPlayerData(client).currentAnimationPositionOffset = offsetPosition;
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
- getPlayerData(client).animationStart = getCurrentUnixTimestamp();
+ getPlayerData(client).animationStart = getCurrentUnixTimestamp();
getPlayerData(client).animationForced = false;
- makePedPlayAnimation(getPlayerData(client).ped, animationSlot, offsetPosition);
+ makePedPlayAnimation(getPlayerData(client).ped, animationSlot, offsetPosition);
//if(getAnimationData(animationSlot)[9] != VRR_ANIMMOVE_NONE) {
// if(getGame() < VRR_GAME_GTA_SA) {
@@ -118,10 +118,10 @@ function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
// ===========================================================================
function forcePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
- getPlayerData(client).currentAnimation = animationSlot;
+ getPlayerData(client).currentAnimation = animationSlot;
getPlayerData(client).currentAnimationPositionOffset = offsetPosition;
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
- getPlayerData(client).animationStart = getCurrentUnixTimestamp();
+ getPlayerData(client).animationStart = getCurrentUnixTimestamp();
getPlayerData(client).animationForced = true;
setPlayerControlState(client, false);
@@ -137,7 +137,7 @@ function makePlayerStopAnimation(client) {
getPlayerData(client).currentAnimation = -1;
getPlayerData(client).currentAnimationPositionOffset = false;
getPlayerData(client).currentAnimationPositionReturnTo = false;
- getPlayerData(client).animationStart = 0;
+ getPlayerData(client).animationStart = 0;
getPlayerData(client).animationForced = false;
}
diff --git a/scripts/server/anticheat.js b/scripts/server/anticheat.js
index 38ff2b63..9cf7fafb 100644
--- a/scripts/server/anticheat.js
+++ b/scripts/server/anticheat.js
@@ -8,14 +8,14 @@
// ===========================================================================
function initAntiCheatScript() {
- logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
+ logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
}
// ===========================================================================
function clearPlayerStateToEnterExitProperty(client) {
- if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
+ if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
if(getPlayerData(client).pedState == VRR_PEDSTATE_ENTERINGVEHICLE) {
sendPlayerClearPedState(client);
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
diff --git a/scripts/server/ban.js b/scripts/server/ban.js
index cfd6154b..fc4db510 100644
--- a/scripts/server/ban.js
+++ b/scripts/server/ban.js
@@ -10,8 +10,8 @@
// ===========================================================================
function initBanScript() {
- logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
- logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
+ logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
+ logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
}
// ===========================================================================
@@ -22,22 +22,22 @@ function accountBanCommand(command, params, client) {
return false;
}
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let reason = splitParams.slice(1).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let reason = splitParams.slice(1).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
-
- // Prevent banning admins with really high permissions
- if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
- messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
- return false;
+ if(!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
}
- logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
+ // Prevent banning admins with really high permissions
+ if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
+ messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
+ return false;
+ }
+
+ logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been account banned.`);
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
@@ -52,27 +52,27 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
return false;
}
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let reason = splitParams.slice(1).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let reason = splitParams.slice(1).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
+ if(!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
+ }
// Prevent banning admins with really high permissions
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
return false;
- }
+ }
- logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
+ logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been character banned.`);
- banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
+ banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
- disconnectPlayer(client);
+ disconnectPlayer(client);
}
// ===========================================================================
@@ -81,28 +81,28 @@ function ipBanCommand(command, params, client, fromDiscord) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
- }
+ }
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let reason = splitParams.slice(1).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let reason = splitParams.slice(1).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
+ if(!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
+ }
// Prevent banning admins with really high permissions
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
return false;
- }
+ }
- messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
- banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
+ messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
+ banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
- server.banIP(targetClient.ip);
- targetClient.disconnect();
+ server.banIP(targetClient.ip);
+ targetClient.disconnect();
}
// ===========================================================================
@@ -111,190 +111,189 @@ function subNetBanCommand(command, params, client, fromDiscord) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
- }
+ }
- let splitParams = params.split(" ");
- let targetClient = getPlayerFromParams(getParam(params, " ", 1));
- let octetAmount = Number(getParam(params, " ", 2));
- let reason = splitParams.slice(2).join(" ");
+ let splitParams = params.split(" ");
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let octetAmount = Number(getParam(params, " ", 2));
+ let reason = splitParams.slice(2).join(" ");
- if(!targetClient) {
- messagePlayerError(client, "That player is not connected!")
- return false;
- }
+ if(!targetClient) {
+ messagePlayerError(client, "That player is not connected!")
+ return false;
+ }
// Prevent banning admins with really high permissions
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
return false;
- }
+ }
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been subnet banned`);
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
- server.banIP(targetClient.ip);
+ server.banIP(targetClient.ip);
}
// ===========================================================================
function banAccount(accountId, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function banSubAccount(subAccountId, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function banIPAddress(ipAddress, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let safeReason = dbConnection.escapetoString(reason);
- let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let safeReason = dbConnection.escapetoString(reason);
+ let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanAccount(accountId, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanSubAccount(subAccountId, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanIPAddress(ipAddress, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
- let dbConnection = connectToDatabase();
- if(dbConnection) {
- let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
- freeDatabaseQuery(dbQuery);
- dbConnection.close();
- return true;
- }
+ let dbConnection = connectToDatabase();
+ if(dbConnection) {
+ let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
+ freeDatabaseQuery(dbQuery);
+ dbConnection.close();
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function isAccountBanned(accountId) {
- let bans = getServerData().bans;
- for(let i in bans) {
- if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
- if(bans[i].detail == accountId) {
- return true;
- }
- }
- }
+ let bans = getServerData().bans;
+ for(let i in bans) {
+ if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
+ if(bans[i].detail == accountId) {
+ return true;
+ }
+ }
+ }
- return false;
+ return false;
}
// ===========================================================================
function isSubAccountBanned(subAccountId) {
- let bans = getServerData().bans;
- for(let i in bans) {
- if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
- if(bans[i].detail == subAccountId) {
- return true;
- }
- }
- }
+ let bans = getServerData().bans;
+ for(let i in bans) {
+ if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
+ if(bans[i].detail == subAccountId) {
+ return true;
+ }
+ }
+ }
- return false;
+ return false;
}
// ===========================================================================
function isIpAddressBanned(ipAddress) {
- let bans = getServerData().bans;
- for(let i in bans) {
- if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
- if(bans[i].detail == ipAddress) {
- return true;
- }
- }
- }
+ let bans = getServerData().bans;
+ for(let i in bans) {
+ if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
+ if(bans[i].detail == ipAddress) {
+ return true;
+ }
+ }
+ }
- return false;
+ return false;
}
// ===========================================================================
-
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index b095c2e8..cf97f612 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -311,15 +311,15 @@ function doesPlayerHaveStaffPermission(client, requiredFlags) {
}
// -1 is automatic override (having -1 for staff flags is basically god mode admin level)
- if(staffFlags == getStaffFlagValue("All")) {
- return true;
- }
+ if(staffFlags == getStaffFlagValue("All")) {
+ return true;
+ }
- if(hasBitFlag(staffFlags, requiredFlags)) {
- return true;
- }
+ if(hasBitFlag(staffFlags, requiredFlags)) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
@@ -341,22 +341,22 @@ function doesPlayerHaveClanPermission(client, requiredFlags) {
clanFlags = getPlayerCurrentSubAccount(client).clanFlags | getClanRankFlags(getPlayerCurrentSubAccount(client).clanRank);
// -1 is automatic override (having -1 for staff flags is basically god mode admin level)
- if(clanFlags == getClanFlagValue("All")) {
- return true;
- }
+ if(clanFlags == getClanFlagValue("All")) {
+ return true;
+ }
- if(hasBitFlag(clanFlags, requiredFlags)) {
- return true;
- }
+ if(hasBitFlag(clanFlags, requiredFlags)) {
+ return true;
+ }
- return false;
+ return false;
}
// ===========================================================================
function getStaffFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.staffFlags[flagName] == "undefined") {
@@ -369,8 +369,8 @@ function getStaffFlagValue(flagName) {
// ===========================================================================
function getClanFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof getServerBitFlags().clanFlags[flagName] == "undefined") {
@@ -383,8 +383,8 @@ function getClanFlagValue(flagName) {
// ===========================================================================
function getAccountSettingsFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.accountSettingsFlags[flagName] == "undefined") {
@@ -397,8 +397,8 @@ function getAccountSettingsFlagValue(flagName) {
// ===========================================================================
function getModerationFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.moderationFlags[flagName] == "undefined") {
@@ -411,8 +411,8 @@ function getModerationFlagValue(flagName) {
// ===========================================================================
function getServerSettingsFlagValue(flagName) {
- if(flagName == "All") {
- return -1;
+ if(flagName == "All") {
+ return -1;
}
if(typeof serverBitFlags.serverSettings[flagName] == "undefined") {
diff --git a/scripts/server/business.js b/scripts/server/business.js
index cfaccd8e..35ca8d37 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -1251,9 +1251,9 @@ function saveAllBusinessesToDatabase() {
function saveBusinessToDatabase(businessId) {
let tempBusinessData = getServerData().businesses[businessId];
- if(!tempBusinessData.needsSaved) {
- return false;
- }
+ if(!tempBusinessData.needsSaved) {
+ return false;
+ }
logToConsole(LOG_DEBUG, `[VRR.Business]: Saving business '${tempBusinessData.name}' to database ...`);
let dbConnection = connectToDatabase();
@@ -1344,7 +1344,7 @@ function createAllBusinessBlips() {
// ===========================================================================
-function createBusinessEntrancePickup(businessId) {
+function createBusinessEntrancePickup(businessId) {
if(!getServerConfig().createBusinessPickups) {
return false;
}
@@ -1357,7 +1357,7 @@ function createBusinessEntrancePickup(businessId) {
}
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
-
+
if(areServerElementsSupported()) {
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
@@ -1389,7 +1389,7 @@ function createBusinessEntranceBlip(businessId) {
}
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
-
+
if(areServerElementsSupported()) {
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
@@ -1417,7 +1417,7 @@ function createBusinessExitPickup(businessId) {
}
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
-
+
if(areServerElementsSupported()) {
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
@@ -2214,17 +2214,17 @@ function getBusinessFromParams(params) {
// ===========================================================================
function deleteAllBusinessBlips() {
- for(let i in getServerData().businesses) {
- deleteBusinessBlips(i);
- }
+ for(let i in getServerData().businesses) {
+ deleteBusinessBlips(i);
+ }
}
// ===========================================================================
function deleteAllBusinessPickups() {
- for(let i in getServerData().businesses) {
- deleteBusinessPickups(i);
- }
+ for(let i in getServerData().businesses) {
+ deleteBusinessPickups(i);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/business/casino.js b/scripts/server/business/casino.js
index 7317cf7f..a9cd5d43 100644
--- a/scripts/server/business/casino.js
+++ b/scripts/server/business/casino.js
@@ -8,60 +8,60 @@
// ===========================================================================
let deckCards = [
- DeckCardData("deckCardSpadeAce", VRR_DECKCARD_SUIT_SPADE, 1),
- DeckCardData("deckCardSpade2", VRR_DECKCARD_SUIT_SPADE, 2),
- DeckCardData("deckCardSpade3", VRR_DECKCARD_SUIT_SPADE, 3),
- DeckCardData("deckCardSpade4", VRR_DECKCARD_SUIT_SPADE, 4),
- DeckCardData("deckCardSpade5", VRR_DECKCARD_SUIT_SPADE, 5),
- DeckCardData("deckCardSpade6", VRR_DECKCARD_SUIT_SPADE, 6),
- DeckCardData("deckCardSpade7", VRR_DECKCARD_SUIT_SPADE, 7),
- DeckCardData("deckCardSpade8", VRR_DECKCARD_SUIT_SPADE, 8),
- DeckCardData("deckCardSpade9", VRR_DECKCARD_SUIT_SPADE, 9),
- DeckCardData("deckCardSpade10", VRR_DECKCARD_SUIT_SPADE, 10),
- DeckCardData("deckCardSpadeJack", VRR_DECKCARD_SUIT_SPADE, 11),
- DeckCardData("deckCardSpadeQueen", VRR_DECKCARD_SUIT_SPADE, 12),
- DeckCardData("deckCardSpadeKing", VRR_DECKCARD_SUIT_SPADE, 13),
- DeckCardData("deckCardClubAce", VRR_DECKCARD_SUIT_CLUB, 1),
- DeckCardData("deckCardClub2", VRR_DECKCARD_SUIT_CLUB, 2),
- DeckCardData("deckCardClub3", VRR_DECKCARD_SUIT_CLUB, 3),
- DeckCardData("deckCardClub4", VRR_DECKCARD_SUIT_CLUB, 4),
- DeckCardData("deckCardClub5", VRR_DECKCARD_SUIT_CLUB, 5),
- DeckCardData("deckCardClub6", VRR_DECKCARD_SUIT_CLUB, 6),
- DeckCardData("deckCardClub7", VRR_DECKCARD_SUIT_CLUB, 7),
- DeckCardData("deckCardClub8", VRR_DECKCARD_SUIT_CLUB, 8),
- DeckCardData("deckCardClub9", VRR_DECKCARD_SUIT_CLUB, 9),
- DeckCardData("deckCardClub10", VRR_DECKCARD_SUIT_CLUB, 10),
- DeckCardData("deckCardClubJack", VRR_DECKCARD_SUIT_CLUB, 11),
- DeckCardData("deckCardClubQueen", VRR_DECKCARD_SUIT_CLUB, 12),
- DeckCardData("deckCardClubKing", VRR_DECKCARD_SUIT_CLUB, 13),
- DeckCardData("deckCardHeartAce", VRR_DECKCARD_SUIT_HEART, 1),
- DeckCardData("deckCardHeart2", VRR_DECKCARD_SUIT_HEART, 2),
- DeckCardData("deckCardHeart3", VRR_DECKCARD_SUIT_HEART, 3),
- DeckCardData("deckCardHeart4", VRR_DECKCARD_SUIT_HEART, 4),
- DeckCardData("deckCardHeart5", VRR_DECKCARD_SUIT_HEART, 5),
- DeckCardData("deckCardHeart6", VRR_DECKCARD_SUIT_HEART, 6),
- DeckCardData("deckCardHeart7", VRR_DECKCARD_SUIT_HEART, 7),
- DeckCardData("deckCardHeart8", VRR_DECKCARD_SUIT_HEART, 8),
- DeckCardData("deckCardHeart9", VRR_DECKCARD_SUIT_HEART, 9),
- DeckCardData("deckCardHeart10", VRR_DECKCARD_SUIT_HEART, 10),
- DeckCardData("deckCardHeartJack", VRR_DECKCARD_SUIT_HEART, 11),
- DeckCardData("deckCardHeartQueen", VRR_DECKCARD_SUIT_HEART, 12),
- DeckCardData("deckCardHeartKing", VRR_DECKCARD_SUIT_HEART, 13),
- DeckCardData("deckCardDiamondAce", VRR_DECKCARD_SUIT_DIAMOND, 1),
- DeckCardData("deckCardDiamond2", VRR_DECKCARD_SUIT_DIAMOND, 2),
- DeckCardData("deckCardDiamond3", VRR_DECKCARD_SUIT_DIAMOND, 3),
- DeckCardData("deckCardDiamond4", VRR_DECKCARD_SUIT_DIAMOND, 4),
- DeckCardData("deckCardDiamond5", VRR_DECKCARD_SUIT_DIAMOND, 5),
- DeckCardData("deckCardDiamond6", VRR_DECKCARD_SUIT_DIAMOND, 6),
- DeckCardData("deckCardDiamond7", VRR_DECKCARD_SUIT_DIAMOND, 7),
- DeckCardData("deckCardDiamond8", VRR_DECKCARD_SUIT_DIAMOND, 8),
- DeckCardData("deckCardDiamond9", VRR_DECKCARD_SUIT_DIAMOND, 9),
- DeckCardData( "deckCardDiamond10", VRR_DECKCARD_SUIT_DIAMOND, 10),
- DeckCardData("deckCardDiamondJack", VRR_DECKCARD_SUIT_DIAMOND, 11),
- DeckCardData("deckCardDiamondQueen", VRR_DECKCARD_SUIT_DIAMOND, 12),
- DeckCardData("deckCardDiamondKing", VRR_DECKCARD_SUIT_DIAMOND, 13),
+ DeckCardData("deckCardSpadeAce", VRR_DECKCARD_SUIT_SPADE, 1),
+ DeckCardData("deckCardSpade2", VRR_DECKCARD_SUIT_SPADE, 2),
+ DeckCardData("deckCardSpade3", VRR_DECKCARD_SUIT_SPADE, 3),
+ DeckCardData("deckCardSpade4", VRR_DECKCARD_SUIT_SPADE, 4),
+ DeckCardData("deckCardSpade5", VRR_DECKCARD_SUIT_SPADE, 5),
+ DeckCardData("deckCardSpade6", VRR_DECKCARD_SUIT_SPADE, 6),
+ DeckCardData("deckCardSpade7", VRR_DECKCARD_SUIT_SPADE, 7),
+ DeckCardData("deckCardSpade8", VRR_DECKCARD_SUIT_SPADE, 8),
+ DeckCardData("deckCardSpade9", VRR_DECKCARD_SUIT_SPADE, 9),
+ DeckCardData("deckCardSpade10", VRR_DECKCARD_SUIT_SPADE, 10),
+ DeckCardData("deckCardSpadeJack", VRR_DECKCARD_SUIT_SPADE, 11),
+ DeckCardData("deckCardSpadeQueen", VRR_DECKCARD_SUIT_SPADE, 12),
+ DeckCardData("deckCardSpadeKing", VRR_DECKCARD_SUIT_SPADE, 13),
+ DeckCardData("deckCardClubAce", VRR_DECKCARD_SUIT_CLUB, 1),
+ DeckCardData("deckCardClub2", VRR_DECKCARD_SUIT_CLUB, 2),
+ DeckCardData("deckCardClub3", VRR_DECKCARD_SUIT_CLUB, 3),
+ DeckCardData("deckCardClub4", VRR_DECKCARD_SUIT_CLUB, 4),
+ DeckCardData("deckCardClub5", VRR_DECKCARD_SUIT_CLUB, 5),
+ DeckCardData("deckCardClub6", VRR_DECKCARD_SUIT_CLUB, 6),
+ DeckCardData("deckCardClub7", VRR_DECKCARD_SUIT_CLUB, 7),
+ DeckCardData("deckCardClub8", VRR_DECKCARD_SUIT_CLUB, 8),
+ DeckCardData("deckCardClub9", VRR_DECKCARD_SUIT_CLUB, 9),
+ DeckCardData("deckCardClub10", VRR_DECKCARD_SUIT_CLUB, 10),
+ DeckCardData("deckCardClubJack", VRR_DECKCARD_SUIT_CLUB, 11),
+ DeckCardData("deckCardClubQueen", VRR_DECKCARD_SUIT_CLUB, 12),
+ DeckCardData("deckCardClubKing", VRR_DECKCARD_SUIT_CLUB, 13),
+ DeckCardData("deckCardHeartAce", VRR_DECKCARD_SUIT_HEART, 1),
+ DeckCardData("deckCardHeart2", VRR_DECKCARD_SUIT_HEART, 2),
+ DeckCardData("deckCardHeart3", VRR_DECKCARD_SUIT_HEART, 3),
+ DeckCardData("deckCardHeart4", VRR_DECKCARD_SUIT_HEART, 4),
+ DeckCardData("deckCardHeart5", VRR_DECKCARD_SUIT_HEART, 5),
+ DeckCardData("deckCardHeart6", VRR_DECKCARD_SUIT_HEART, 6),
+ DeckCardData("deckCardHeart7", VRR_DECKCARD_SUIT_HEART, 7),
+ DeckCardData("deckCardHeart8", VRR_DECKCARD_SUIT_HEART, 8),
+ DeckCardData("deckCardHeart9", VRR_DECKCARD_SUIT_HEART, 9),
+ DeckCardData("deckCardHeart10", VRR_DECKCARD_SUIT_HEART, 10),
+ DeckCardData("deckCardHeartJack", VRR_DECKCARD_SUIT_HEART, 11),
+ DeckCardData("deckCardHeartQueen", VRR_DECKCARD_SUIT_HEART, 12),
+ DeckCardData("deckCardHeartKing", VRR_DECKCARD_SUIT_HEART, 13),
+ DeckCardData("deckCardDiamondAce", VRR_DECKCARD_SUIT_DIAMOND, 1),
+ DeckCardData("deckCardDiamond2", VRR_DECKCARD_SUIT_DIAMOND, 2),
+ DeckCardData("deckCardDiamond3", VRR_DECKCARD_SUIT_DIAMOND, 3),
+ DeckCardData("deckCardDiamond4", VRR_DECKCARD_SUIT_DIAMOND, 4),
+ DeckCardData("deckCardDiamond5", VRR_DECKCARD_SUIT_DIAMOND, 5),
+ DeckCardData("deckCardDiamond6", VRR_DECKCARD_SUIT_DIAMOND, 6),
+ DeckCardData("deckCardDiamond7", VRR_DECKCARD_SUIT_DIAMOND, 7),
+ DeckCardData("deckCardDiamond8", VRR_DECKCARD_SUIT_DIAMOND, 8),
+ DeckCardData("deckCardDiamond9", VRR_DECKCARD_SUIT_DIAMOND, 9),
+ DeckCardData( "deckCardDiamond10", VRR_DECKCARD_SUIT_DIAMOND, 10),
+ DeckCardData("deckCardDiamondJack", VRR_DECKCARD_SUIT_DIAMOND, 11),
+ DeckCardData("deckCardDiamondQueen", VRR_DECKCARD_SUIT_DIAMOND, 12),
+ DeckCardData("deckCardDiamondKing", VRR_DECKCARD_SUIT_DIAMOND, 13),
];
let deckCardBacks = [
-]
\ No newline at end of file
+];
\ No newline at end of file
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index 554dbeaa..171775f9 100644
--- a/scripts/server/chat.js
+++ b/scripts/server/chat.js
@@ -42,9 +42,9 @@ function processPlayerChat(client, messageText) {
} else {
messagePlayerNormal(null, `๐ก๏ธ (ADMIN) - ${messageText}`);
}
-
- /*
- let clients = getClients();
+
+ /*
+ let clients = getClients();
for(let i in clients) {
let translatedText;
translatedText = await translateMessage(messageText, getPlayerData(client).locale, getPlayerData(clients[i]).locale);
@@ -52,9 +52,9 @@ function processPlayerChat(client, messageText) {
let original = (getPlayerData(client).locale == getPlayerData(clients[i]).locale) ? `` : ` {ALTCOLOUR}(${messageText})`;
messagePlayerNormal(clients[i], `๐ฌ ${getCharacterFullName(client)}: [#FFFFFF]${translatedText}${original}`, clients[i], getColourByName("mediumGrey"));
}
- */
-
- //messageDiscordChatChannel(`๐ฌ ${getCharacterFullName(client)}: ${messageText}`);
+ */
+
+ //messageDiscordChatChannel(`๐ฌ ${getCharacterFullName(client)}: ${messageText}`);
}
// ===========================================================================
diff --git a/scripts/server/clan.js b/scripts/server/clan.js
index 0155dd4d..375cbe6c 100644
--- a/scripts/server/clan.js
+++ b/scripts/server/clan.js
@@ -948,9 +948,9 @@ function saveClanToDatabase(clanId) {
return false;
}
- if(!tempClanData.needsSaved) {
- return false;
- }
+ if(!tempClanData.needsSaved) {
+ return false;
+ }
let dbConnection = connectToDatabase();
if(dbConnection) {
@@ -994,41 +994,41 @@ function saveClanToDatabase(clanId) {
function saveClanRankToDatabase(clanId, rankId) {
let tempClanRankData = getClanRankData(clanId, rankId);
- if(!tempClanRankData.needsSaved) {
- return false;
- }
+ if(!tempClanRankData.needsSaved) {
+ return false;
+ }
let dbConnection = connectToDatabase();
if(dbConnection) {
- let safeName = escapeDatabaseString(dbConnection, tempClanRankData.name);
- let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag);
- //let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.name);
+ let safeName = escapeDatabaseString(dbConnection, tempClanRankData.name);
+ let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag);
+ //let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.name);
- let data = [
- ["clan_rank_name", safeName],
- ["clan_rank_clan", tempClanRankData.clan],
- ["clan_rank_custom_tag", safeTag],
- //["clan_rank_title", safeTitle],
- ["clan_rank_flags", tempClanRankData.flags],
- ["clan_rank_level", tempClanRankData.level],
- ["clan_rank_enabled", boolToInt(tempClanRankData.enabled)],
- ];
+ let data = [
+ ["clan_rank_name", safeName],
+ ["clan_rank_clan", tempClanRankData.clan],
+ ["clan_rank_custom_tag", safeTag],
+ //["clan_rank_title", safeTitle],
+ ["clan_rank_flags", tempClanRankData.flags],
+ ["clan_rank_level", tempClanRankData.level],
+ ["clan_rank_enabled", boolToInt(tempClanRankData.enabled)],
+ ];
- let dbQuery = null;
- if(tempClanRankData.databaseId == 0) {
- let queryString = createDatabaseInsertQuery("clan_rank", data);
- dbQuery = queryDatabase(dbConnection, queryString);
- getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection);
- getClanRankData(clanId, rankId).needsSaved = false;
- } else {
- let queryString = createDatabaseUpdateQuery("clan_rank", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`);
- dbQuery = queryDatabase(dbConnection, queryString);
- getClanRankData(clanId, rankId).needsSaved = false;
- }
+ let dbQuery = null;
+ if(tempClanRankData.databaseId == 0) {
+ let queryString = createDatabaseInsertQuery("clan_rank", data);
+ dbQuery = queryDatabase(dbConnection, queryString);
+ getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection);
+ getClanRankData(clanId, rankId).needsSaved = false;
+ } else {
+ let queryString = createDatabaseUpdateQuery("clan_rank", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`);
+ dbQuery = queryDatabase(dbConnection, queryString);
+ getClanRankData(clanId, rankId).needsSaved = false;
+ }
- freeDatabaseQuery(dbQuery);
- disconnectFromDatabase(dbConnection);
- return true;
+ freeDatabaseQuery(dbQuery);
+ disconnectFromDatabase(dbConnection);
+ return true;
}
return false;
diff --git a/scripts/server/class.js b/scripts/server/class.js
index 011ceef4..0e2bcba9 100644
--- a/scripts/server/class.js
+++ b/scripts/server/class.js
@@ -241,7 +241,7 @@ class ClientData {
this.enteringVehicle = null;
this.customDisconnectReason = "";
-
+
this.interiorCutscene = "";
}
};
@@ -578,7 +578,7 @@ class BusinessData {
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
this.streamingRadioStation = toInteger(dbAssoc["biz_radiostation"]);
-
+
}
};
};
@@ -1721,7 +1721,7 @@ class JobRouteData {
this.pay = toInteger(dbAssoc["job_route_pay"]);
this.startMessage = toString(dbAssoc["job_route_start_msg"]);
this.finishMessage = toString(dbAssoc["job_route_finish_msg"]);
- this.locationArriveMessage = toString(dbAssoc["job_route_loc_arrive_msg"]);
+ this.locationArriveMessage = toString(dbAssoc["job_route_loc_arrive_msg"]);
this.locationNextMessage = toString(dbAssoc["job_route_loc_next_msg"]);
this.vehicleColour1 = toInteger(dbAssoc["job_route_veh_colour1"]);
this.vehicleColour2 = toInteger(dbAssoc["job_route_veh_colour2"]);
@@ -1737,7 +1737,7 @@ class JobRouteLocationData {
this.routeId = 0;
this.enabled = false;
this.index = -1;
- this.jobIndex = -1;
+ this.jobIndex = -1;
this.routeIndex = -1;
this.needsSaved = false;
this.position = toVector3(0.0, 0.0, 0.0);
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 3ec3f077..9bd36a65 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -8,95 +8,95 @@
// ===========================================================================
function initClientScript() {
- logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
- addAllNetworkHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Client]: Client script initialized!");
+ logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
+ addAllNetworkHandlers();
+ logToConsole(LOG_DEBUG, "[VRR.Client]: Client script initialized!");
}
// ===========================================================================
function addAllNetworkHandlers() {
- logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
+ logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
- // KeyBind
- addNetworkEventHandler("vrr.useKeyBind", playerUsedKeyBind);
+ // KeyBind
+ addNetworkEventHandler("vrr.useKeyBind", playerUsedKeyBind);
- // GUI
- addNetworkEventHandler("vrr.promptAnswerNo", playerPromptAnswerNo);
- addNetworkEventHandler("vrr.promptAnswerYes", playerPromptAnswerYes);
- addNetworkEventHandler("vrr.toggleGUI", playerToggledGUI);
- addNetworkEventHandler("vrr.2fa", checkPlayerTwoFactorAuthentication);
+ // GUI
+ addNetworkEventHandler("vrr.promptAnswerNo", playerPromptAnswerNo);
+ addNetworkEventHandler("vrr.promptAnswerYes", playerPromptAnswerYes);
+ addNetworkEventHandler("vrr.toggleGUI", playerToggledGUI);
+ addNetworkEventHandler("vrr.2fa", checkPlayerTwoFactorAuthentication);
- // AFK
- addNetworkEventHandler("vrr.afk", playerChangeAFKState);
+ // AFK
+ addNetworkEventHandler("vrr.afk", playerChangeAFKState);
- // Event
- addNetworkEventHandler("vrr.pickup", onPlayerNearPickup);
- addNetworkEventHandler("vrr.enteredSphere", onPlayerEnteredSphere);
- addNetworkEventHandler("vrr.exitedSphere", onPlayerExitedSphere);
- addNetworkEventHandler("vrr.playerDeath", onPlayerDeath);
- addNetworkEventHandler("vrr.onPlayerEnterVehicle", onPlayerEnteredVehicle);
- addNetworkEventHandler("vrr.onPlayerExitVehicle", onPlayerExitedVehicle);
+ // Event
+ addNetworkEventHandler("vrr.pickup", onPlayerNearPickup);
+ addNetworkEventHandler("vrr.enteredSphere", onPlayerEnteredSphere);
+ addNetworkEventHandler("vrr.exitedSphere", onPlayerExitedSphere);
+ addNetworkEventHandler("vrr.playerDeath", onPlayerDeath);
+ addNetworkEventHandler("vrr.onPlayerEnterVehicle", onPlayerEnteredVehicle);
+ addNetworkEventHandler("vrr.onPlayerExitVehicle", onPlayerExitedVehicle);
- // Job
- addNetworkEventHandler("vrr.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
+ // Job
+ addNetworkEventHandler("vrr.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
- // Client
- addNetworkEventHandler("vrr.clientReady", playerClientReady);
- addNetworkEventHandler("vrr.guiReady", playerGUIReady);
- addNetworkEventHandler("vrr.clientStarted", playerClientStarted);
- addNetworkEventHandler("vrr.clientStopped", playerClientStopped);
+ // Client
+ addNetworkEventHandler("vrr.clientReady", playerClientReady);
+ addNetworkEventHandler("vrr.guiReady", playerGUIReady);
+ addNetworkEventHandler("vrr.clientStarted", playerClientStarted);
+ addNetworkEventHandler("vrr.clientStopped", playerClientStopped);
- // Account
- addNetworkEventHandler("vrr.checkLogin", checkLogin);
- addNetworkEventHandler("vrr.checkRegistration", checkRegistration);
- addNetworkEventHandler("vrr.checkResetPassword", checkAccountResetPasswordRequest);
- addNetworkEventHandler("vrr.checkChangePassword", checkAccountChangePassword);
+ // Account
+ addNetworkEventHandler("vrr.checkLogin", checkLogin);
+ addNetworkEventHandler("vrr.checkRegistration", checkRegistration);
+ addNetworkEventHandler("vrr.checkResetPassword", checkAccountResetPasswordRequest);
+ addNetworkEventHandler("vrr.checkChangePassword", checkAccountChangePassword);
- // Developer
- addNetworkEventHandler("vrr.runCodeSuccess", clientRunCodeSuccess);
- addNetworkEventHandler("vrr.runCodeFail", clientRunCodeFail);
+ // Developer
+ addNetworkEventHandler("vrr.runCodeSuccess", clientRunCodeSuccess);
+ addNetworkEventHandler("vrr.runCodeFail", clientRunCodeFail);
- // SubAccount
- addNetworkEventHandler("vrr.checkNewCharacter", checkNewCharacter);
- addNetworkEventHandler("vrr.nextCharacter", checkNextCharacter);
- addNetworkEventHandler("vrr.previousCharacter", checkPreviousCharacter);
- addNetworkEventHandler("vrr.selectCharacter", selectCharacter);
+ // SubAccount
+ addNetworkEventHandler("vrr.checkNewCharacter", checkNewCharacter);
+ addNetworkEventHandler("vrr.nextCharacter", checkNextCharacter);
+ addNetworkEventHandler("vrr.previousCharacter", checkPreviousCharacter);
+ addNetworkEventHandler("vrr.selectCharacter", selectCharacter);
- // Item
- addNetworkEventHandler("vrr.itemActionDelayComplete", playerItemActionDelayComplete);
- addNetworkEventHandler("vrr.weaponDamage", playerDamagedByPlayer);
+ // Item
+ addNetworkEventHandler("vrr.itemActionDelayComplete", playerItemActionDelayComplete);
+ addNetworkEventHandler("vrr.weaponDamage", playerDamagedByPlayer);
- // Misc
- addNetworkEventHandler("vrr.plr.pos", updatePositionInPlayerData);
- addNetworkEventHandler("vrr.plr.rot", updateHeadingInPlayerData);
- addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
- addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
- addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
- addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
+ // Misc
+ addNetworkEventHandler("vrr.plr.pos", updatePositionInPlayerData);
+ addNetworkEventHandler("vrr.plr.rot", updateHeadingInPlayerData);
+ addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
+ addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
+ addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
+ addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
}
// ===========================================================================
function updatePlayerNameTag(client) {
- //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
+ //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
sendNetworkEventToPlayer("vrr.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
}
// ===========================================================================
function updateAllPlayerNameTags() {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated nametags to all players`);
- let clients = getClients();
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated nametags to all players`);
+ let clients = getClients();
for(let i in clients) {
- updatePlayerNameTag(clients[i]);
- }
+ updatePlayerNameTag(clients[i]);
+ }
}
// ===========================================================================
function updatePlayerPing(client) {
- //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
+ //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
sendNetworkEventToPlayer("vrr.ping", null, getPlayerName(client), client.ping);
}
@@ -114,7 +114,7 @@ function playerClientReady(client) {
function playerGUIReady(client) {
setEntityData(client, "vrr.guiReady", true, false);
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
+ logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
}
// ===========================================================================
@@ -130,37 +130,37 @@ function playerClientStarted(client) {
// ===========================================================================
function playerClientStopped(client) {
- logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
+ logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
client.disconnect();
}
// ===========================================================================
function showGameMessage(client, text, colour, duration) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
- sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
+ sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration);
}
// ===========================================================================
function enableCityAmbienceForPlayer(client, clearElements = false) {
- //if(server.getCVar("civilians") == false) {
- // return false;
- //}
+ //if(server.getCVar("civilians") == false) {
+ // return false;
+ //}
- //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
- //sendNetworkEventToPlayer("vrr.ambience", client, true);
+ //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
+ //sendNetworkEventToPlayer("vrr.ambience", client, true);
}
// ===========================================================================
function disableCityAmbienceForPlayer(client, clearElements = false) {
- //if(server.getCVar("civilians") == true) {
- // return false;
- //}
+ //if(server.getCVar("civilians") == true) {
+ // return false;
+ //}
- //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
- //sendNetworkEventToPlayer("vrr.ambience", client, false, clearElements);
+ //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
+ //sendNetworkEventToPlayer("vrr.ambience", client, false, clearElements);
}
// ===========================================================================
@@ -173,30 +173,30 @@ function clearPlayerOwnedPeds(client) {
// ===========================================================================
function updatePlayerSpawnedState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
- getPlayerData(client).spawned = true;
- sendNetworkEventToPlayer("vrr.spawned", client, state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
+ getPlayerData(client).spawned = true;
+ sendNetworkEventToPlayer("vrr.spawned", client, state);
}
// ===========================================================================
function setPlayerControlState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
- sendNetworkEventToPlayer("vrr.control", client, state, !state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
+ sendNetworkEventToPlayer("vrr.control", client, state, !state);
}
// ===========================================================================
function updatePlayerShowLogoState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
- sendNetworkEventToPlayer("vrr.logo", client, state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
+ sendNetworkEventToPlayer("vrr.logo", client, state);
}
// ===========================================================================
function restorePlayerCamera(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
- sendNetworkEventToPlayer("vrr.restoreCamera", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
+ sendNetworkEventToPlayer("vrr.restoreCamera", client);
}
// ===========================================================================
@@ -208,484 +208,484 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
// ===========================================================================
function syncPlayerProperties(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
- sendNetworkEventToPlayer("vrr.player.sync", null, client.player);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
+ sendNetworkEventToPlayer("vrr.player.sync", null, client.player);
}
// ===========================================================================
function updatePlayerSnowState(client) {
- if(isSnowSupported(getServerGame())) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
- sendNetworkEventToPlayer("vrr.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
- }
+ if(isSnowSupported(getServerGame())) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
+ sendNetworkEventToPlayer("vrr.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
+ }
}
// ===========================================================================
function updatePlayerHotBar(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
- let tempHotBarItems = [];
- for(let i in getPlayerData(client).hotBarItems) {
- let itemImage = "";
- let itemValue = 0;
- let itemExists = false;
- if(getPlayerData(client).hotBarItems[i] != -1) {
- if(getItemData(getPlayerData(client).hotBarItems[i])) {
- let itemData = getItemData(getPlayerData(client).hotBarItems[i]);
- let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
- itemExists = true;
- itemImage = itemTypeData.hotbarImage;
- itemValue = itemData.value;
- }
- }
- tempHotBarItems.push([i, itemExists, itemImage, itemValue]);
- }
- sendNetworkEventToPlayer("vrr.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
+ let tempHotBarItems = [];
+ for(let i in getPlayerData(client).hotBarItems) {
+ let itemImage = "";
+ let itemValue = 0;
+ let itemExists = false;
+ if(getPlayerData(client).hotBarItems[i] != -1) {
+ if(getItemData(getPlayerData(client).hotBarItems[i])) {
+ let itemData = getItemData(getPlayerData(client).hotBarItems[i]);
+ let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
+ itemExists = true;
+ itemImage = itemTypeData.hotbarImage;
+ itemValue = itemData.value;
+ }
+ }
+ tempHotBarItems.push([i, itemExists, itemImage, itemValue]);
+ }
+ sendNetworkEventToPlayer("vrr.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
}
// ===========================================================================
function setPlayerWeaponDamageEnabled(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
- sendNetworkEventToPlayer("vrr.weaponDamageEnabled", null, getPlayerName(client), state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
+ sendNetworkEventToPlayer("vrr.weaponDamageEnabled", null, getPlayerName(client), state);
}
// ===========================================================================
function setPlayerWeaponDamageEvent(client, eventType) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
- sendNetworkEventToPlayer("vrr.weaponDamageEvent", null, getPlayerName(client), eventType);
- getPlayerData(client).weaponDamageEvent = eventType;
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
+ sendNetworkEventToPlayer("vrr.weaponDamageEvent", null, getPlayerName(client), eventType);
+ getPlayerData(client).weaponDamageEvent = eventType;
}
// ===========================================================================
function sendJobRouteLocationToPlayer(client, position, colour) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route stop data to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showJobRouteLocation", client, position, colour);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route stop data to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showJobRouteLocation", client, position, colour);
}
// ===========================================================================
function showPlayerChangePasswordGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.changePassword", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.changePassword", client);
}
// ===========================================================================
function showPlayerLoginSuccessGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.loginSuccess", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.loginSuccess", client);
}
// ===========================================================================
function showPlayerLoginFailedGUI(client, errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.loginFailed", client, errorMessage);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.loginFailed", client, errorMessage);
}
// ===========================================================================
function showPlayerRegistrationSuccessGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.registrationSuccess", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.registrationSuccess", client);
}
// ===========================================================================
function showPlayerRegistrationFailedGUI(client, errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.registrationFailed", client, errorMessage);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.registrationFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerGUIColours(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
}
// ===========================================================================
function sendPlayerGUIInit(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.guiInit", client);
}
// ===========================================================================
function showPlayerLoginGUI(client, errorMessage = "") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showLogin", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showLogin", client);
}
// ===========================================================================
function showPlayerRegistrationGUI(client, errorMessage = "") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showRegistration", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showRegistration", client);
}
// ===========================================================================
function showPlayerNewCharacterGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showNewCharacter", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showNewCharacter", client);
}
// ===========================================================================
function showPlayerChangePasswordGUI(client, errorMessage = "") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showChangePassword", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showChangePassword", client);
}
// ===========================================================================
function showPlayerResetPasswordCodeInputGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showResetPasswordCodeInput", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showResetPasswordCodeInput", client);
}
// ===========================================================================
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function showPlayerCharacterSelectSuccessGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.characterSelectSuccess", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.characterSelectSuccess", client);
}
// ===========================================================================
function showPlayerCharacterSelectFailedGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.characterSelectFailed", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.characterSelectFailed", client);
}
// ===========================================================================
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText, noButtonText) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage})`);
- sendNetworkEventToPlayer("vrr.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage})`);
+ sendNetworkEventToPlayer("vrr.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
}
// ===========================================================================
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
- sendNetworkEventToPlayer("vrr.showInfo", client, infoMessage, infoTitle, buttonText);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
+ sendNetworkEventToPlayer("vrr.showInfo", client, infoMessage, infoTitle, buttonText);
}
// ===========================================================================
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
- sendNetworkEventToPlayer("vrr.showInfo", client, errorMessage, errorTitle, buttonText);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
+ sendNetworkEventToPlayer("vrr.showInfo", client, errorMessage, errorTitle, buttonText);
}
// ===========================================================================
function sendRunCodeToClient(client, code, returnTo) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
- sendNetworkEventToPlayer("vrr.runCode", client, code, returnTo);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
+ sendNetworkEventToPlayer("vrr.runCode", client, code, returnTo);
}
// ===========================================================================
function sendPlayerWorkingState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.working", client, state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.working", client, state);
}
// ===========================================================================
function sendPlayerJobType(client, jobType) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.jobType", client, jobType);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.jobType", client, jobType);
}
// ===========================================================================
function sendPlayerStopJobRoute(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.hideJobRouteLocation", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.hideJobRouteLocation", client);
}
// ===========================================================================
function sendPlayerMouseCameraToggle(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.mouseCamera", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.mouseCamera", client);
}
// ===========================================================================
function setPlayerMouseCameraState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.mouseCameraForce", client, state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.mouseCameraForce", client, state);
}
// ===========================================================================
function sendPlayerMouseCursorToggle(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.mouseCursor", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.mouseCursor", client);
}
// ===========================================================================
function sendAddAccountKeyBindToClient(client, key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
- sendNetworkEventToPlayer("vrr.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
+ sendNetworkEventToPlayer("vrr.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
}
// ===========================================================================
function sendClearKeyBindsToClient(client, key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
- sendNetworkEventToPlayer("vrr.clearKeyBinds", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
+ sendNetworkEventToPlayer("vrr.clearKeyBinds", client);
}
// ===========================================================================
function sendRemoveAccountKeyBindToClient(client, key) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
- sendNetworkEventToPlayer("vrr.delKeyBind", client, toInteger(key));
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
+ sendNetworkEventToPlayer("vrr.delKeyBind", client, toInteger(key));
}
// ===========================================================================
function sendPlayerSetPosition(client, position) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
- sendNetworkEventToPlayer("vrr.position", client, position);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
+ sendNetworkEventToPlayer("vrr.position", client, position);
}
// ===========================================================================
function sendPlayerSetHeading(client, heading) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
- sendNetworkEventToPlayer("vrr.heading", client, heading);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
+ sendNetworkEventToPlayer("vrr.heading", client, heading);
}
// ===========================================================================
function sendPlayerSetInterior(client, interior) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
- sendNetworkEventToPlayer("vrr.interior", client, interior);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
+ sendNetworkEventToPlayer("vrr.interior", client, interior);
}
// ===========================================================================
function sendPlayerFrozenState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
- sendNetworkEventToPlayer("vrr.frozen", client, state);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
+ sendNetworkEventToPlayer("vrr.frozen", client, state);
}
// ===========================================================================
function clearPlayerWeapons(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
- sendNetworkEventToPlayer("vrr.clearWeapons", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
+ sendNetworkEventToPlayer("vrr.clearWeapons", client);
}
// ===========================================================================
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.newCharacterFailed", client, errorMessage);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.newCharacterFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerRemoveFromVehicle(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.removeFromVehicle", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.removeFromVehicle", client);
}
// ===========================================================================
function sendChatBoxMessageToPlayer(client, messageText, colour) {
- messageClient(messageText, client, colour);
+ messageClient(messageText, client, colour);
}
// ===========================================================================
function showPlayerItemTakeDelay(client, itemId) {
- if(getItemData(itemId)) {
- let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
- if(delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- }
+ if(getItemData(itemId)) {
+ let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
+ if(delay > 0) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ }
}
// ===========================================================================
function showPlayerItemUseDelay(client, itemSlot) {
- if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
- let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
- if(delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- }
+ if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
+ let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
+ if(delay > 0) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ }
}
// ===========================================================================
function showPlayerItemDropDelay(client, itemSlot) {
- if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
- let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
- if(delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- }
+ if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
+ let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
+ if(delay > 0) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ }
}
// ===========================================================================
function showPlayerItemPickupDelay(client, itemId) {
- if(getItemData(itemId)) {
- let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
- if(delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- }
+ if(getItemData(itemId)) {
+ let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
+ if(delay > 0) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ }
}
// ===========================================================================
function showPlayerItemPutDelay(client, itemSlot) {
- if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
- let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
- if(delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- }
+ if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
+ let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
+ if(delay > 0) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ }
}
// ===========================================================================
function showPlayerItemSwitchDelay(client, itemSlot) {
- if(itemSlot != -1) {
- if(getPlayerData(client).hotBarItems[itemSlot] != -1) {
- let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
- if(delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
- } else{
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerItemActionDelayComplete(client);
- }
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
- playerSwitchItem(client, itemSlot);
- }
+ if(itemSlot != -1) {
+ if(getPlayerData(client).hotBarItems[itemSlot] != -1) {
+ let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
+ if(delay > 0) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
+ } else{
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerItemActionDelayComplete(client);
+ }
+ } else {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ playerSwitchItem(client, itemSlot);
+ }
}
// ===========================================================================
function sendPlayerDrunkEffect(client, amount, duration) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
- sendNetworkEventToPlayer("vrr.drunkEffect", client, amount, duration);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
+ sendNetworkEventToPlayer("vrr.drunkEffect", client, amount, duration);
}
// ===========================================================================
function sendPlayerClearPedState(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
- sendNetworkEventToPlayer("vrr.clearPedState", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
+ sendNetworkEventToPlayer("vrr.clearPedState", client);
}
// ===========================================================================
function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, healthLoss) {
- let damagerEntity = getPlayerFromParams(damagerEntityName);
+ let damagerEntity = getPlayerFromParams(damagerEntityName);
- if(isNull(damagerEntity)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
- return false;
- }
+ if(isNull(damagerEntity)) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
+ return false;
+ }
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
- if(isNull(damagerEntity)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
- return false;
- }
+ if(isNull(damagerEntity)) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
+ return false;
+ }
- if(!getPlayerData(damagerEntity) || !getPlayerData(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
- return false;
- }
+ if(!getPlayerData(damagerEntity) || !getPlayerData(client)) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
+ return false;
+ }
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
- switch(getPlayerData(damagerEntity).weaponDamageEvent) {
- case VRR_WEAPON_DAMAGE_EVENT_TAZER:
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
- if(!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
- meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
- tazePlayer(client);
- }
- break;
+ switch(getPlayerData(damagerEntity).weaponDamageEvent) {
+ case VRR_WEAPON_DAMAGE_EVENT_TAZER:
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
+ if(!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
+ meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
+ tazePlayer(client);
+ }
+ break;
- case VRR_WEAPON_DAMAGE_EVENT_EXTINGUISH:
- break;
+ case VRR_WEAPON_DAMAGE_EVENT_EXTINGUISH:
+ break;
- case VRR_WEAPON_DAMAGE_EVENT_MACE:
- break;
+ case VRR_WEAPON_DAMAGE_EVENT_MACE:
+ break;
- case VRR_WEAPON_DAMAGE_EVENT_NORMAL:
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss*getPlayerData(client).incomingDamageMultiplier)})`);
- setPlayerHealth(client, getPlayerHealth(client)-(healthLoss*getPlayerData(client).incomingDamageMultiplier));
- break;
+ case VRR_WEAPON_DAMAGE_EVENT_NORMAL:
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss*getPlayerData(client).incomingDamageMultiplier)})`);
+ setPlayerHealth(client, getPlayerHealth(client)-(healthLoss*getPlayerData(client).incomingDamageMultiplier));
+ break;
- default:
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss*getPlayerData(client).incomingDamageMultiplier)})`);
- setPlayerHealth(client, getPlayerHealth(client)-(healthLoss*getPlayerData(client).incomingDamageMultiplier));
- break;
- }
+ default:
+ logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss*getPlayerData(client).incomingDamageMultiplier)})`);
+ setPlayerHealth(client, getPlayerHealth(client)-(healthLoss*getPlayerData(client).incomingDamageMultiplier));
+ break;
+ }
}
// ===========================================================================
@@ -703,44 +703,44 @@ function sendTimeMinuteDurationToPlayer(client, minuteDuration) {
// ===========================================================================
function updatePositionInPlayerData(client, position) {
- getPlayerData(client).syncPosition = position;
+ getPlayerData(client).syncPosition = position;
}
// ===========================================================================
function updateHeadingInPlayerData(client, heading) {
- getPlayerData(client).syncHeading = heading;
+ getPlayerData(client).syncHeading = heading;
}
// ===========================================================================
function updatePositionInVehicleData(client, vehicle, position) {
- getVehicleData(vehicle).syncPosition = position;
+ getVehicleData(vehicle).syncPosition = position;
}
// ===========================================================================
function updateHeadingInVehicleData(client, vehicle, heading) {
- getVehicleData(vehicle).syncHeading = heading;
+ getVehicleData(vehicle).syncHeading = heading;
}
// ===========================================================================
function forcePlayerIntoSkinSelect(client) {
- if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
- getPlayerData(client).returnToPosition = getPlayerPosition(client);
- getPlayerData(client).returnToHeading = getPlayerHeading(client);
- getPlayerData(client).returnToInterior = getPlayerInterior(client);
- getPlayerData(client).returnToDimension = getPlayerDimension(client);
- getPlayerData(client).returnToType = VRR_RETURNTO_TYPE_SKINSELECT;
+ if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
+ getPlayerData(client).returnToPosition = getPlayerPosition(client);
+ getPlayerData(client).returnToHeading = getPlayerHeading(client);
+ getPlayerData(client).returnToInterior = getPlayerInterior(client);
+ getPlayerData(client).returnToDimension = getPlayerDimension(client);
+ getPlayerData(client).returnToType = VRR_RETURNTO_TYPE_SKINSELECT;
- setPlayerPosition(client, getGameConfig().skinChangePosition[getServerGame()][0]);
- setPlayerHeading(client, getGameConfig().skinChangePosition[getServerGame()][1]);
- setPlayerInterior(client, getGameConfig().skinChangePosition[getServerGame()][2]);
- setPlayerDimension(client, client.index+500);
- }
+ setPlayerPosition(client, getGameConfig().skinChangePosition[getServerGame()][0]);
+ setPlayerHeading(client, getGameConfig().skinChangePosition[getServerGame()][1]);
+ setPlayerInterior(client, getGameConfig().skinChangePosition[getServerGame()][2]);
+ setPlayerDimension(client, client.index+500);
+ }
- sendNetworkEventToPlayer("vrr.skinSelect", client, true);
+ sendNetworkEventToPlayer("vrr.skinSelect", client, true);
}
// ===========================================================================
@@ -866,315 +866,321 @@ function sendAllFuelStationBlips(client) {
// ===========================================================================
function sendPlayerSetHealth(client, health) {
- sendNetworkEventToPlayer("vrr.health", client, health);
+ sendNetworkEventToPlayer("vrr.health", client, health);
}
// ===========================================================================
function sendPlayerSetArmour(client, armour) {
- sendNetworkEventToPlayer("vrr.armour", client, armour);
+ sendNetworkEventToPlayer("vrr.armour", client, armour);
}
// ===========================================================================
function playerFinishedSkinSelection(client, allowedSkinIndex) {
- sendNetworkEventToPlayer("vrr.skinSelect", client, false);
- if(allowedSkinIndex == -1) {
- messagePlayerAlert(client, "You canceled the skin change.");
- restorePlayerCamera(client);
+ sendNetworkEventToPlayer("vrr.skinSelect", client, false);
+ if(allowedSkinIndex == -1) {
+ messagePlayerAlert(client, "You canceled the skin change.");
+ restorePlayerCamera(client);
- if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) {
- setPlayerPosition(client, getPlayerData(client).returnToPosition);
- setPlayerHeading(client, getPlayerData(client).returnToHeading);
- setPlayerInterior(client, getPlayerData(client).returnToInterior);
- setPlayerDimension(client, getPlayerData(client).returnToDimension);
+ if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) {
+ setPlayerPosition(client, getPlayerData(client).returnToPosition);
+ setPlayerHeading(client, getPlayerData(client).returnToHeading);
+ setPlayerInterior(client, getPlayerData(client).returnToInterior);
+ setPlayerDimension(client, getPlayerData(client).returnToDimension);
- getPlayerData(client).returnToPosition = null;
- getPlayerData(client).returnToHeading = null;
- getPlayerData(client).returnToInterior = null;
- getPlayerData(client).returnToDimension = null;
- }
- return false;
- } else {
- getPlayerCurrentSubAccount(client).skin = getSkinIndexFromModel(allowedSkins[allowedSkinIndex][0]);
- if(isPlayerWorking(client)) {
- messagePlayerAlert(client, "Your new skin has been saved but won't be shown until you stop working.");
- setPlayerSkin(client, getJobData(getPlayerCurrentSubAccount(client).job).uniforms[getPlayerData(client).jobUniform].skinId);
- } else {
- setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
- }
+ getPlayerData(client).returnToPosition = null;
+ getPlayerData(client).returnToHeading = null;
+ getPlayerData(client).returnToInterior = null;
+ getPlayerData(client).returnToDimension = null;
+ }
+ return false;
+ } else {
+ getPlayerCurrentSubAccount(client).skin = getSkinIndexFromModel(allowedSkins[allowedSkinIndex][0]);
+ if(isPlayerWorking(client)) {
+ messagePlayerAlert(client, "Your new skin has been saved but won't be shown until you stop working.");
+ setPlayerSkin(client, getJobData(getPlayerCurrentSubAccount(client).job).uniforms[getPlayerData(client).jobUniform].skinId);
+ } else {
+ setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
+ }
- if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) {
- setPlayerPosition(client, getPlayerData(client).returnToPosition);
- setPlayerHeading(client, getPlayerData(client).returnToHeading);
- setPlayerInterior(client, getPlayerData(client).returnToInterior);
- setPlayerDimension(client, getPlayerData(client).returnToDimension);
+ if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) {
+ setPlayerPosition(client, getPlayerData(client).returnToPosition);
+ setPlayerHeading(client, getPlayerData(client).returnToHeading);
+ setPlayerInterior(client, getPlayerData(client).returnToInterior);
+ setPlayerDimension(client, getPlayerData(client).returnToDimension);
- getPlayerData(client).returnToPosition = null;
- getPlayerData(client).returnToHeading = null;
- getPlayerData(client).returnToInterior = null;
- getPlayerData(client).returnToDimension = null;
- }
+ getPlayerData(client).returnToPosition = null;
+ getPlayerData(client).returnToHeading = null;
+ getPlayerData(client).returnToInterior = null;
+ getPlayerData(client).returnToDimension = null;
+ }
- restorePlayerCamera(client);
- setPlayerControlState(client, true);
+ restorePlayerCamera(client);
+ setPlayerControlState(client, true);
- deleteItem(getPlayerData(client).itemActionItem);
- switchPlayerActiveHotBarSlot(client, -1);
- cachePlayerHotBarItems(client);
+ deleteItem(getPlayerData(client).itemActionItem);
+ switchPlayerActiveHotBarSlot(client, -1);
+ cachePlayerHotBarItems(client);
- meActionToNearbyPlayers(client, `changes their skin to ${allowedSkins[allowedSkinIndex][1]}`);
- }
+ meActionToNearbyPlayers(client, `changes their skin to ${allowedSkins[allowedSkinIndex][1]}`);
+ }
}
// ===========================================================================
function sendPlayerChatScrollLines(client, amount) {
- sendNetworkEventToPlayer("vrr.chatScrollLines", client, amount);
+ sendNetworkEventToPlayer("vrr.chatScrollLines", client, amount);
}
// ===========================================================================
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
- sendNetworkEventToPlayer("vrr.radioStream", client, streamURL, loop, volume, element);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
+ sendNetworkEventToPlayer("vrr.radioStream", client, streamURL, loop, volume, element);
}
// ===========================================================================
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
- sendNetworkEventToPlayer("vrr.audioFileStream", client, audioName, loop, volume);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
+ sendNetworkEventToPlayer("vrr.audioFileStream", client, audioName, loop, volume);
}
// ===========================================================================
function stopRadioStreamForPlayer(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
- sendNetworkEventToPlayer("vrr.stopRadioStream", client);
+ logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
+ sendNetworkEventToPlayer("vrr.stopRadioStream", client);
}
// ===========================================================================
function setPlayerStreamingRadioVolume(client, volumeLevel, elementId = false) {
- getPlayerData(client).accountData.streamingRadioVolume = volumeLevel;
- getPlayerData(client).streamingRadioElement = elementId;
- sendNetworkEventToPlayer("vrr.radioVolume", client, volumeLevel, elementId);
+ getPlayerData(client).accountData.streamingRadioVolume = volumeLevel;
+ getPlayerData(client).streamingRadioElement = elementId;
+ sendNetworkEventToPlayer("vrr.radioVolume", client, volumeLevel, elementId);
}
// ===========================================================================
function setVehicleLightsState(vehicle, state) {
setEntityData(vehicle, "vrr.lights", getVehicleData(vehicle).lights);
- sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, state);
+ sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, state);
}
// ===========================================================================
function sendPlayerEnterPropertyKey(client, key) {
- sendNetworkEventToPlayer("vrr.enterPropertyKey", client, key);
+ sendNetworkEventToPlayer("vrr.enterPropertyKey", client, key);
}
// ===========================================================================
function makePedPlayAnimation(ped, animationSlot, positionOffset) {
- let animationData = getAnimationData(animationSlot);
- let freezePlayer = false;
- //if(animationData[9] != VRR_ANIMMOVE_NONE) {
- switch(animationData[9]) {
- case VRR_ANIMMOVE_FORWARD:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosInFrontOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
+ let animationData = getAnimationData(animationSlot);
+ let freezePlayer = false;
+ //if(animationData[9] != VRR_ANIMMOVE_NONE) {
+ switch(animationData[9]) {
+ case VRR_ANIMMOVE_FORWARD:
+ setElementCollisionsEnabled(ped, false);
+ setElementPosition(ped, getPosInFrontOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
+ freezePlayer = true;
+ break;
- case VRR_ANIMMOVE_BACK:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosBehindPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
+ case VRR_ANIMMOVE_BACK:
+ setElementCollisionsEnabled(ped, false);
+ setElementPosition(ped, getPosBehindPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
+ freezePlayer = true;
+ break;
- case VRR_ANIMMOVE_LEFT:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosToLeftOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
+ case VRR_ANIMMOVE_LEFT:
+ setElementCollisionsEnabled(ped, false);
+ setElementPosition(ped, getPosToLeftOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
+ freezePlayer = true;
+ break;
- case VRR_ANIMMOVE_RIGHT:
- setElementCollisionsEnabled(ped, false);
- setElementPosition(ped, getPosToRightOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
- freezePlayer = true;
- break;
- }
- //}
- sendNetworkEventToPlayer("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4], animationData[5], positionOffset, freezePlayer);
+ case VRR_ANIMMOVE_RIGHT:
+ setElementCollisionsEnabled(ped, false);
+ setElementPosition(ped, getPosToRightOfPos(getElementPosition(ped), fixAngle(getElementHeading(ped)), positionOffset));
+ freezePlayer = true;
+ break;
+ }
+ //}
+ sendNetworkEventToPlayer("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4], animationData[5], positionOffset, freezePlayer);
}
// ===========================================================================
function makePedStopAnimation(pedId) {
- sendNetworkEventToPlayer("vrr.pedStopAnim", null, pedId);
+ sendNetworkEventToPlayer("vrr.pedStopAnim", null, pedId);
}
// ===========================================================================
function forcePedAnimation(ped, animationSlot) {
- let animationData = getAnimationData(animationSlot);
+ let animationData = getAnimationData(animationSlot);
- sendNetworkEventToPlayer("vrr.forcePedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4]);
+ sendNetworkEventToPlayer("vrr.forcePedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4]);
}
// ===========================================================================
function hideAllPlayerGUI(client) {
- sendNetworkEventToPlayer("vrr.hideAllGUI", client);
+ sendNetworkEventToPlayer("vrr.hideAllGUI", client);
}
// ===========================================================================
function requestClientInfo(client) {
- sendNetworkEventToPlayer("vrr.clientInfo", client);
+ sendNetworkEventToPlayer("vrr.clientInfo", client);
}
// ===========================================================================
function updateInteriorLightsForPlayer(client, state) {
- sendNetworkEventToPlayer("vrr.interiorLights", client, state);
+ sendNetworkEventToPlayer("vrr.interiorLights", client, state);
}
// ===========================================================================
function forcePlayerToSyncElementProperties(client, element) {
- sendNetworkEventToPlayer("vrr.syncElement", client, element.id);
+ sendNetworkEventToPlayer("vrr.syncElement", client, element.id);
}
// ===========================================================================
function sendPlayerPedPartsAndProps(client) {
- let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
- let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
+ let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
+ let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
- sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
+ sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
}
// ===========================================================================
function forcePlayerWantedLevel(client, wantedLevel) {
- sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel);
- return true;
+ sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel);
+ return true;
}
// ===========================================================================
function onPlayerNearPickup(client, pickupId) {
- getPlayerData(client).currentPickup = getElementFromId(pickupId);
+ getPlayerData(client).currentPickup = getElementFromId(pickupId);
}
// ===========================================================================
function updateAllInteriorVehiclesForPlayer(client, interior, dimension) {
- for(let i in getServerData().vehicles) {
- if(getServerData().vehicles[i].vehicle != false) {
- if(getServerData().vehicles[i].interior == interior && getServerData().vehicles[i].dimension == dimension) {
- forcePlayerToSyncElementProperties(client, getServerData().vehicles[i].vehicle);
- }
- }
- }
+ for(let i in getServerData().vehicles) {
+ if(getServerData().vehicles[i].vehicle != false) {
+ if(getServerData().vehicles[i].interior == interior && getServerData().vehicles[i].dimension == dimension) {
+ forcePlayerToSyncElementProperties(client, getServerData().vehicles[i].vehicle);
+ }
+ }
+ }
}
// ===========================================================================
function setPlayerBuyingVehicleState(client, state, vehicleId, position) {
- if(getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
- sendNetworkEventToPlayer("vrr.vehBuyState", client, state, vehicleId, position);
- }
+ if(getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
+ sendNetworkEventToPlayer("vrr.vehBuyState", client, state, vehicleId, position);
+ }
}
// ==========================================================================
function receiveVehiclePurchaseStateUpdateFromClient(client, state) {
- if(getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
- checkVehicleBuying(client);
- }
+ if(getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
+ checkVehicleBuying(client);
+ }
}
// ===========================================================================
function sendPlayerLogLevel(client, tempLogLevel = logLevel) {
- sendNetworkEventToPlayer("vrr.logLevel", client, tempLogLevel);
+ sendNetworkEventToPlayer("vrr.logLevel", client, tempLogLevel);
}
// ==========================================================================
function setPlayerInfiniteRun(client, state) {
- sendNetworkEventToPlayer("vrr.infiniteRun", client, state);
+ sendNetworkEventToPlayer("vrr.infiniteRun", client, state);
}
// ==========================================================================
function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
+ sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
}
// ==========================================================================
function sendHouseToPlayer(client, houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
- sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
+ sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
}
// ==========================================================================
function sendAllBusinessesToPlayer(client) {
- let businesses = getServerData().businesses;
- for(let i in businesses) {
- sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false);
- }
+ let businesses = getServerData().businesses;
+ for(let i in businesses) {
+ sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false);
+ }
}
// ==========================================================================
function sendAllHousesToPlayer(client) {
- let houses = getServerData().houses;
- for(let i in houses) {
- sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior);
- }
+ let houses = getServerData().houses;
+ for(let i in houses) {
+ sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior);
+ }
}
// ==========================================================================
function sendAllJobsToPlayer(client) {
- //let jobs = getServerData().jobs;
- //for(let i in jobs) {
- // for(let j in jobs[i].locations) {
- // sendJobToPlayer(client, jobs[i].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].blipModel);
- // }
- //}
+ //let jobs = getServerData().jobs;
+ //for(let i in jobs) {
+ // for(let j in jobs[i].locations) {
+ // sendJobToPlayer(client, jobs[i].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].blipModel);
+ // }
+ //}
}
// ==========================================================================
function makePlayerHoldObjectModel(client, modelIndex) {
- sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).ped, modelIndex);
+ sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).ped, modelIndex);
}
// ==========================================================================
function receivePlayerPedNetworkId(client, pedId) {
- getPlayerData(client).ped = pedId;
+ getPlayerData(client).ped = pedId;
}
// ==========================================================================
function requestPlayerPedNetworkId(client) {
- sendNetworkEventToPlayer("vrr.playerPedId", client);
+ sendNetworkEventToPlayer("vrr.playerPedId", client);
}
// ==========================================================================
function setPlayerInCutsceneInterior(client, cutsceneName) {
- getPlayerData(client).interiorCutscene = cutsceneName;
- sendNetworkEventToPlayer("vrr.cutsceneInterior", client, cutsceneName);
+ getPlayerData(client).interiorCutscene = cutsceneName;
+ sendNetworkEventToPlayer("vrr.cutsceneInterior", client, cutsceneName);
+}
+
+// ==========================================================================
+
+function makePlayerPedSpeak(client, pedSpeechName) {
+ sendNetworkEventToPlayer("vrr.pedSpeak", client, pedSpeechName);
}
// ==========================================================================
\ No newline at end of file
diff --git a/scripts/server/command.js b/scripts/server/command.js
index c577d396..673c4fed 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -12,581 +12,581 @@ let serverCommands = [];
// ===========================================================================
let builtInCommands = [
- "refresh",
- "restart",
- "stop",
- "start",
- "reconnect",
- "setname",
- "connect",
- "disconnect",
- "say",
- "dumpdoc",
+ "refresh",
+ "restart",
+ "stop",
+ "start",
+ "reconnect",
+ "setname",
+ "connect",
+ "disconnect",
+ "say",
+ "dumpdoc",
];
// ===========================================================================
function initCommandScript() {
- logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
- serverCommands = loadCommands();
- //addAllCommandHandlers();
- logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
+ logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
+ serverCommands = loadCommands();
+ //addAllCommandHandlers();
+ logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
}
// ===========================================================================
function loadCommands() {
- let tempCommands = {
- accent: [
- commandData("accent", setAccentCommand, "", getStaffFlagValue("None"), false, false, "Sets your character's accent"),
- commandData("accents", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
- commandData("accentlist", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
- ],
- account: [
- commandData("login", loginCommand, "", getStaffFlagValue("None"), false, false, "Login to an account"),
- commandData("register", registerCommand, "", getStaffFlagValue("None"), false, false, "Creates an account"),
- commandData("changepass", changeAccountPasswordCommand, " ", getStaffFlagValue("None"), true, false, "Change an account password"),
- commandData("iplogin", toggleAutoLoginByIPCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically login if you join with the same IP as your last join"),
- commandData("autolastchar", toggleAutoSelectLastCharacterCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically spawn with the last character you played as"),
- commandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("None"), false, false, "Toggle whether to use GUI. If GUI is disabled on the server, it won't show even if you have GUI enabled."),
- commandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("None"), true, false, "Set up and use two-factor authentication."),
- commandData("setemail", setAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Sets your email. To reset your password, you must have a valid email set and verified."),
- commandData("verifyemail", verifyAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Confirms/verifies your email."),
- //commandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("None"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."),
- commandData("notips", toggleNoRandomTipsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off random tips"),
- commandData("loginalert", toggleAccountLoginAttemptNotificationsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off email notifications for attempts to login to your account"),
- commandData("scrolllines", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"),
+ let tempCommands = {
+ accent: [
+ commandData("accent", setAccentCommand, "", getStaffFlagValue("None"), false, false, "Sets your character's accent"),
+ commandData("accents", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
+ commandData("accentlist", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"),
+ ],
+ account: [
+ commandData("login", loginCommand, "", getStaffFlagValue("None"), false, false, "Login to an account"),
+ commandData("register", registerCommand, "", getStaffFlagValue("None"), false, false, "Creates an account"),
+ commandData("changepass", changeAccountPasswordCommand, " ", getStaffFlagValue("None"), true, false, "Change an account password"),
+ commandData("iplogin", toggleAutoLoginByIPCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically login if you join with the same IP as your last join"),
+ commandData("autolastchar", toggleAutoSelectLastCharacterCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically spawn with the last character you played as"),
+ commandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("None"), false, false, "Toggle whether to use GUI. If GUI is disabled on the server, it won't show even if you have GUI enabled."),
+ commandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("None"), true, false, "Set up and use two-factor authentication."),
+ commandData("setemail", setAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Sets your email. To reset your password, you must have a valid email set and verified."),
+ commandData("verifyemail", verifyAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Confirms/verifies your email."),
+ //commandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("None"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."),
+ commandData("notips", toggleNoRandomTipsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off random tips"),
+ commandData("loginalert", toggleAccountLoginAttemptNotificationsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off email notifications for attempts to login to your account"),
+ commandData("scrolllines", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"),
- ],
- ammunation: [],
- animation: [
- commandData("anim", playPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Makes your player ped use an animation"),
- commandData("an", playPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Makes your player ped use an animation"),
- commandData("e", playPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Makes your player ped use an animation"),
- commandData("anims", showAnimationListCommand, "", getStaffFlagValue("None"), true, true, "Shows a list of animations"),
- commandData("animlist", showAnimationListCommand, "", getStaffFlagValue("None"), true, true, "Shows a list of animations"),
- commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
- ],
- antiCheat: [
- //commandData("setac", toggleGlobalAntiCheatCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
- //commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
- ],
- ban: [
- commandData("aban", accountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's account."),
- commandData("acctban", accountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's account."),
- commandData("cban", subAccountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's character."),
- commandData("charban", subAccountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's character."),
- commandData("saban", subAccountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's character (subaccount)."),
- commandData("ipban", ipBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's IP."),
- commandData("subnetban", subNetBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's subnet."),
- ],
- bitFlag: [],
- business: [
- commandData("addbiz", createBusinessCommand, "", getStaffFlagValue("ManageBusinesses"), true, false, "Creates a business"),
- commandData("delbiz", deleteBusinessCommand, "[id]", getStaffFlagValue("ManageBusinesses"), true, true, "Deletes a business"),
- //commandData("addbizloc", createBusinessLocationCommand, " ", getStaffFlagValue("ManageBusinesses"), true, false),
- //commandData("delbizloc", deleteBusinessLocationCommand, "[id]", getStaffFlagValue("ManageBusinesses"), true, false),
- commandData("bizreloadall", reloadAllBusinessesCommand, "", getStaffFlagValue("ManageBusinesses"), true, false, "Reloads all businesses from the database"),
+ ],
+ ammunation: [],
+ animation: [
+ commandData("anim", playPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Makes your player ped use an animation"),
+ commandData("an", playPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Makes your player ped use an animation"),
+ commandData("e", playPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Makes your player ped use an animation"),
+ commandData("anims", showAnimationListCommand, "", getStaffFlagValue("None"), true, true, "Shows a list of animations"),
+ commandData("animlist", showAnimationListCommand, "", getStaffFlagValue("None"), true, true, "Shows a list of animations"),
+ commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
+ ],
+ antiCheat: [
+ //commandData("setac", toggleGlobalAntiCheatCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
+ //commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
+ ],
+ ban: [
+ commandData("aban", accountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's account."),
+ commandData("acctban", accountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's account."),
+ commandData("cban", subAccountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's character."),
+ commandData("charban", subAccountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's character."),
+ commandData("saban", subAccountBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's character (subaccount)."),
+ commandData("ipban", ipBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's IP."),
+ commandData("subnetban", subNetBanCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Bans a player's subnet."),
+ ],
+ bitFlag: [],
+ business: [
+ commandData("addbiz", createBusinessCommand, "", getStaffFlagValue("ManageBusinesses"), true, false, "Creates a business"),
+ commandData("delbiz", deleteBusinessCommand, "[id]", getStaffFlagValue("ManageBusinesses"), true, true, "Deletes a business"),
+ //commandData("addbizloc", createBusinessLocationCommand, " ", getStaffFlagValue("ManageBusinesses"), true, false),
+ //commandData("delbizloc", deleteBusinessLocationCommand, "[id]", getStaffFlagValue("ManageBusinesses"), true, false),
+ commandData("bizreloadall", reloadAllBusinessesCommand, "", getStaffFlagValue("ManageBusinesses"), true, false, "Reloads all businesses from the database"),
- commandData("bizlock", lockUnlockBusinessCommand, "", getStaffFlagValue("None"), true, true, "Locks a business"),
- commandData("bizlights", toggleBusinessInteriorLightsCommand, "", getStaffFlagValue("None"), true, true, "Turns on/off a business's interior lights"),
- commandData("bizbuy", buyBusinessCommand, "", getStaffFlagValue("None"), true, true, "Purchases a business"),
- commandData("bizfee", setBusinessEntranceFeeCommand, "", getStaffFlagValue("None"), true, true, "Sets a fee to charge players when they enter the business."),
- commandData("biztill", viewBusinessTillAmountCommand, "", getStaffFlagValue("None"), true, true, "Shows the business's till (cash register) amount"),
- commandData("bizbalance", viewBusinessTillAmountCommand, "", getStaffFlagValue("None"), true, true, "Shows the business's till (cash register) amount"),
- commandData("bizwithdraw", withdrawFromBusinessCommand, "", getStaffFlagValue("None"), true, true, "Take money out of the business till (cash register)"),
- commandData("bizdeposit", depositIntoBusinessCommand, "", getStaffFlagValue("None"), true, true, "Put money into the business till (cash register)"),
- commandData("buy", buyFromBusinessCommand, " [amount]", getStaffFlagValue("None"), true, true, "Buy items from a business"),
- commandData("bizstock", stockItemOnBusinessFloorCommand, "- ", getStaffFlagValue("None"), true, true, "Uses storage items to restock the business with."),
- commandData("bizstore", storeItemInBusinessStorageCommand, "
- ", getStaffFlagValue("None"), true, true, "Moves items from the business to the business storage"),
- commandData("bizorder", orderItemForBusinessCommand, "
- ", getStaffFlagValue("None"), true, true, "Orders items to sell from a business"),
- commandData("bizitemprice", setBusinessItemSellPriceCommand, "
- ", getStaffFlagValue("None"), true, true, "Sets the purchase price of a business item"),
- commandData("bizname", setBusinessNameCommand, "", getStaffFlagValue("None"), true, true, "Changes a business name"),
- commandData("bizowner", setBusinessOwnerCommand, "", getStaffFlagValue("None"), true, true, "Changes the owner of a business"),
- commandData("bizdelowner", removeBusinessOwnerCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Removes the owner of a business"),
- commandData("bizpublic", setBusinessPublicCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Changes a business to public (city hall, govt buildings, etc)"),
- commandData("bizjob", setBusinessJobCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Changes the owner of a business to a job"),
- commandData("bizrank", setBusinessRankCommand, "", getStaffFlagValue("None"), true, true, "Changes the job/clan rank required to use the business"),
- commandData("bizclan", setBusinessClanCommand, "", getStaffFlagValue("None"), true, true, "Changes the owner of a business to a clan"),
- commandData("bizbuyprice", setBusinessBuyPriceCommand, "", getStaffFlagValue("None"), true, true, "Changes the price to buy the business"),
- commandData("bizblip", setBusinessBlipCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Sets the business blip display"),
- commandData("bizpickup", setBusinessPickupCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Sets the business pickup display"),
- commandData("bizinfo", getBusinessInfoCommand, "[business id]", getStaffFlagValue("None"), true, true, "Shows business information"),
- commandData("bizflooritems", getBusinessFloorItemsCommand, "[business id]", getStaffFlagValue("None"), true, true, "Shows all business floor items (for sale) to a player"),
- commandData("bizflooritems", getBusinessStorageItemsCommand, "[business id]", getStaffFlagValue("None"), true, true, "Shows all business storage items (i.e. back room) to a player"),
- commandData("bizentrance", moveBusinessEntranceCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Moves the entrance (exterior point) of the business"),
- commandData("bizexit", moveBusinessExitCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Moves the exit (interior point) of the business"),
- commandData("bizinttype", setBusinessInteriorTypeCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Changes the business interior"),
- commandData("bizdefaultitems", giveDefaultItemsToBusinessCommand, "
- ", getStaffFlagValue("ManageItems"), true, true, "Gives the business the default items based on template name"),
- commandData("bizdelflooritems", deleteBusinessFloorItemsCommand, "", getStaffFlagValue("ManageItems"), true, true, "Destroys all items on the business floor (for-sale items)"),
- commandData("bizdelstorageitems", deleteBusinessStorageItemsCommand, "", getStaffFlagValue("ManageItems"), true, true, "Destroys all items in the business's storage"),
- commandData("bizdealership", setBusinessEntranceLabelToDealershipCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Sets the business's door label to vehicle dealership"),
- ],
- chat: [
- commandData("me", meActionCommand, "", getStaffFlagValue("None"), true, false, "Shows a custom action message in chat"),
- commandData("do", doActionCommand, "", getStaffFlagValue("None"), true, false, "Shows a custom action description in chat"),
- commandData("s", shoutCommand, "", getStaffFlagValue("None"), true, false, "Shout a message to others in the area"),
- commandData("shout", shoutCommand, "", getStaffFlagValue("None"), true, false, "Shout a message to others in the area"),
- commandData("talk", talkCommand, "", getStaffFlagValue("None"), true, false, "Say a message to others nearby"),
- commandData("local", talkCommand, "", getStaffFlagValue("None"), true, false, "Say a message to others nearby"),
- commandData("l", talkCommand, "", getStaffFlagValue("None"), true, false, "Say a message to others nearby"),
- commandData("w", whisperCommand, "", getStaffFlagValue("None"), true, false, "Whisper a message to players very close to you"),
- commandData("whisper", whisperCommand, "", getStaffFlagValue("None"), true, false, "Whisper a message to players very close to you"),
- commandData("clanchat", clanChatCommand, "", getStaffFlagValue("None"), true, false, "Sends an OOC chat message to members in your clan"),
- commandData("clan", clanChatCommand, "", getStaffFlagValue("None"), true, false, "Sends an OOC chat message to members in your clan"),
- commandData("c", clanChatCommand, "", getStaffFlagValue("None"), true, false, "Sends an OOC chat message to members in your clan"),
- commandData("adminchat", adminChatCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sends an OOC chat message to other admins"),
- commandData("a", adminChatCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sends an OOC chat message to other admins"),
- commandData("achat", adminChatCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sends an OOC chat message to other admins"),
- commandData("m", megaphoneChatCommand, "", getStaffFlagValue("None"), true, true, "Shouts a message over a megaphone (portable bullhorn/loudspeaker)"),
- ],
- clan: [
- commandData("clans", listClansCommand, "[search text]", getStaffFlagValue("None"), true, true, "List clans (search by partial name, if provided)"),
- commandData("clanranks", listClanRanksCommand, "[clan name]", getStaffFlagValue("None"), true, true, "Shows a list of a clan's ranks"),
- commandData("clanflags", showClanFlagListCommand, "", getStaffFlagValue("None"), true, true, "Shows a list of clan permission flags"),
+ commandData("bizlock", lockUnlockBusinessCommand, "", getStaffFlagValue("None"), true, true, "Locks a business"),
+ commandData("bizlights", toggleBusinessInteriorLightsCommand, "", getStaffFlagValue("None"), true, true, "Turns on/off a business's interior lights"),
+ commandData("bizbuy", buyBusinessCommand, "", getStaffFlagValue("None"), true, true, "Purchases a business"),
+ commandData("bizfee", setBusinessEntranceFeeCommand, "", getStaffFlagValue("None"), true, true, "Sets a fee to charge players when they enter the business."),
+ commandData("biztill", viewBusinessTillAmountCommand, "", getStaffFlagValue("None"), true, true, "Shows the business's till (cash register) amount"),
+ commandData("bizbalance", viewBusinessTillAmountCommand, "", getStaffFlagValue("None"), true, true, "Shows the business's till (cash register) amount"),
+ commandData("bizwithdraw", withdrawFromBusinessCommand, "", getStaffFlagValue("None"), true, true, "Take money out of the business till (cash register)"),
+ commandData("bizdeposit", depositIntoBusinessCommand, "", getStaffFlagValue("None"), true, true, "Put money into the business till (cash register)"),
+ commandData("buy", buyFromBusinessCommand, " [amount]", getStaffFlagValue("None"), true, true, "Buy items from a business"),
+ commandData("bizstock", stockItemOnBusinessFloorCommand, "
- ", getStaffFlagValue("None"), true, true, "Uses storage items to restock the business with."),
+ commandData("bizstore", storeItemInBusinessStorageCommand, "
- ", getStaffFlagValue("None"), true, true, "Moves items from the business to the business storage"),
+ commandData("bizorder", orderItemForBusinessCommand, "
- ", getStaffFlagValue("None"), true, true, "Orders items to sell from a business"),
+ commandData("bizitemprice", setBusinessItemSellPriceCommand, "
- ", getStaffFlagValue("None"), true, true, "Sets the purchase price of a business item"),
+ commandData("bizname", setBusinessNameCommand, "", getStaffFlagValue("None"), true, true, "Changes a business name"),
+ commandData("bizowner", setBusinessOwnerCommand, "", getStaffFlagValue("None"), true, true, "Changes the owner of a business"),
+ commandData("bizdelowner", removeBusinessOwnerCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Removes the owner of a business"),
+ commandData("bizpublic", setBusinessPublicCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Changes a business to public (city hall, govt buildings, etc)"),
+ commandData("bizjob", setBusinessJobCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Changes the owner of a business to a job"),
+ commandData("bizrank", setBusinessRankCommand, "", getStaffFlagValue("None"), true, true, "Changes the job/clan rank required to use the business"),
+ commandData("bizclan", setBusinessClanCommand, "", getStaffFlagValue("None"), true, true, "Changes the owner of a business to a clan"),
+ commandData("bizbuyprice", setBusinessBuyPriceCommand, "", getStaffFlagValue("None"), true, true, "Changes the price to buy the business"),
+ commandData("bizblip", setBusinessBlipCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Sets the business blip display"),
+ commandData("bizpickup", setBusinessPickupCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Sets the business pickup display"),
+ commandData("bizinfo", getBusinessInfoCommand, "[business id]", getStaffFlagValue("None"), true, true, "Shows business information"),
+ commandData("bizflooritems", getBusinessFloorItemsCommand, "[business id]", getStaffFlagValue("None"), true, true, "Shows all business floor items (for sale) to a player"),
+ commandData("bizflooritems", getBusinessStorageItemsCommand, "[business id]", getStaffFlagValue("None"), true, true, "Shows all business storage items (i.e. back room) to a player"),
+ commandData("bizentrance", moveBusinessEntranceCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Moves the entrance (exterior point) of the business"),
+ commandData("bizexit", moveBusinessExitCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Moves the exit (interior point) of the business"),
+ commandData("bizinttype", setBusinessInteriorTypeCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Changes the business interior"),
+ commandData("bizdefaultitems", giveDefaultItemsToBusinessCommand, "
- ", getStaffFlagValue("ManageItems"), true, true, "Gives the business the default items based on template name"),
+ commandData("bizdelflooritems", deleteBusinessFloorItemsCommand, "", getStaffFlagValue("ManageItems"), true, true, "Destroys all items on the business floor (for-sale items)"),
+ commandData("bizdelstorageitems", deleteBusinessStorageItemsCommand, "", getStaffFlagValue("ManageItems"), true, true, "Destroys all items in the business's storage"),
+ commandData("bizdealership", setBusinessEntranceLabelToDealershipCommand, "", getStaffFlagValue("ManageBusinesses"), true, true, "Sets the business's door label to vehicle dealership"),
+ ],
+ chat: [
+ commandData("me", meActionCommand, "", getStaffFlagValue("None"), true, false, "Shows a custom action message in chat"),
+ commandData("do", doActionCommand, "", getStaffFlagValue("None"), true, false, "Shows a custom action description in chat"),
+ commandData("s", shoutCommand, "", getStaffFlagValue("None"), true, false, "Shout a message to others in the area"),
+ commandData("shout", shoutCommand, "", getStaffFlagValue("None"), true, false, "Shout a message to others in the area"),
+ commandData("talk", talkCommand, "", getStaffFlagValue("None"), true, false, "Say a message to others nearby"),
+ commandData("local", talkCommand, "", getStaffFlagValue("None"), true, false, "Say a message to others nearby"),
+ commandData("l", talkCommand, "", getStaffFlagValue("None"), true, false, "Say a message to others nearby"),
+ commandData("w", whisperCommand, "", getStaffFlagValue("None"), true, false, "Whisper a message to players very close to you"),
+ commandData("whisper", whisperCommand, "", getStaffFlagValue("None"), true, false, "Whisper a message to players very close to you"),
+ commandData("clanchat", clanChatCommand, "", getStaffFlagValue("None"), true, false, "Sends an OOC chat message to members in your clan"),
+ commandData("clan", clanChatCommand, "", getStaffFlagValue("None"), true, false, "Sends an OOC chat message to members in your clan"),
+ commandData("c", clanChatCommand, "", getStaffFlagValue("None"), true, false, "Sends an OOC chat message to members in your clan"),
+ commandData("adminchat", adminChatCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sends an OOC chat message to other admins"),
+ commandData("a", adminChatCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sends an OOC chat message to other admins"),
+ commandData("achat", adminChatCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sends an OOC chat message to other admins"),
+ commandData("m", megaphoneChatCommand, "", getStaffFlagValue("None"), true, true, "Shouts a message over a megaphone (portable bullhorn/loudspeaker)"),
+ ],
+ clan: [
+ commandData("clans", listClansCommand, "[search text]", getStaffFlagValue("None"), true, true, "List clans (search by partial name, if provided)"),
+ commandData("clanranks", listClanRanksCommand, "[clan name]", getStaffFlagValue("None"), true, true, "Shows a list of a clan's ranks"),
+ commandData("clanflags", showClanFlagListCommand, "", getStaffFlagValue("None"), true, true, "Shows a list of clan permission flags"),
- commandData("addclan", createClanCommand, "", getStaffFlagValue("ManageClans"), true, true, "Creates an new empty, unowned clan."),
- commandData("delclan", deleteClanCommand, "", getStaffFlagValue("ManageClans"), true, true, "Deletes a clan by ID or name"),
+ commandData("addclan", createClanCommand, "", getStaffFlagValue("ManageClans"), true, true, "Creates an new empty, unowned clan."),
+ commandData("delclan", deleteClanCommand, "", getStaffFlagValue("ManageClans"), true, true, "Deletes a clan by ID or name"),
- commandData("clanaddrank", createClanRankCommand, " ", getStaffFlagValue("None"), true, true, "Adds a clan rank"),
- commandData("clandelrank", deleteClanRankCommand, "", getStaffFlagValue("None"), true, true, "Removes a clan rank"),
+ commandData("clanaddrank", createClanRankCommand, " ", getStaffFlagValue("None"), true, true, "Adds a clan rank"),
+ commandData("clandelrank", deleteClanRankCommand, "", getStaffFlagValue("None"), true, true, "Removes a clan rank"),
- commandData("clansetrank", setClanMemberRankCommand, " ", getStaffFlagValue("None"), true, true, "Sets the rank of a clan member"),
+ commandData("clansetrank", setClanMemberRankCommand, " ", getStaffFlagValue("None"), true, true, "Sets the rank of a clan member"),
- commandData("clanowner", setClanOwnerCommand, "", getStaffFlagValue("None"), true, true, "Gives ownership of the clan to a player"),
- commandData("clantag", setClanTagCommand, "", getStaffFlagValue("None"), true, true, "Sets a clan's main tag"),
- commandData("clanranktag", setClanRankTagCommand, " ", getStaffFlagValue("None"), true, true, "Sets a clan rank's custom tag"),
- commandData("clanmembertag", setClanMemberTagCommand, " ", getStaffFlagValue("None"), true, true, "Sets a clan members's custom tag"),
- commandData("clanrankname", setClanRankTitleCommand, " ", getStaffFlagValue("None"), true, true, "Sets a clan rank's title"),
- commandData("clanranklevel", setClanRankLevelCommand, " ", getStaffFlagValue("None"), true, true, "Sets a clan rank's level"),
- //commandData("clanrankenabled", toggleClanRankEnabledCommand, "", getStaffFlagValue("None"), true, true, "Enables/disables a clan rank"),
- commandData("clanmembertitle", setClanMemberTitleCommand, " ", getStaffFlagValue("None"), true, true, "Sets a clan members's custom title"),
- commandData("clanaddrankflag", addClanRankFlagCommand, " ", getStaffFlagValue("None"), true, true, "Gives a clan rank a clan permission."),
- commandData("clanrankflags", showClanRankFlagsCommand, "", getStaffFlagValue("None"), true, true, "Lists a clan rank's permission flags"),
- commandData("clandelrankflag", removeClanRankFlagCommand, " ", getStaffFlagValue("None"), true, true, "Takes a clan permission from a clan rank"),
- commandData("clanaddmemberflag", addClanMemberFlagCommand, " ", getStaffFlagValue("None"), true, true, "Gives a clan member a clan permission"),
- commandData("clandelmemberflag", removeClanMemberFlagCommand, " ", getStaffFlagValue("None"), true, true, "Takes a clan permission from a clan member"),
- ],
- class: [],
- client: [],
- colour: [],
- command: [
- commandData("cmdenabletype", enableAllCommandsByType, "", getStaffFlagValue("Developer"), true, true, "Enables all commands by type."),
- commandData("cmddisabletype", disableAllCommandsByType, "", getStaffFlagValue("Developer"), true, true, "Disables all commands by type."),
- commandData("cmdenable", enableCommand, "", getStaffFlagValue("Developer"), true, true, "Enable a specific command"),
- commandData("cmddisable", disableCommand, "", getStaffFlagValue("Developer"), true, true, "Disables a specific command"),
- ],
- config: [
- commandData("settime", setTimeCommand, " [minute]", getStaffFlagValue("ManageWorld"), true, true, "Sets the time. Hours are required, minute is optional and will default to 0"),
- commandData("setminuteduration", setMinuteDurationCommand, "