diff --git a/config/client/locale.json b/config/client/locale.json
index 62caa2db..f0478a35 100644
--- a/config/client/locale.json
+++ b/config/client/locale.json
@@ -7,7 +7,8 @@
"flagImageFile": "uk.png",
"countries": ["gb", "us", "au", "bz", "ca", "ie", "jm", "nz", "za", "tt"],
"requiresUnicode": false,
- "contributor": "Vortrex"
+ "contributor": "Vortrex",
+ "enabled": true
},
{
"id": 1,
@@ -17,7 +18,8 @@
"flagImageFile": "ru.png",
"countries": ["ru", "ua"],
"requiresUnicode": false,
- "contributor": "VNDTTS"
+ "contributor": "VNDTTS",
+ "enabled": true
},
{
"id": 2,
@@ -27,7 +29,8 @@
"flagImageFile": "pl.png",
"countries": ["pl"],
"requiresUnicode": false,
- "contributor": "Suprise444"
+ "contributor": "Suprise444",
+ "enabled": true
},
{
"id": 3,
@@ -37,7 +40,8 @@
"flagImageFile": "es.png",
"countries": ["es", "ar", "bo", "cl", "co", "cr", "do", "ec", "sv", "gt", "hn", "mx", "ni", "pa", "py", "pe", "pr", "uy", "ve"],
"requiresUnicode": false,
- "contributor": "PerikiyoXD"
+ "contributor": "PerikiyoXD",
+ "enabled": true
},
{
"id": 4,
@@ -47,7 +51,8 @@
"flagImageFile": "cn.png",
"countries": ["cn", "hk", "sg", "tw"],
"requiresUnicode": true,
- "contributor": "Renzuko_Ctone"
+ "contributor": "Renzuko_Ctone",
+ "enabled": true
},
{
"id": 5,
@@ -57,7 +62,8 @@
"flagImageFile": "sa.png",
"countries": ["dz", "bh", "eg", "iq", "jo", "kw", "lb", "ly", "ma", "om", "qa", "sa", "sy", "tn", "ae", "ye"],
"requiresUnicode": true,
- "contributor": "! KASIR"
+ "contributor": "! KASIR",
+ "enabled": true
},
{
"id": 6,
@@ -67,7 +73,8 @@
"flagImageFile": "sk.png",
"countries": ["sk"],
"requiresUnicode": false,
- "contributor": "UAKLAUS"
+ "contributor": "UAKLAUS",
+ "enabled": false
},
{
"id": 7,
@@ -77,7 +84,8 @@
"flagImageFile": "de.png",
"countries": ["de", "at", "be", "ch", "li", "lu"],
"requiresUnicode": false,
- "contributor": "Sladernimo"
+ "contributor": "Sladernimo",
+ "enabled": true
},
{
"id": 8,
@@ -87,7 +95,8 @@
"flagImageFile": "fr.png",
"countries": ["fr", "cd", "bj", "bf", "cd", "cg", "ga", "gn", "ml", "mc", "ne", "sn"],
"requiresUnicode": false,
- "contributor": "Cocam"
+ "contributor": "Cocam",
+ "enabled": false
},
{
"id": 9,
@@ -97,7 +106,8 @@
"flagImageFile": "jp.png",
"countries": ["jp"],
"requiresUnicode": true,
- "contributor": "Cocam"
+ "contributor": "Cocam",
+ "enabled": false
},
{
"id": 10,
@@ -107,6 +117,29 @@
"flagImageFile": "fi.png",
"countries": ["fi"],
"requiresUnicode": false,
- "contributor": "SIMBA_MEOW"
+ "contributor": "SIMBA_MEOW",
+ "enabled": true
+ },
+ {
+ "id": 11,
+ "englishName": "Lithuanian",
+ "stringsFile": "lithuanian.json",
+ "isoCode": "lt",
+ "flagImageFile": "lt.png",
+ "countries": ["lt"],
+ "requiresUnicode": false,
+ "contributor": "dovis",
+ "enabled": false
+ },
+ {
+ "id": 12,
+ "englishName": "Latvian",
+ "stringsFile": "latvian.json",
+ "isoCode": "lv",
+ "flagImageFile": "lv.png",
+ "countries": ["lv"],
+ "requiresUnicode": false,
+ "contributor": "YuOn",
+ "enabled": false
}
]
\ No newline at end of file
diff --git a/config/economy.json b/config/economy.json
index 15284ba5..549a9759 100644
--- a/config/economy.json
+++ b/config/economy.json
@@ -4,6 +4,7 @@
"applyUpkeep": true,
"grossIncomeMultiplier": 1.0,
"incomeTaxRate": 0.7,
+ "currencyString": "${AMOUNT}",
"upKeepCosts": {
"upKeepPerVehicle": 250,
"upKeepPerHouse": 350,
diff --git a/config/locale.json b/config/locale.json
index 5a68a5de..11c90448 100644
--- a/config/locale.json
+++ b/config/locale.json
@@ -11,7 +11,8 @@
"flagImageFile": "uk.png",
"countries": ["gb", "us", "au", "bz", "ca", "ie", "jm", "nz", "za", "tt"],
"requiresUnicode": false,
- "contributor": "Vortrex"
+ "contributor": "Vortrex",
+ "enabled": true
},
{
"id": 1,
@@ -21,7 +22,8 @@
"flagImageFile": "ru.png",
"countries": ["ru", "ua"],
"requiresUnicode": false,
- "contributor": "VNDTTS"
+ "contributor": "VNDTTS",
+ "enabled": true
},
{
"id": 2,
@@ -31,7 +33,8 @@
"flagImageFile": "pl.png",
"countries": ["pl"],
"requiresUnicode": false,
- "contributor": "Suprise444"
+ "contributor": "Suprise444",
+ "enabled": true
},
{
"id": 3,
@@ -41,7 +44,8 @@
"flagImageFile": "es.png",
"countries": ["es", "ar", "bo", "cl", "co", "cr", "do", "ec", "sv", "gt", "hn", "mx", "ni", "pa", "py", "pe", "pr", "uy", "ve"],
"requiresUnicode": false,
- "contributor": "PerikiyoXD"
+ "contributor": "PerikiyoXD",
+ "enabled": true
},
{
"id": 4,
@@ -51,7 +55,8 @@
"flagImageFile": "cn.png",
"countries": ["cn", "hk", "sg", "tw"],
"requiresUnicode": true,
- "contributor": "Renzuko_Ctone"
+ "contributor": "Renzuko_Ctone",
+ "enabled": true
},
{
"id": 5,
@@ -61,7 +66,8 @@
"flagImageFile": "sa.png",
"countries": ["dz", "bh", "eg", "iq", "jo", "kw", "lb", "ly", "ma", "om", "qa", "sa", "sy", "tn", "ae", "ye"],
"requiresUnicode": true,
- "contributor": "! KASIR"
+ "contributor": "! KASIR",
+ "enabled": true
},
{
"id": 6,
@@ -71,7 +77,8 @@
"flagImageFile": "sk.png",
"countries": ["sk"],
"requiresUnicode": false,
- "contributor": "UAKLAUS"
+ "contributor": "UAKLAUS",
+ "enabled": false
},
{
"id": 7,
@@ -81,7 +88,8 @@
"flagImageFile": "de.png",
"countries": ["de", "at", "be", "ch", "li", "lu"],
"requiresUnicode": false,
- "contributor": "Sladernimo"
+ "contributor": "Sladernimo",
+ "enabled": true
},
{
"id": 8,
@@ -91,7 +99,8 @@
"flagImageFile": "fr.png",
"countries": ["fr", "cd", "bj", "bf", "cd", "cg", "ga", "gn", "ml", "mc", "ne", "sn"],
"requiresUnicode": false,
- "contributor": "Cocam"
+ "contributor": "Cocam",
+ "enabled": false
},
{
"id": 9,
@@ -101,7 +110,8 @@
"flagImageFile": "jp.png",
"countries": ["jp"],
"requiresUnicode": true,
- "contributor": "Cocam"
+ "contributor": "Cocam",
+ "enabled": false
},
{
"id": 10,
@@ -111,7 +121,30 @@
"flagImageFile": "fi.png",
"countries": ["fi"],
"requiresUnicode": false,
- "contributor": "SIMBA_MEOW"
+ "contributor": "SIMBA_MEOW",
+ "enabled": true
+ },
+ {
+ "id": 11,
+ "englishName": "Lithuanian",
+ "stringsFile": "lithuanian.json",
+ "isoCode": "lt",
+ "flagImageFile": "lt.png",
+ "countries": ["lt"],
+ "requiresUnicode": false,
+ "contributor": "dovis",
+ "enabled": false
+ },
+ {
+ "id": 12,
+ "englishName": "Latvian",
+ "stringsFile": "latvian.json",
+ "isoCode": "lv",
+ "flagImageFile": "lv.png",
+ "countries": ["lv"],
+ "requiresUnicode": false,
+ "contributor": "YuOn",
+ "enabled": false
}
]
}
\ No newline at end of file
diff --git a/files/fonts/aurora-bold-condensed.ttf b/files/fonts/aurora-bold-condensed.ttf
new file mode 100644
index 00000000..d8dc93ce
Binary files /dev/null and b/files/fonts/aurora-bold-condensed.ttf differ
diff --git a/files/images/cursor.png b/files/images/cursor.png
new file mode 100644
index 00000000..2f19d2d6
Binary files /dev/null and b/files/images/cursor.png differ
diff --git a/meta.xml b/meta.xml
index 76c4aa4b..bb1954b3 100644
--- a/meta.xml
+++ b/meta.xml
@@ -1,5 +1,5 @@
-
+
@@ -10,7 +10,7 @@
-
+
@@ -50,6 +50,7 @@
+
@@ -85,35 +86,41 @@
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -131,11 +138,11 @@
-
+
diff --git a/scripts/client/afk.js b/scripts/client/afk.js
index 54f3adc5..1c9ced08 100644
--- a/scripts/client/afk.js
+++ b/scripts/client/afk.js
@@ -10,8 +10,8 @@
// Init AFK script
function initAFKScript() {
- logToConsole(LOG_DEBUG, "[VRR.AFK]: Initializing AFK script ...");
- logToConsole(LOG_DEBUG, "[VRR.AFK]: AFK script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.AFK]: Initializing AFK script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.AFK]: AFK script initialized!");
}
// ===========================================================================
diff --git a/scripts/client/animation.js b/scripts/client/animation.js
index 22a2ed52..274db151 100644
--- a/scripts/client/animation.js
+++ b/scripts/client/animation.js
@@ -8,6 +8,13 @@
// TYPE: Client (JavaScript)
// ===========================================================================
+function initAnimationScript() {
+ logToConsole(LOG_DEBUG, "[AGRP.Animation]: Initializing animation script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Animation]: Animation script initialized!");
+}
+
+// ===========================================================================
+
function makePedPlayAnimation(pedId, animationSlot, positionOffset) {
let ped = getElementFromId(pedId);
@@ -16,7 +23,7 @@ function makePedPlayAnimation(pedId, animationSlot, positionOffset) {
}
let animationData = getAnimationData(animationSlot);
- logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
let freezePlayer = false;
switch (animationData.moveType) {
diff --git a/scripts/client/business.js b/scripts/client/business.js
index 49fb1911..50eed775 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -17,18 +17,28 @@ class BusinessData {
this.blipModel = blipModel;
this.pickupModel = pickupModel;
this.hasInterior = hasInterior;
+ this.rentPrice = 0;
+ this.buyPrice = 0;
this.hasItems = hasItems;
this.blipId = -1;
this.labelInfoType = 0;
+ this.locked = false;
}
}
// ===========================================================================
-function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
+function initBusinessScript() {
+ logToConsole(LOG_DEBUG, "[AGRP.Business]: Initializing business script ...");
+ logToConsole(LOG_INFO, "[AGRP.Business]: Business script initialized!");
+}
- if (!areServerElementsSupported()) {
+// ===========================================================================
+
+function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
+ logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
+
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (getBusinessData(businessId) != false) {
let businessData = getBusinessData(businessId);
businessData.name = name;
@@ -36,12 +46,25 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
businessData.blipModel = blipModel;
businessData.pickupModel = pickupModel;
businessData.hasInterior = hasInterior;
+ businessData.buyPrice = buyPrice;
+ businessData.rentPrice = rentPrice;
businessData.hasItems = hasItems;
+ businessData.locked = locked;
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
+ if (hasInterior && !hasItems) {
+ businessData.labelInfoType = AGRP_PROPLABEL_INFO_ENTER;
+ } else if (!hasInterior && hasItems) {
+ businessData.labelInfoType = AGRP_PROPLABEL_INFO_BUY;
+ } else {
+ if (businessData.buyPrice > 0) {
+ businessData.labelInfoType = AGRP_PROPLABEL_INFO_BUYBIZ;
+ }
+ }
+
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been removed by the server`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
} else {
@@ -51,11 +74,11 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
//businesses.splice(businessData.index, 1);
//setAllBusinessDataIndexes();
} else {
- logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been changed by the server`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
@@ -68,20 +91,20 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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 ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} has no blip.`);
}
getServerData().businesses.push(tempBusinessData);
setAllBusinessDataIndexes();
diff --git a/scripts/client/camera.js b/scripts/client/camera.js
new file mode 100644
index 00000000..88e7649b
--- /dev/null
+++ b/scripts/client/camera.js
@@ -0,0 +1,39 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: camera.js
+// DESC: Provides camera functions and usage
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let cameraFadeEnabled = false;
+let cameraFadeIn = false;
+let cameraFadeStart = 0;
+let cameraFadeDuration = 0;
+let cameraFadeColour = 0;
+
+// ===========================================================================
+
+function processCameraFadeRendering() {
+ if (cameraFadeEnabled) {
+ let finishTime = cameraFadeStart + cameraFadeDuration;
+ if (sdl.ticks >= finishTime) {
+ cameraFadeEnabled = false;
+ cameraFadeDuration = 0;
+ cameraFadeStart = 0;
+ } else {
+ let currentTick = sdl.ticks - cameraFadeStart;
+ let progressPercent = Math.ceil(currentTick * 100 / cameraFadeDuration);
+ let rgbaArray = rgbaArrayFromToColour(cameraFadeColour);
+
+ let alpha = (cameraFadeIn) ? Math.ceil(255 / progressPercent) : Math.ceil(progressPercent / 255);
+
+ cameraFadeColour = toColour(rgbaArray[0], rgbaArray[1], rgbaArray[2], alpha);
+ graphics.drawRectangle(null, toVector2(0, 0), toVector2(game.width, game.height), cameraFadeColour, cameraFadeColour, cameraFadeColour, cameraFadeColour);
+ }
+ }
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/chat.js b/scripts/client/chat.js
index c5f107d8..13bc908d 100644
--- a/scripts/client/chat.js
+++ b/scripts/client/chat.js
@@ -29,11 +29,11 @@ let scrollDownKey = false;
// ===========================================================================
function initChatBoxScript() {
- logToConsole(LOG_DEBUG, "[VRR.Chat]: Initializing chat script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Chat]: Initializing chat script ...");
scrollUpKey = getKeyIdFromParams("pageup");
scrollDownKey = getKeyIdFromParams("pagedown");
bindChatBoxKeys();
- logToConsole(LOG_DEBUG, "[VRR.Chat]: Chat script initialized!");
+ logToConsole(LOG_INFO, "[AGRP.Chat]: Chat script initialized!");
}
// ===========================================================================
@@ -53,7 +53,7 @@ function unBindChatBoxKeys() {
// ===========================================================================
function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, second) {
- logToConsole(LOG_DEBUG, `[VRR.Chat]: Received chatbox message from server: ${messageString}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Chat]: Received chatbox message from server: ${messageString}`);
// Just in case it's hidden by auto hide
//setChatWindowEnabled(true);
@@ -73,21 +73,21 @@ function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, se
let outputString = messageString;
if (chatTimeStampsEnabled == true) {
- //timeStampString = `{TIMESTAMPCOLOUR}[${findResourceByName("agrp_time").exports.getTimeStampOutput(timeStamp)}]{MAINCOLOUR}`;
- let timeStampString = `{TIMESTAMPCOLOUR}[${hour}:${minute}:${second}] `;
+ let colourRGBA = rgbaArrayFromToColour(colour);
+ let timeStampString = `{TIMESTAMPCOLOUR}[${hour}:${minute}:${second}][${rgbToHex(colourRGBA[0], colourRGBA[1], colourRGBA[2])}] `;
outputString = `${timeStampString}${messageString}`;
}
- logToConsole(LOG_DEBUG, `[VRR.Chat]: Changed colours in string: ${outputString}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Chat]: Changed colours in string: ${outputString}`);
outputString = replaceColoursInMessage(`${outputString}`);
if (chatEmojiEnabled == true) {
- logToConsole(LOG_DEBUG, `[VRR.Chat]: Enabled emoji in string: ${outputString}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Chat]: Enabled emoji in string: ${outputString}`);
outputString = replaceEmojiInMessage(outputString);
}
if (profanityFilterEnabled == true) {
- logToConsole(LOG_DEBUG, `[VRR.Chat]: Removed profanity in string: ${outputString}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Chat]: Removed profanity in string: ${outputString}`);
outputString = replaceProfanityInMessage(outputString);
}
@@ -163,12 +163,9 @@ function updateChatBox() {
if (typeof chatBoxHistory[i] != "undefined") {
let outputString = chatBoxHistory[i][0];
if (chatTimeStampsEnabled == true) {
- //let timeStampDate = new Date(chatBoxHistory[i][2]);
- //let timeStampText = `${timeStampDate.getHours()}:${timeStampDate.getMinutes()}:${timeStampDate.getSeconds()}`;
- //let timeStampText = findResourceByName("agrp_time").exports.getTimeStampOutput(chatBoxHistory[i][2]);
let timeStampText = `${chatBoxHistory[i][2]}:${chatBoxHistory[i][3]}:${chatBoxHistory[i][4]}`;
-
- outputString = `{TIMESTAMPCOLOUR}[${timeStampText}]{MAINCOLOUR} ${chatBoxHistory[i][0]}`;
+ let colourRGBA = rgbaArrayFromToColour(chatBoxHistory[i][1]);
+ outputString = `{TIMESTAMPCOLOUR}[${timeStampText}][${rgbToHex(colourRGBA[0], colourRGBA[1], colourRGBA[2])}] ${chatBoxHistory[i][0]}`;
}
outputString = replaceColoursInMessage(outputString);
diff --git a/scripts/client/cursor.js b/scripts/client/cursor.js
new file mode 100644
index 00000000..f1b231fe
--- /dev/null
+++ b/scripts/client/cursor.js
@@ -0,0 +1,40 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: cursor.js
+// DESC: Provides cursor functions and usage
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let cursorImage = null;
+let cursorImagePath = "files/images/cursor.png";
+let cursorSize = toVector2(16.0, 24.0);
+
+// ===========================================================================
+
+function initCursorScript() {
+ logToConsole(LOG_DEBUG, "[AGRP.Cursor]: Initializing cursor script ...");
+ let cursorStream = openFile(cursorImagePath);
+ if (cursorStream != null) {
+ cursorImage = graphics.loadPNG(cursorStream);
+ cursorStream.close();
+ }
+
+ logToConsole(LOG_INFO, "[AGRP.Cursor]: Cursor script initialized!");
+}
+
+// ===========================================================================
+
+function processMouseCursorRendering() {
+ if (isGameFeatureSupported("mouseCursor")) {
+ return false;
+ }
+
+ if (gui.cursorEnabled) {
+ graphics.drawRectangle(cursorImage, gui.cursorPosition, cursorSize);
+ }
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/games/5-card-poker.js b/scripts/client/economy.js
similarity index 72%
rename from scripts/client/gui/games/5-card-poker.js
rename to scripts/client/economy.js
index d254829b..9f5b54d2 100644
--- a/scripts/client/gui/games/5-card-poker.js
+++ b/scripts/client/economy.js
@@ -3,7 +3,11 @@
// https://github.com/VortrexFTW/agrp_main
// (c) 2022 Asshat Gaming
// ===========================================================================
-// FILE: 5cardpoker.js
-// DESC: Provides 5-card poker games GUI
+// FILE: economy.js
+// DESC: Provides economy functions
// TYPE: Client (JavaScript)
+// ===========================================================================
+
+
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 989dfd3a..056fc09d 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -9,9 +9,9 @@
// ===========================================================================
function initEventScript() {
- logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Event]: Initializing event script ...");
addAllEventHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Event]: Event script initialized!");
}
// ===========================================================================
@@ -41,15 +41,15 @@ function addAllEventHandlers() {
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
}
}
+
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ addEventHandler("OnMapLoaded", onMapLoaded);
+ }
}
// ===========================================================================
function onResourceStart(event, resource) {
- if (resource == thisResource) {
- sendResourceStartedSignalToServer();
- }
-
if (resource == findResourceByName("v-events")) {
// Remove and re-add events, in case v-events was loaded after agrp_main
removeEventHandler("OnPedEnteredVehicleEx");
@@ -62,13 +62,20 @@ function onResourceStart(event, resource) {
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
}
- //garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
+
+ if (resource == thisResource) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStart called - Sending signal to server`);
+ garbageCollectorInterval = setInterval(collectAllGarbage, 1000 * 60);
+ localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
+ sendResourceStartedSignalToServer();
+ }
}
// ===========================================================================
function onResourceStop(event, resource) {
if (resource == thisResource) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStop called - Sending signal to server`);
sendResourceStoppedSignalToServer();
}
}
@@ -77,6 +84,8 @@ function onResourceStop(event, resource) {
function onResourceReady(event, resource) {
if (resource == thisResource) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceReady called - Sending signal to server`);
+ loadLocaleConfig();
sendResourceReadySignalToServer();
}
}
@@ -84,6 +93,7 @@ function onResourceReady(event, resource) {
// ===========================================================================
function onProcess(event, deltaTime) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Event] onProcess`);
if (localPlayer == null) {
return false;
}
@@ -101,9 +111,9 @@ function onProcess(event, deltaTime) {
processNearbyPickups();
processVehiclePurchasing();
processVehicleBurning();
+ processVehicleCruiseControl();
//checkChatBoxAutoHide(); // Will be uncommented on 1.4.0 GTAC update
//processVehicleFires();
-
}
// ===========================================================================
@@ -118,6 +128,9 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
// ===========================================================================
function onDrawnHUD(event) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Event] HUD drawn`);
+ processMouseCursorRendering();
+
if (!renderHUD) {
return false;
}
@@ -139,7 +152,7 @@ function onDrawnHUD(event) {
// ===========================================================================
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Ped ${wastedPed.name} died`);
wastedPed.clearWeapons();
}
@@ -152,9 +165,12 @@ function onElementStreamIn(event, element) {
// ===========================================================================
function onPedExitedVehicle(event, ped, vehicle, seat) {
- //logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
//sendNetworkEventToServer("agrp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ cruiseControlEnabled = false;
+ cruiseControlSpeed = 0.0;
+
if (localPlayer != null) {
if (ped == localPlayer) {
if (areServerElementsSupported()) {
@@ -172,19 +188,37 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
// ===========================================================================
+function onPedExitingVehicle(event, ped, vehicle, seat) {
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
+ //sendNetworkEventToServer("agrp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
+
+ if (localPlayer != null) {
+ if (ped == localPlayer) {
+ cruiseControlEnabled = false;
+ cruiseControlSpeed = 0.0;
+ }
+ }
+}
+
+// ===========================================================================
+
function onPedEnteredVehicle(event, ped, vehicle, seat) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Ped entered vehicle`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Ped entered vehicle`);
//sendNetworkEventToServer("agrp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ cruiseControlEnabled = false;
+ cruiseControlSpeed = 0.0;
if (localPlayer != null) {
if (ped == localPlayer) {
if (areServerElementsSupported()) {
if (inVehicleSeat == 0) {
- //setVehicleEngine(vehicle.id, false);
- if (!inVehicle.engine) {
- parkedVehiclePosition = inVehicle.position;
- parkedVehicleHeading = inVehicle.heading;
+ //parkedVehiclePosition = inVehicle.position;
+ //parkedVehicleHeading = inVehicle.heading;
+ if (doesEntityDataExist(vehicle, "agrp.server") == true) {
+ setVehicleEngine(vehicle.id, false);
+ setVehicleEngine(vehicle.id, getEntityData(vehicle, "agrp.engine"));
+ //setLocalPlayerControlState(false, false);
}
}
}
@@ -197,7 +231,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
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}`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
if (damagedEntity.isType(ELEMENT_PLAYER)) {
if (damagedEntity == localPlayer) {
@@ -260,4 +294,10 @@ function onEntityProcess(event, entity) {
}
+// ===========================================================================
+
+function onMapLoaded(mapName) {
+ sendNetworkEventToServer("agrp.mapLoaded", mapName);
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gps.js b/scripts/client/gps.js
index 81adfaa4..4e1e2c6c 100644
--- a/scripts/client/gps.js
+++ b/scripts/client/gps.js
@@ -17,7 +17,7 @@ let gpsBlipBlinkTimer = null;
// ===========================================================================
function showGPSLocation(position, colour) {
- logToConsole(LOG_DEBUG, `[VRR.GPS] Showing gps location`);
+ logToConsole(LOG_DEBUG, `[AGRP.GPS] Showing gps location`);
if (getMultiplayerMod() == AGRP_MPMOD_GTAC) {
if (getGame() == AGRP_GAME_GTA_SA) {
// Server-side spheres don't show in GTA SA for some reason.
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 98058341..f0d06d73 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -41,14 +41,14 @@ let creatingCharacter = false;
// ===========================================================================
function initGUIScript() {
- logToConsole(LOG_DEBUG, "[VRR.GUI]: Initializing GUI script ...");
- logToConsole(LOG_DEBUG, "[VRR.GUI]: GUI script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.GUI]: Initializing GUI script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.GUI]: GUI script initialized!");
}
// ===========================================================================
function initGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Initializing GUI ...`);
initLoginGUI();
initRegisterGUI();
@@ -62,13 +62,19 @@ function initGUI() {
initResetPasswordGUI();
initChangePasswordGUI();
initLocaleChooserGUI();
+ //initInventoryGUI();
+ //initInventoryBulkGUI();
+ //initClanManagerGUI();
+ //initBusinessManagerGUI();
+ //initHouseManagerGUI();
+ //initFiveCardPokerGUI();
+ //initBettingGUI();
+ //initBlackJackGUI();
closeAllWindows();
guiReady = true;
- logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
-
- loadLocaleConfig();
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] All GUI created successfully!`);
sendNetworkEventToServer("agrp.guiReady", true);
};
@@ -76,7 +82,7 @@ function initGUI() {
// ===========================================================================
function closeAllWindows() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all GUI windows`);
infoDialog.window.shown = false;
yesNoDialog.window.shown = false;
errorDialog.window.shown = false;
@@ -89,6 +95,14 @@ function closeAllWindows() {
passwordReset.window.shown = false;
passwordChange.window.shown = false;
localeChooser.window.shown = false;
+ //houseManager.window.shown = false;
+ //businessManager.window.shown = false;
+ //clanManager.window.shown = false;
+ //inventoryGUI.window.shown = false;
+ //inventoryBulkGUI.window.shown = false;
+ //bettingGUI.window.shown = false;
+ //blackJackGUI.window.shown = false;
+ //fiveCardPokerGUI.window.shown = false;
mexui.setInput(false);
mexui.focusedControl = false;
@@ -157,13 +171,45 @@ function isAnyGUIActive() {
return true;
}
+ //if (clanManager.window.shown == true) {
+ // return true;
+ //}
+
+ //if (businessManager.window.shown == true) {
+ // return true;
+ //}
+
+ //if (houseManager.window.shown == true) {
+ // return true;
+ //}
+
+ //if (inventoryGUI.window.shown == true) {
+ // return true;
+ //}
+
+ //if (inventoryBulkGUI.window.shown == true) {
+ // return true;
+ //}
+
+ //if (bettingGUI.window.shown == true) {
+ // return true;
+ //}
+
+ //if (blackJackGUI.window.shown == true) {
+ // return true;
+ //}
+
+ //if (fiveCardPokerGUI.window.shown == true) {
+ // return true;
+ //}
+
return false;
}
// ===========================================================================
function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
primaryColour = [red1, green1, blue1];
secondaryColour = [red2, green2, blue2];
primaryTextColour = [red3, green3, blue3];
@@ -183,41 +229,45 @@ function hideAllGUI() {
// ===========================================================================
function processGUIKeyPress(keyCode) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Processing key press: ${keyCode}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Processing key press: ${keyCode}`);
+
+ if (!guiReady) {
+ return false;
+ }
if (!isAnyGUIActive()) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] GUI is not active. Cancelling keypress processing.`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] GUI is not active. Cancelling keypress processing.`);
return false;
}
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is submit (${guiSubmitKey})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is submit (${guiSubmitKey})`);
if (guiSubmitKey != false) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Calling submit key function`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling submit key function`);
guiSubmitKey.call();
}
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is left (${guiLeftKey})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is left (${guiLeftKey})`);
if (guiLeftKey != false) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Calling left key function`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling left key function`);
guiLeftKey.call();
}
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is right (${guiRightKey})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is right (${guiRightKey})`);
if (guiRightKey != false) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Calling right key function`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling right key function`);
guiRightKey.call();
}
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is down (${guiDownKey})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is down (${guiDownKey})`);
if (guiDownKey != false) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Calling down key function`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling down key function`);
guiDownKey.call();
}
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is up (${guiUpKey})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is up (${guiUpKey})`);
if (guiUpKey != false) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Calling up key function`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling up key function`);
guiUpKey.call();
}
}
@@ -234,6 +284,10 @@ function processToggleGUIKeyPress(keyCode) {
// ===========================================================================
function resetGUIStrings() {
+ if (!guiReady) {
+ return false;
+ }
+
// Login GUI
login.messageLabel.text = getLocaleString("GUILoginWindowLabelEnterPassword");
login.passwordInput.placeholder = getLocaleString("GUILoginWindowPasswordPlaceholder");
@@ -277,4 +331,16 @@ function resetGUIStrings() {
newCharacter.firstNameInput.placeholder = getLocaleString("GUINewCharacterFirstNamePlaceholder");
newCharacter.lastNameInput.placeholder = getLocaleString("GUINewCharacterLastNamePlaceholder");
newCharacter.createCharacterButton.text = toUpperCase(getLocaleString("GUINewCharacterSubmitButton"));
-}
\ No newline at end of file
+}
+
+// ===========================================================================
+
+function dimAllGUIElementsInWindow(guiObject) {
+ for (let i in guiObject) {
+ if (i != "window") {
+ guiObject[i].shown = false;
+ }
+ }
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/account-settings.js b/scripts/client/gui/account-settings.js
index 40d91e07..05111540 100644
--- a/scripts/client/gui/account-settings.js
+++ b/scripts/client/gui/account-settings.js
@@ -3,7 +3,23 @@
// https://github.com/VortrexFTW/agrp_main
// (c) 2022 Asshat Gaming
// ===========================================================================
-// FILE: account-settings.js
-// DESC: Provides account settings GUI
+// FILE: clanmgr.js
+// DESC: Provides clan manager GUI
// TYPE: Client (JavaScript)
// ===========================================================================
+
+let clanManager = {
+ window: null,
+ generalTabButton: null,
+ ranksTabButton: null,
+ membersTabButton: null,
+ vehiclesTabButton: null,
+ businessesTabButton: null,
+ housesTabButton: null,
+};
+
+// ===========================================================================
+
+function initClanManagerGUI() {
+
+}
\ No newline at end of file
diff --git a/scripts/client/gui/business-manager.js b/scripts/client/gui/business-manager.js
index 055cfb32..d501c49a 100644
--- a/scripts/client/gui/business-manager.js
+++ b/scripts/client/gui/business-manager.js
@@ -6,4 +6,80 @@
// FILE: business-manager.js
// DESC: Provides business manager GUI
// TYPE: Client (JavaScript)
+// ===========================================================================
+
+/*
+class BusinessManagerData {
+ constructor(businessIndex, name, locked, entranceFee, buyPrice, rentPrice, floorItems, storageItems) {
+ this.businessIndex = businessIndex;
+ this.name = name;
+ this.locked = locked;
+ this.entranceFee = entranceFee;
+ this.buyPrice = buyPrice;
+ this.rentPrice = rentPrice;
+ this.till = till;
+ this.ownerName = ownerName;
+ this.floorItems = floorItems;
+ this.storageItems = storageItems;
+ }
+}
+
+// ===========================================================================
+
+let businessManager = {
+ window: null,
+ generalTabButton: null,
+ floorItemsTab: null,
+ storageItemsTab: null,
+ orderItemsTab: null,
+ data: null,
+
+ // General Tab
+ businessName: null,
+ businessOwnerName: null,
+ businessEntranceFee: null,
+ businessBuyPrice: null,
+ businessRentPrice: null,
+
+};
+
+// ===========================================================================
+
+function initBusinessManagerGUI() {
+
+}
+
+// ===========================================================================
+
+function showBusinessManagerGUI() {
+
+}
+
+// ===========================================================================
+
+function hideBusinessManagerGUI() {
+
+}
+
+// ===========================================================================
+
+function updateBusinessManagerGUIStrings() {
+
+}
+
+// ===========================================================================
+
+function receiveBusinessManagerData(businessIndex, name, locked, entranceFee, buyPrice, rentPrice, floorItems, storageItems) {
+ let businessManagerData = new BusinessManagerData(businessIndex, name, locked, entranceFee, buyPrice, rentPrice, floorItems, storageItems);
+ businessManager.data = businessManagerData;
+ updateBusinessManagerGUIStrings();
+}
+
+// ===========================================================================
+
+function saveBusinessData() {
+ sendNetworkEventToServer("agrp.businessManagerSave", businessManager.data.businessIndex);
+}
+*/
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/change-password.js b/scripts/client/gui/change-password.js
index ee6c8686..2bb60ede 100644
--- a/scripts/client/gui/change-password.js
+++ b/scripts/client/gui/change-password.js
@@ -20,7 +20,7 @@ let passwordChange = {
// ===========================================================================
function initChangePasswordGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password change GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password change GUI ...`);
passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -111,13 +111,13 @@ function initChangePasswordGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkChangePassword);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created change password GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created change password GUI`);
}
// ===========================================================================
function passwordChangeFailed(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports change password failed. Reason: ${errorMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
passwordChange.messageLabel.text = errorMessage;
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
passwordChange.passwordInput.text = "";
@@ -128,14 +128,14 @@ function passwordChangeFailed(errorMessage) {
// ===========================================================================
function checkChangePassword() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password change with server ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password change with server ...`);
sendNetworkEventToServer("agrp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
}
// ===========================================================================
function showChangePasswordGUI(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing change password window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing change password window`);
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
@@ -150,7 +150,7 @@ function showChangePasswordGUI(errorMessage) {
// ===========================================================================
function passwordChangeSuccess() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password change was successful`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password change was successful`);
guiSubmitKey = false;
closeAllWindows();
}
diff --git a/scripts/client/gui/character-select.js b/scripts/client/gui/character-select.js
index 2961fe73..7bec554f 100644
--- a/scripts/client/gui/character-select.js
+++ b/scripts/client/gui/character-select.js
@@ -24,7 +24,7 @@ let characterSelect = {
// ===========================================================================
function initCharacterSelectGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating character select GUI ...`);
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -151,18 +151,18 @@ function initCharacterSelectGUI() {
borderColour: toColour(0, 0, 0, 0),
}
});
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created character select GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created character select GUI`);
}
// ===========================================================================
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing character selection window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing character selection window`);
setChatWindowEnabled(false);
mexui.setInput(true);
characterSelect.nameText.text = `${firstName} ${lastName}`;
- characterSelect.cashText.text = `Money: $${cash}`;
+ characterSelect.cashText.text = `Money: ${getCurrencyString(cash)}`;
characterSelect.clanText.text = `Clan: ${clan}`;
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
@@ -179,39 +179,39 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski
function showNewCharacter() {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character dialog window`);
showNewCharacterGUI();
}
// ===========================================================================
function selectNextCharacter() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting next character info from server for character select window`);
sendNetworkEventToServer("agrp.nextCharacter");
}
// ===========================================================================
function selectPreviousCharacter() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting previous character info from server for character select window`);
sendNetworkEventToServer("agrp.previousCharacter");
}
// ===========================================================================
function selectThisCharacter() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Tell server the current shown character was selected in character select window`);
sendNetworkEventToServer("agrp.selectCharacter");
}
// ===========================================================================
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Updating character info with data from server`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Updating character info with data from server`);
setChatWindowEnabled(false);
characterSelect.window.shown = false;
characterSelect.nameText.text = `${firstName} ${lastName}`;
- characterSelect.cashText.text = `Money: $${cash}`;
+ characterSelect.cashText.text = `Money: ${getCurrencyString(cash)}`;
characterSelect.clanText.text = `Clan: ${clan}`;
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
@@ -230,7 +230,7 @@ function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, s
// ===========================================================================
function characterSelectSuccess() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports character selection was successful`);
closeAllWindows();
}
diff --git a/scripts/client/gui/games/5cardpoker.js b/scripts/client/gui/games/5cardpoker.js
new file mode 100644
index 00000000..47ecbfa0
--- /dev/null
+++ b/scripts/client/gui/games/5cardpoker.js
@@ -0,0 +1,40 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: 5cardpoker.js
+// DESC: Provides 5-card poker games GUI
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let fiveCardPokerGUI = {
+ window: null,
+}
+
+function initFiveCardPokerGUI() {
+ // Render a five card poker game in MexUI
+ //logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating five-card poker GUI ...`);
+ fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', {
+ main: {
+ backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
+ },
+ title: {
+ textSize: 11.0,
+ textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
+ backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
+ },
+ icon: {
+ textSize: 0.0,
+ textColour: toColour(0, 0, 0, 0),
+ backgroundColour: toColour(0, 0, 0, 0),
+ },
+ });
+ fiveCardPokerGUI.window.titleBarShown = false;
+
+ fiveCardPokerGUI.window.shown = false;
+
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created five card poker GUI`);
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/games/blackjack.js b/scripts/client/gui/games/blackjack.js
index c4bc9a5b..5d65747a 100644
--- a/scripts/client/gui/games/blackjack.js
+++ b/scripts/client/gui/games/blackjack.js
@@ -23,7 +23,7 @@ let dealerCards = [];
function initBlackJackGUI() {
// Render a blackjack game in MexUI
- //logToConsole(LOG_DEBUG, `[VRR.GUI] Creating blackjack GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`);
blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
@@ -43,7 +43,7 @@ function initBlackJackGUI() {
blackJackGUI.window.shown = false;
- //logToConsole(LOG_DEBUG, `[VRR.GUI] Created blackjack GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`);
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/inventory.js b/scripts/client/gui/inventory.js
new file mode 100644
index 00000000..fcfd1a45
--- /dev/null
+++ b/scripts/client/gui/inventory.js
@@ -0,0 +1,45 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: inventory.js
+// DESC: Provides inventory dialog box GUI
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let inventoryGUI = [
+ {
+ window: null,
+ },
+ {
+ window: null,
+ },
+];
+
+// ===========================================================================
+
+function initInventoryGUI() {
+
+}
+
+// ===========================================================================
+
+function closeAllInventoryGUI() {
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all inventory GUI`);
+ for (let i in inventoryGUI) {
+ inventoryGUI[i].window.shown = false;
+ }
+ mexui.setInput(false);
+}
+
+// ===========================================================================
+
+function showInventoryGUI(inventoryIndex, items) {
+ closeAllWindows();
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
+ inventoryGUI[inventoryIndex].window.shown = true;
+ mexui.setInput(true);
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/inventorybulk.js b/scripts/client/gui/inventorybulk.js
new file mode 100644
index 00000000..d311a5d9
--- /dev/null
+++ b/scripts/client/gui/inventorybulk.js
@@ -0,0 +1,45 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: inventorybulk.js
+// DESC: Provides bulk inventory box GUI
+// TYPE: Client (JavaScript)
+// ===========================================================================
+
+let inventoryBulkGUI = [
+ {
+ window: null,
+ },
+ {
+ window: null,
+ },
+];
+
+// ===========================================================================
+
+function initInventoryBulkGUI() {
+
+}
+
+// ===========================================================================
+
+function closeAllInventoryBulkGUI() {
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all bulk inventory GUI`);
+ for (let i in inventoryBulkGUI) {
+ inventoryBulkGUI[i].window.shown = false;
+ }
+ mexui.setInput(false);
+}
+
+// ===========================================================================
+
+function showInventoryBulkGUI(inventoryIndex, items) {
+ closeAllWindows();
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
+ inventoryBulkGUI[inventoryIndex].window.shown = true;
+ mexui.setInput(true);
+}
+
+// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/locale-chooser.js b/scripts/client/gui/locale-chooser.js
index 71db1bad..b5fe6718 100644
--- a/scripts/client/gui/locale-chooser.js
+++ b/scripts/client/gui/locale-chooser.js
@@ -20,7 +20,7 @@ let flagImageGap = toVector2(5, 5);
// ===========================================================================
function initLocaleChooserGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating locale chooser GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating locale chooser GUI ...`);
localeChooser.window = mexui.window(game.width / 2 - 200, game.height - 150, 60, 60, 'Choose a language', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
@@ -40,15 +40,13 @@ function initLocaleChooserGUI() {
localeChooser.window.shown = false;
- loadLocaleConfig();
-
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created locale chooser GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created locale chooser GUI`);
}
// ===========================================================================
function closeLocaleChooserGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Closing locale chooser window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing locale chooser window`);
localeChooser.window.shown = false;
for (let i in localeChooser.flagImages) {
localeChooser.flagImages[i].shown = false;
@@ -59,9 +57,6 @@ function closeLocaleChooserGUI() {
// ===========================================================================
function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
- // Disabled for now until image loading crash can be fixed
- return false;
-
if (position.x != 0.0 && position.y != 0.0) {
localeChooser.window.position = position;
} else {
@@ -69,7 +64,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
}
//closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing locale chooser window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing locale chooser window`);
mexui.setInput(true);
localeChooser.window.shown = true;
@@ -81,7 +76,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
// ===========================================================================
function toggleLocaleChooserGUI() {
- if (localeChooser.window.shown) {
+ if (localeChooser.window.shown == true) {
closeLocaleChooserGUI();
} else {
showLocaleChooserGUI();
@@ -91,14 +86,14 @@ function toggleLocaleChooserGUI() {
// ===========================================================================
function localeChooserSetLocale(localeId) {
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Asking server to change locale to ${localeId}`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Asking server to change locale to ${localeId}`);
sendLocaleSelectToServer(localeId);
}
// ===========================================================================
function resetLocaleChooserOptions() {
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Resetting locale chooser options`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Resetting locale chooser options`);
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
let tempLocaleOptions = getAvailableLocaleOptions();
@@ -122,7 +117,7 @@ function resetLocaleChooserOptions() {
localeChooser.flagImages[i].shown = false;
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
//localeChooser.activeRingImages.push(activeRingImage);
}
diff --git a/scripts/client/gui/login.js b/scripts/client/gui/login.js
index e739f5af..15e06828 100644
--- a/scripts/client/gui/login.js
+++ b/scripts/client/gui/login.js
@@ -43,7 +43,7 @@ let loginHTML =
// ===========================================================================
function initLoginGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating login GUI ...`);
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -109,7 +109,7 @@ function initLoginGUI() {
login.loginButton = login.window.button(20, 205, 260, 30, 'LOGIN', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
+ textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 12.0,
textFont: mainFont,
textAlign: 0.5,
@@ -122,7 +122,7 @@ function initLoginGUI() {
login.forgotPasswordButton = login.window.button(180, 240, 100, 15, 'RESET PASS', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
- textColour: toColour(0, 0, 0, 255),
+ textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 8.0,
textFont: mainFont,
textAlign: 0.5,
@@ -144,14 +144,14 @@ function initLoginGUI() {
},
});
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created login GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created login GUI`);
}
// ===========================================================================
function showLoginGUI() {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing login window`);
setChatWindowEnabled(false);
mexui.setInput(true);
login.window.shown = true;
@@ -165,14 +165,14 @@ function showLoginGUI() {
// ===========================================================================
function checkLogin() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking login with server ...`);
sendNetworkEventToServer("agrp.checkLogin", login.passwordInput.lines[0]);
}
// ===========================================================================
function loginFailed(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login failed`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login failed`);
login.messageLabel.text = errorMessage;
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
login.passwordInput.text = "";
@@ -181,7 +181,7 @@ function loginFailed(errorMessage) {
// ===========================================================================
function loginSuccess() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login was successful`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login was successful`);
guiSubmitKey = false;
closeAllWindows();
}
@@ -190,7 +190,7 @@ function loginSuccess() {
function switchToPasswordResetGUI() {
//closeAllWindows();
- //logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
+ //logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset dialog window`);
//showResetPasswordGUI();
sendNetworkEventToServer("agrp.checkResetPassword", "");
return false;
diff --git a/scripts/client/gui/new-character.js b/scripts/client/gui/new-character.js
index ab3a2739..be4d90d0 100644
--- a/scripts/client/gui/new-character.js
+++ b/scripts/client/gui/new-character.js
@@ -20,7 +20,7 @@ let newCharacter = {
// ===========================================================================
function initNewCharacterGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating new character GUI ...`);
newCharacter.window = mexui.window(getScreenWidth() / 2 - 130, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -111,13 +111,13 @@ function initNewCharacterGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkNewCharacter);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created new character GUI`);
}
// ===========================================================================
function newCharacterFailed(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
newCharacter.messageLabel.text = errorMessage;
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
newCharacter.firstNameInput.text = "";
@@ -135,7 +135,7 @@ function newCharacterFailed(errorMessage) {
// ===========================================================================
function checkNewCharacter() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking new character with server ...`);
if (newCharacter.firstNameInput.lines[0].length < 2) {
return false;
}
@@ -153,7 +153,7 @@ function checkNewCharacter() {
// ===========================================================================
function showNewCharacterGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character window`);
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
diff --git a/scripts/client/gui/register.js b/scripts/client/gui/register.js
index 7208bdc2..7c352591 100644
--- a/scripts/client/gui/register.js
+++ b/scripts/client/gui/register.js
@@ -21,7 +21,7 @@ let register = {
// ===========================================================================
function initRegisterGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating register GUI ...`);
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -131,13 +131,13 @@ function initRegisterGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkRegistration);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created register GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created register GUI`);
}
// ===========================================================================
function registrationFailed(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration failed. Reason: ${errorMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
register.messageLabel.text = errorMessage;
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
register.passwordInput.text = "";
@@ -148,14 +148,14 @@ function registrationFailed(errorMessage) {
// ===========================================================================
function checkRegistration() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking registration with server ...`);
sendNetworkEventToServer("agrp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
}
// ===========================================================================
function showRegistrationGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing registration window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing registration window`);
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
@@ -171,7 +171,7 @@ function showRegistrationGUI() {
// ===========================================================================
function registrationSuccess() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration was successful`);
guiSubmitKey = false;
closeAllWindows();
}
diff --git a/scripts/client/gui/reset-password.js b/scripts/client/gui/reset-password.js
index 67020b1d..0a776826 100644
--- a/scripts/client/gui/reset-password.js
+++ b/scripts/client/gui/reset-password.js
@@ -21,7 +21,7 @@ let passwordReset = {
// ===========================================================================
function initResetPasswordGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password reset GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password reset GUI ...`);
passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -121,14 +121,14 @@ function initResetPasswordGUI() {
},
});
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created password reset GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created password reset GUI`);
}
// ===========================================================================
function showResetPasswordGUI() {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset window`);
setChatWindowEnabled(false);
mexui.setInput(true);
passwordReset.window.shown = true;
@@ -142,14 +142,14 @@ function showResetPasswordGUI() {
// ===========================================================================
function checkResetPassword() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
sendNetworkEventToServer("agrp.checkResetPassword", passwordReset.emailInput.lines[0]);
}
// ===========================================================================
function resetPasswordFailed(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password reset failed`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password reset failed`);
passwordReset.messageLabel.text = errorMessage;
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
passwordReset.emailInput.text = "";
@@ -158,7 +158,7 @@ function resetPasswordFailed(errorMessage) {
// ===========================================================================
function resetPasswordCodeInputGUI() {
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
closeAllWindows();
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
@@ -173,7 +173,7 @@ function resetPasswordCodeInputGUI() {
// ===========================================================================
function resetPasswordEmailInputGUI() {
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.GUI] Server reports password reset request was approved. Asking for email ...`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset request was approved. Asking for email ...`);
closeAllWindows();
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
diff --git a/scripts/client/gui/simple-error.js b/scripts/client/gui/simple-error.js
index 33745858..05456a4e 100644
--- a/scripts/client/gui/simple-error.js
+++ b/scripts/client/gui/simple-error.js
@@ -17,7 +17,7 @@ let errorDialog = {
// ===========================================================================
function initErrorDialogGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating error GUI ...`);
errorDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'ERROR', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -59,14 +59,14 @@ function initErrorDialogGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, closeErrorDialog);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created error GUI ...`);
}
// ===========================================================================
function showErrorGUI(errorMessage, errorTitle, buttonText) {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
setChatWindowEnabled(false);
mexui.setInput(true);
errorDialog.messageLabel.text = errorMessage;
@@ -78,7 +78,7 @@ function showErrorGUI(errorMessage, errorTitle, buttonText) {
// ===========================================================================
function closeErrorDialog() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing error dialog`);
errorDialog.window.shown = false;
mexui.setInput(false);
}
diff --git a/scripts/client/gui/simple-info.js b/scripts/client/gui/simple-info.js
index db98d3a6..cec2a458 100644
--- a/scripts/client/gui/simple-info.js
+++ b/scripts/client/gui/simple-info.js
@@ -17,7 +17,7 @@ let infoDialog = {
// ===========================================================================
function initInfoDialogGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating info dialog GUI ...`);
infoDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'Information', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -58,13 +58,13 @@ function initInfoDialogGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, closeInfoDialog);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created info dialog GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created info dialog GUI`);
}
// ===========================================================================
function closeInfoDialog() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Closing info dialog`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing info dialog`);
infoDialog.window.shown = false;
mexui.setInput(false);
}
@@ -73,7 +73,7 @@ function closeInfoDialog() {
function showInfoGUI(infoMessage, infoTitle, buttonText) {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
mexui.setInput(true);
infoDialog.messageLabel.text = infoMessage;
infoDialog.okayButton.text = buttonText;
diff --git a/scripts/client/gui/simple-list.js b/scripts/client/gui/simple-list.js
index ec4c26be..2e8084bb 100644
--- a/scripts/client/gui/simple-list.js
+++ b/scripts/client/gui/simple-list.js
@@ -12,12 +12,14 @@ let listDialog = {
window: null,
messageLabel: null,
listGrid: null,
+
+ listRows: [],
};
// ===========================================================================
function initListGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating list dialog GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating list dialog GUI ...`);
listDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 500, 'List', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -71,14 +73,14 @@ function initListGUI() {
}
}
});
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created list dialog GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created list dialog GUI`);
}
// ===========================================================================
function showListGUI() {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing list window`);
setChatWindowEnabled(false);
mexui.setInput(true);
listDialog.window.shown = true;
@@ -90,19 +92,56 @@ function showListGUI() {
// ===========================================================================
function checkListDialogSelection() {
+ if (!listDialog.listGrid.activeRow) {
+ return false;
+ }
+ sendNetworkEventToServer("agrp.list.select", listDialog.listGrid.activeRow.getEntryIndex());
}
// ===========================================================================
function selectPreviousListItem() {
+ if (!listDialog.listGrid.activeRow) {
+ return false;
+ }
+ let activeRowId = listDialog.listGrid.activeRow.getEntryIndex();
+ if (activeRowId <= 1) {
+ listDialog.listGrid.activeRow = 0;
+ } else {
+ listDialog.listGrid.activeRow = listDialog.listRows[activeRowId - 1];
+ }
+
+ //sendNetworkEventToServer("agrp.list.next", listDialog.listGrid.activeRow.getEntryIndex());
}
// ===========================================================================
function selectNextListItem() {
+ let activeRowId = listDialog.listGrid.activeRow.getEntryIndex();
+ if (activeRowId >= listDialog.listRows.length - 1) {
+ listDialog.listGrid.activeRow = 0;
+ } else {
+ listDialog.listGrid.activeRow = listDialog.listRows[activeRowId + 1];
+ }
+ //sendNetworkEventToServer("agrp.list.next", listDialog.listGrid.activeRow.getEntryIndex());
+}
+
+// ===========================================================================
+
+function clearListGUI() {
+ listDialog.listGrid.removeAllEntries();
+}
+
+// ===========================================================================
+
+function populateListGUI(listItems) {
+ for (let i in listItems) {
+ let row = listDialog.listGrid.row(listItems[i]);
+ listDialog.listRows.push(row);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/gui/simple-prompt-yes-no.js b/scripts/client/gui/simple-prompt-yes-no.js
index f143b086..b4ba3ab3 100644
--- a/scripts/client/gui/simple-prompt-yes-no.js
+++ b/scripts/client/gui/simple-prompt-yes-no.js
@@ -19,7 +19,7 @@ let yesNoDialog = {
// ===========================================================================
function initYesNoDialogGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI ...`);
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -74,14 +74,14 @@ function initYesNoDialogGUI() {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, yesNoDialogAnswerNo);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI`);
}
// ===========================================================================
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
mexui.setInput(true);
yesNoDialog.messageLabel.text = "";
@@ -100,7 +100,7 @@ function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonT
// ===========================================================================
function yesNoDialogAnswerNo() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer NO to server prompt`);
sendNetworkEventToServer("agrp.promptAnswerNo");
closeAllWindows();
}
@@ -108,7 +108,7 @@ function yesNoDialogAnswerNo() {
// ===========================================================================
function yesNoDialogAnswerYes() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer YES to server prompt`);
sendNetworkEventToServer("agrp.promptAnswerYes");
closeAllWindows();
}
diff --git a/scripts/client/gui/two-factor-authentication.js b/scripts/client/gui/two-factor-authentication.js
index ecb3e194..4ad79f9e 100644
--- a/scripts/client/gui/two-factor-authentication.js
+++ b/scripts/client/gui/two-factor-authentication.js
@@ -21,7 +21,7 @@ let twoFactorAuth = {
// ===========================================================================
function initTwoFactorAuthenticationGUI() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Creating two factor auth GUI ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating two factor auth GUI ...`);
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
@@ -95,14 +95,14 @@ function initTwoFactorAuthenticationGUI() {
},
}, checkTwoFactorAuth);
- logToConsole(LOG_DEBUG, `[VRR.GUI] Created two factor auth GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Created two factor auth GUI`);
}
// ===========================================================================
function showTwoFactorAuthGUI() {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[VRR.GUI] Showing two-factor authentication window`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing two-factor authentication window`);
setChatWindowEnabled(false);
mexui.setInput(true);
twoFactorAuth.window.shown = true;
@@ -113,7 +113,7 @@ function showTwoFactorAuthGUI() {
// ===========================================================================
function twoFactorAuthFailed(errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
twoFactorAuth.messageLabel.text = errorMessage;
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
twoFactorAuth.codeInput.text = "";
@@ -122,14 +122,14 @@ function twoFactorAuthFailed(errorMessage) {
// ===========================================================================
function twoFactorAuthSuccess() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication was successful`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication was successful`);
closeAllWindows();
}
// ===========================================================================
function checkTwoFactorAuth() {
- logToConsole(LOG_DEBUG, `[VRR.GUI] Checking two-factor authentication with server ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking two-factor authentication with server ...`);
sendNetworkEventToServer("agrp.2fa", twoFactorAuth.codeInput.lines[0]);
}
diff --git a/scripts/client/house.js b/scripts/client/house.js
index 26a7df8c..d84dff36 100644
--- a/scripts/client/house.js
+++ b/scripts/client/house.js
@@ -17,16 +17,19 @@ class HouseData {
this.blipModel = blipModel;
this.pickupModel = pickupModel;
this.hasInterior = hasInterior;
+ this.rentPrice = 0;
+ this.buyPrice = 0;
this.blipId = -1;
+ this.locked = false;
}
}
// ===========================================================================
-function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) {
- logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
+function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
+ logToConsole(LOG_DEBUG, `[AGRP.House] Received house ${houseId} (${name}) from server`);
- if (!areServerElementsSupported()) {
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (getHouseData(houseId) != false) {
let houseData = getHouseData(houseId);
houseData.description = description;
@@ -34,11 +37,24 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
houseData.blipModel = blipModel;
houseData.pickupModel = pickupModel;
houseData.hasInterior = hasInterior;
+ houseData.buyPrice = buyPrice;
+ houseData.rentPrice = rentPrice;
+ houseData.locked = locked;
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
+ if (houseData.buyPrice > 0) {
+ houseData.labelInfoType = AGRP_PROPLABEL_INFO_BUYHOUSE;
+ } else {
+ if (houseData.rentPrice > 0) {
+ houseData.labelInfoType = AGRP_PROPLABEL_INFO_RENTHOUSE;
+ } else {
+ houseData.labelInfoType = AGRP_PROPLABEL_INFO_ENTER;
+ }
+ }
+
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been removed by the server`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
} else {
@@ -46,11 +62,11 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
}
houseData.blipId = -1;
} else {
- logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been changed by the server`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
@@ -63,20 +79,20 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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 ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} doesn't exist. Adding ...`);
let tempHouseData = new HouseData(houseId, description, 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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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.`);
+ logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} has no blip.`);
}
getServerData().houses.push(tempHouseData);
setAllHouseDataIndexes();
diff --git a/scripts/client/item.js b/scripts/client/item.js
index 750f2fca..6513adb9 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -17,8 +17,8 @@ let itemActionDelaySize = toVector2(200, 5);
// ===========================================================================
function initItemScript() {
- logToConsole(LOG_DEBUG, "[VRR.Item]: Initializing item script ...");
- logToConsole(LOG_DEBUG, "[VRR.Item]: Item script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Item]: Initializing item script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Item]: Item script initialized!");
}
// ===========================================================================
@@ -48,7 +48,7 @@ function processItemActionRendering() {
// ===========================================================================
function updatePlayerHotBar(activeSlot, itemsArray) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
+ logToConsole(LOG_DEBUG, `[AGRP.Main] Updating hotbar`);
}
// ===========================================================================
diff --git a/scripts/client/job.js b/scripts/client/job.js
index 2877bc06..2b57a2f0 100644
--- a/scripts/client/job.js
+++ b/scripts/client/job.js
@@ -36,28 +36,28 @@ class JobData {
// ===========================================================================
function initJobScript() {
- logToConsole(LOG_DEBUG, "[VRR.Job]: Initializing job script ...");
- logToConsole(LOG_DEBUG, "[VRR.Job]: Job script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Job]: Initializing job script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Job]: Job script initialized!");
}
// ===========================================================================
function setLocalPlayerJobType(tempJobType) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Set local player job type to ${tempJobType}`);
localPlayerJobType = tempJobType;
}
// ===========================================================================
function setLocalPlayerWorkingState(tempWorking) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Setting working state to ${tempWorking}`);
localPlayerWorking = tempWorking;
}
// ===========================================================================
function showJobRouteLocation(position, colour) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
hideJobRouteLocation();
if (getMultiplayerMod() == AGRP_MPMOD_GTAC) {
if (getGame() == AGRP_GAME_GTA_SA) {
@@ -81,7 +81,7 @@ function showJobRouteLocation(position, colour) {
// ===========================================================================
function enteredJobRouteSphere() {
- logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Entered job route sphere`);
hideJobRouteLocation();
tellServerPlayerArrivedAtJobRouteLocation();
}
@@ -115,7 +115,7 @@ function blinkJobRouteLocationBlip(times, position, colour) {
// ===========================================================================
function hideJobRouteLocation() {
- logToConsole(LOG_DEBUG, `[VRR.Job] Hiding job route location`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Hiding job route location`);
if (jobRouteLocationBlip != null) {
destroyElement(jobRouteLocationBlip);
@@ -138,7 +138,7 @@ function hideJobRouteLocation() {
// ===========================================================================
function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, pickupModel) {
- logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Received job ${jobId} (${name}) from server`);
if (getGame() == AGRP_GAME_GTA_IV) {
if (getJobData(jobId) != false) {
@@ -149,10 +149,10 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
jobData.blipModel = blipModel;
jobData.pickupModel = pickupModel;
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been removed by the server`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
} else {
@@ -160,11 +160,11 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
}
jobData.blipId = -1;
} else {
- logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been changed by the server`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.setBlipCoordinates(jobData.blipId, jobData.position);
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
@@ -177,20 +177,20 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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 ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} doesn't exist. Adding ...`);
let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
if (blipModel != -1) {
let blipId = createGameBlip(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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} has no blip.`);
}
getServerData().jobs.push(tempJobData);
setAllJobDataIndexes();
diff --git a/scripts/client/keybind.js b/scripts/client/keybind.js
index 751759b8..fe0b5b03 100644
--- a/scripts/client/keybind.js
+++ b/scripts/client/keybind.js
@@ -17,14 +17,14 @@ let keyBindLongHoldDuration = 1500;
// ===========================================================================
function initKeyBindScript() {
- logToConsole(LOG_DEBUG, "[VRR.KeyBind]: Initializing key bind script ...");
- logToConsole(LOG_DEBUG, "[VRR.KeyBind]: Key bind script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.KeyBind]: Initializing key bind script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.KeyBind]: Key bind script initialized!");
}
// ===========================================================================
function bindAccountKey(key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
keyBinds.push(toInteger(key));
bindKey(toInteger(key), keyState, function (event) {
if (isAnyGUIActive()) {
@@ -33,14 +33,14 @@ function bindAccountKey(key, keyState) {
if (hasKeyBindDelayElapsed()) {
if (canLocalPlayerUseKeyBinds()) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ logToConsole(LOG_DEBUG, `[AGRP.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!`);
+ logToConsole(LOG_DEBUG, `[AGRP.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!`);
+ logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
}
});
}
@@ -48,7 +48,7 @@ function bindAccountKey(key, keyState) {
// ===========================================================================
function unBindAccountKey(key) {
- logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
unbindKey(key);
keyBinds.splice(keyBinds.indexOf(key), 1);
return true;
diff --git a/scripts/client/label.js b/scripts/client/label.js
index 8c1c8884..8721c13c 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -14,7 +14,12 @@ let jobLabels = [];
let propertyLabelNameFont = null;
let propertyLabelLockedFont = null;
-let propertyLabelHeight = 1.0;
+let propertyLabelHeight = (getGame() == AGRP_GAME_MAFIA_ONE) ? 2.0 : 1.0;
+let propertyPickupRenderDistance = 75.0;
+let propertyLabelRenderDistance = 5.0;
+let propertyLabelLockedOffset = 16;
+let propertyLabelNameOffset = 20;
+let propertyLabelPriceOffset = 16;
let jobNameLabelFont = null;
let jobHelpLabelFont = null;
@@ -23,21 +28,15 @@ let unlockedColour = toColour(50, 205, 50, 255);
let lockedColour = toColour(205, 92, 92, 255);
let jobHelpColour = toColour(234, 198, 126, 255);
-let renderLabelDistance = 7.5;
-
-let propertyLabelLockedOffset = 16;
-let propertyLabelNameOffset = 18;
-let propertyLabelPriceOffset = 16;
-
// ===========================================================================
function initLabelScript() {
- logToConsole(LOG_DEBUG, "[VRR.Label]: Initializing label script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Label]: Initializing label script ...");
propertyLabelNameFont = initLabelPropertyNameFont();
propertyLabelLockedFont = initLabelPropertyLockedFont();
jobNameLabelFont = initLabelJobNameFont();
jobHelpLabelFont = initLabelJobHelpFont();
- logToConsole(LOG_DEBUG, "[VRR.Label]: Label script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Label]: Label script initialized!");
}
// ===========================================================================
@@ -81,32 +80,33 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
if (getGame() == AGRP_GAME_GTA_IV) {
if (!natives.doesViewportExist(natives.getGameViewportId())) {
- logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
+ logToConsole(LOG_INFO, "[AGRP.Label]: Game viewport does not exist!");
return false;
}
if (!natives.isViewportActive(natives.getGameViewportId())) {
- logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
+ logToConsole(LOG_INFO, "[AGRP.Label]: Game viewport is not active!");
return false;
}
}
- let tempPosition = position;
- tempPosition.z = tempPosition.z + propertyLabelHeight;
+ position = getPosAbovePos(position, propertyLabelHeight);
let screenPosition = new Vec3(0.0, 0.0, 0.0);
if (getGame() == AGRP_GAME_GTA_IV) {
- screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
+ screenPosition = natives.getViewportPositionOfCoord(position, natives.getGameViewportId());
} else {
- screenPosition = getScreenFromWorldPosition(tempPosition);
+ screenPosition = getScreenFromWorldPosition(position);
}
+ logToConsole(LOG_VERBOSE, `[AGRP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
+
if (screenPosition.x < 0 || screenPosition.x > game.width) {
return false;
}
let text = "";
- if (price > "0") {
- text = getLocaleString("PropertyForSaleLabel", price);
+ if (toInteger(price) > 0) {
+ text = getLocaleString("PropertyForSaleLabel", getCurrencyString(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);
@@ -114,8 +114,8 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
}
text = "";
- if (rentPrice != "0") {
- text = getLocaleString("PropertyForRentLabel", rentPrice);
+ if (toInteger(rentPrice) > 0) {
+ text = getLocaleString("PropertyForRentLabel", getCurrencyString(rentPrice));
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);
@@ -174,7 +174,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
break;
}
}
- if (getDistance(localPlayer.position, position) <= renderLabelDistance - 2) {
+ if (getDistance(localPlayer.position, position) <= propertyLabelRenderDistance - 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;
@@ -212,12 +212,12 @@ function renderPropertyExitLabel(position) {
if (getGame() == AGRP_GAME_GTA_IV) {
if (!natives.doesViewportExist(natives.getGameViewportId())) {
- logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
+ logToConsole(LOG_INFO, "[AGRP.Label]: Game viewport does not exist!");
return false;
}
if (!natives.isViewportActive(natives.getGameViewportId())) {
- logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
+ logToConsole(LOG_INFO, "[AGRP.Label]: Game viewport is not active!");
return false;
}
}
@@ -257,12 +257,12 @@ function renderJobLabel(name, position, jobType) {
if (getGame() == AGRP_GAME_GTA_IV) {
if (!natives.doesViewportExist(natives.getGameViewportId())) {
- logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
+ logToConsole(LOG_INFO, "[AGRP.Label]: Game viewport does not exist!");
return false;
}
if (!natives.isViewportActive(natives.getGameViewportId())) {
- logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
+ logToConsole(LOG_INFO, "[AGRP.Label]: Game viewport is not active!");
return false;
}
}
@@ -309,26 +309,41 @@ function renderJobLabel(name, position, jobType) {
function processLabelRendering() {
if (renderLabels) {
- if (!areServerElementsSupported()) {
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (localPlayer != null) {
getServerData().businesses.forEach((business) => {
- if (getDistance(localPlayer.position, business.entrancePosition) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(business.entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
- //renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, makeLargeNumberReadable(business.price), makeLargeNumberReadable(business.rentPrice), business.labelInfoType);
+ if (getDistance(localPlayer.position, business.entrancePosition) <= propertyPickupRenderDistance) {
+ if (getGame() == AGRP_GAME_GTA_IV || getGame() == AGRP_GAME_GTA_IV_EFLC) {
+ natives.drawColouredCylinder(getPosBelowPos(business.entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
+ }
+
+ if (getDistance(localPlayer.position, business.entrancePosition) <= propertyLabelRenderDistance) {
+ renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, business.buyPrice, business.rentPrice, business.labelInfoType);
+ }
}
});
getServerData().houses.forEach((house) => {
- if (getDistance(localPlayer.position, house.entrancePosition) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(house.entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
- //renderPropertyEntranceLabel("House", house.entrancePosition, house.locked, true, makeLargeNumberReadable(house.price), makeLargeNumberReadable(house.rentPrice), 0);
+ if (getDistance(localPlayer.position, house.entrancePosition) <= propertyPickupRenderDistance) {
+ if (getGame() == AGRP_GAME_GTA_IV || getGame() == AGRP_GAME_GTA_IV_EFLC) {
+ natives.drawColouredCylinder(getPosBelowPos(house.entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
+ }
+
+ if (getDistance(localPlayer.position, house.entrancePosition) <= propertyLabelRenderDistance) {
+ renderPropertyEntranceLabel(house.description, house.entrancePosition, house.locked, true, house.buyPrice, house.rentPrice, house.labelInfoType);
+ }
}
});
getServerData().jobs.forEach((job) => {
- if (getDistance(localPlayer.position, job.position) <= 75.0) {
- natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
- //renderJobLabel(job.name, job.position, job.jobType);
+ if (getDistance(localPlayer.position, job.position) <= propertyPickupRenderDistance) {
+ if (getGame() == AGRP_GAME_GTA_IV || getGame() == AGRP_GAME_GTA_IV_EFLC) {
+ natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
+ }
+ }
+
+ if (getDistance(localPlayer.position, job.position) <= 5.0) {
+ renderJobLabel(job.name, job.position, job.jobType);
}
});
}
@@ -339,17 +354,17 @@ function processLabelRendering() {
let pickups = getElementsByType(ELEMENT_PICKUP);
for (let i in pickups) {
if (pickups[i].getData("agrp.label.type") != null) {
- if (getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
+ if (getDistance(localPlayer.position, pickups[i].position) <= propertyLabelRenderDistance) {
if (!pickups[i].isOnScreen) {
let price = "0";
let rentPrice = "0";
let labelInfoType = AGRP_PROPLABEL_INFO_NONE;
if (pickups[i].getData("agrp.label.price") != null) {
- price = makeLargeNumberReadable(pickups[i].getData("agrp.label.price"));
+ price = pickups[i].getData("agrp.label.price");
}
if (pickups[i].getData("agrp.label.rentprice") != null) {
- rentPrice = makeLargeNumberReadable(pickups[i].getData("agrp.label.rentprice"));
+ rentPrice = pickups[i].getData("agrp.label.rentprice");
}
if (pickups[i].getData("agrp.label.help") != null) {
diff --git a/scripts/client/locale.js b/scripts/client/locale.js
index 9166f443..bdeb29de 100644
--- a/scripts/client/locale.js
+++ b/scripts/client/locale.js
@@ -38,7 +38,7 @@ function loadLocaleConfig() {
let configFile = loadTextFile("config/client/locale.json");
getServerData().localeOptions = JSON.parse(configFile);
- resetLocaleChooserOptions();
+ //resetLocaleChooserOptions();
loadAllLocaleStrings();
}
@@ -47,11 +47,12 @@ function loadLocaleConfig() {
function loadAllLocaleStrings() {
let localeOptions = getServerData().localeOptions;
for (let i in localeOptions) {
- logToConsole(LOG_INFO, `[VRR.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
- let localeFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
- let localeData = JSON.parse(localeFile);
+ logToConsole(LOG_INFO, `[AGRP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
+ let localeStringFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
+ let localeStringData = JSON.parse(localeStringFile);
- getServerData().localeStrings[i] = localeData;
+ let localeId = localeOptions[i].id;
+ getServerData().localeStrings[localeId] = localeStringData;
}
resetGUIStrings();
@@ -60,7 +61,7 @@ function loadAllLocaleStrings() {
// ===========================================================================
function setLocale(tempLocaleId) {
- logToConsole(LOG_DEBUG, `[VRR.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
localLocaleId = tempLocaleId;
resetGUIStrings();
}
\ No newline at end of file
diff --git a/scripts/client/logo.js b/scripts/client/logo.js
index 33eb812e..8f51c260 100644
--- a/scripts/client/logo.js
+++ b/scripts/client/logo.js
@@ -15,14 +15,18 @@ let logoSize = toVector2(128, 128);
// ===========================================================================
function initLogoScript() {
- logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Logo]: Initializing logo script ...");
//logoImage = loadLogoImage();
- logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Logo]: Logo script initialized!");
}
// ===========================================================================
function loadLogoImage() {
+ //if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ // return false;
+ //}
+
let logoStream = openFile(mainLogoPath);
let tempLogoImage = null;
if (logoStream != null) {
@@ -36,6 +40,10 @@ function loadLogoImage() {
// ===========================================================================
function processLogoRendering() {
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ return false;
+ }
+
if (renderLogo) {
if (logoImage != null) {
graphics.drawRectangle(logoImage, logoPos, logoSize);
@@ -46,7 +54,7 @@ function processLogoRendering() {
// ===========================================================================
function setServerLogoRenderState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
renderLogo = state;
}
diff --git a/scripts/client/main.js b/scripts/client/main.js
index 039836bd..fc32dc29 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -19,8 +19,8 @@ let isSpawned = false;
let garbageCollectorInterval = null;
-let parkedVehiclePosition = false;
-let parkedVehicleHeading = false;
+//let parkedVehiclePosition = false;
+//let parkedVehicleHeading = false;
let renderHUD = true;
let renderLabels = true;
@@ -31,7 +31,7 @@ let renderHotBar = true;
let renderItemActionDelay = true;
let renderInteriorLights = true;
-let logLevel = LOG_DEBUG;
+let logLevel = LOG_INFO | LOG_DEBUG;
let weaponDamageEnabled = {};
let weaponDamageEvent = {};
@@ -61,6 +61,7 @@ let interiorLightsEnabled = true;
let interiorLightsColour = toColour(0, 0, 0, 150);
let mouseCameraEnabled = false;
+let mouseCursorEnabled = false;
let currentPickup = false;
@@ -92,4 +93,14 @@ let serverData = {
jobs: [],
};
+let localPlayerMoney = 0;
+let localPlayerMoneyInterval = null;
+
+let currencyString = "${AMOUNT}";
+
+let mapChangeWarning = false;
+
+let cruiseControlEnabled = false;
+let cruiseControlSpeed = 0.0;
+
// ===========================================================================
diff --git a/scripts/client/messaging.js b/scripts/client/messaging.js
index 4b614cb9..4a0f2415 100644
--- a/scripts/client/messaging.js
+++ b/scripts/client/messaging.js
@@ -23,10 +23,10 @@ let smallGameMessageTimer = null;
// ===========================================================================
function initMessagingScript() {
- logToConsole(LOG_DEBUG, "[VRR.Messaging]: Initializing messaging script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Messaging]: Initializing messaging script ...");
smallGameMessageFonts = loadSmallGameMessageFonts();
bigGameMessageFonts = loadSmallGameMessageFonts();
- logToConsole(LOG_DEBUG, "[VRR.Messaging]: Messaging script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Messaging]: Messaging script initialized!");
}
// ===========================================================================
@@ -39,6 +39,12 @@ function loadSmallGameMessageFonts() {
fontStream.close();
}
+ fontStream = openFile("files/fonts/aurora-bold-condensed.ttf");
+ if (fontStream != null) {
+ tempSmallGameMessageFonts["AuroraBdCnBT"] = lucasFont.createFont(fontStream, 20.0);
+ fontStream.close();
+ }
+
tempSmallGameMessageFonts["Roboto"] = lucasFont.createDefaultFont(20.0, "Roboto");
tempSmallGameMessageFonts["RobotoLight"] = lucasFont.createDefaultFont(20.0, "Roboto", "Light");
@@ -55,6 +61,12 @@ function loadBigGameMessageFont() {
fontStream.close();
}
+ fontStream = openFile("files/fonts/aurora-bold-condensed.ttf");
+ if (fontStream != null) {
+ tempBigGameMessageFonts["AuroraBdCnBT"] = lucasFont.createFont(fontStream, 20.0);
+ fontStream.close();
+ }
+
tempBigGameMessageFonts["Roboto"] = lucasFont.createDefaultFont(28.0, "Roboto");
tempBigGameMessageFonts["RobotoLight"] = lucasFont.createDefaultFont(28.0, "Roboto", "Light");
@@ -64,10 +76,10 @@ function loadBigGameMessageFont() {
// ===========================================================================
function processSmallGameMessageRendering() {
- logToConsole(LOG_VERBOSE, "[VRR.Messaging]: Processing small game message rendering ...");
+ logToConsole(LOG_VERBOSE, "[AGRP.Messaging]: Processing small game message rendering ...");
if (renderSmallGameMessage) {
if (smallGameMessageText != "") {
- logToConsole(LOG_VERBOSE, `[VRR.Messaging]: Rendering small game message: ${smallGameMessageText}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
if (smallGameMessageFonts[smallGameMessageFontName] != null) {
smallGameMessageFonts[smallGameMessageFontName].render(smallGameMessageText, [0, game.height - 90], game.width, 0.5, 0.0, smallGameMessageFonts[smallGameMessageFontName].size, smallGameMessageColour, true, true, false, true);
}
@@ -78,7 +90,7 @@ function processSmallGameMessageRendering() {
// ===========================================================================
function showSmallGameMessage(text, colour, duration, fontName) {
- logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
+ logToConsole(LOG_DEBUG, `[AGRP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
if (smallGameMessageText != "") {
clearTimeout(smallGameMessageTimer);
}
diff --git a/scripts/client/mousecam.js b/scripts/client/mousecam.js
index 08889376..bfd6fa2b 100644
--- a/scripts/client/mousecam.js
+++ b/scripts/client/mousecam.js
@@ -12,34 +12,29 @@
// CREDITS TO LUCASC190 FOR MAKING THE MOUSE CAMERA
// WALKING CODE ADDED BY VORTREX
-function SetStandardControlsEnabled(bEnabled)
-{
- if(typeof gta == "undefined") {
+function SetStandardControlsEnabled(bEnabled) {
+ if (typeof gta == "undefined") {
return false;
}
- if (game.standardControls === undefined)
- {
+ if (game.standardControls === undefined) {
logToConsole(LOG_WARN, "game.standardControls not implemented");
return;
}
game.standardControls = bEnabled;
}
-function GetCurrentPlayerIndex()
-{
+function GetCurrentPlayerIndex() {
return 0;
}
-function GetPlayerPed(uiIndex)
-{
+function GetPlayerPed(uiIndex) {
if (uiIndex >= 1)
throw new Error("player index out of range");
return localPlayer;
}
-function GetPedVehicle(pPed)
-{
+function GetPedVehicle(pPed) {
return pPed.vehicle;
}
@@ -49,8 +44,7 @@ let ENTITYTYPE_PED = 3;
let ENTITYTYPE_OBJECT = 4;
let ENTITYTYPE_DUMMY = 5;
-function GetEntityType(Entity)
-{
+function GetEntityType(Entity) {
if (Entity.isType(ELEMENT_BUILDING))
return ENTITYTYPE_BUILDING;
if (Entity.isType(ELEMENT_VEHICLE))
@@ -64,79 +58,66 @@ function GetEntityType(Entity)
return undefined;
}
-function GetPlaceableMatrix(pPlaceable)
-{
+function GetPlaceableMatrix(pPlaceable) {
if (pPlaceable == GetCamera())
return game.cameraMatrix;
return pPlaceable.matrix;
}
-function GetEntityModel(pEntity)
-{
+function GetEntityModel(pEntity) {
return pEntity;
}
-function GetModelBoundingSphere(usModel)
-{
+function GetModelBoundingSphere(usModel) {
return [usModel.boundingRadius, usModel.boundingCentre.x, usModel.boundingCentre.y, usModel.boundingCentre.z];
}
-function GetMouseSpeed()
-{
+function GetMouseSpeed() {
if (gui.cursorEnabled)
- return [0,0];
+ return [0, 0];
let MouseSpeed = game.getMouseSpeed();
- return [MouseSpeed.x,-MouseSpeed.y];
+ return [MouseSpeed.x, -MouseSpeed.y];
}
-function GetMouseSensitivity()
-{
- if (game.getMouseSensitivity === undefined)
- {
+function GetMouseSensitivity() {
+ if (game.getMouseSensitivity === undefined) {
//logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
- return [0.0025,0.003];
+ return [0.0025, 0.003];
}
let MouseSensitivity = game.getMouseSensitivity();
- return [MouseSensitivity.x,MouseSensitivity.y];
+ return [MouseSensitivity.x, MouseSensitivity.y];
}
let GetCamera;
{
const Camera = Symbol();
- GetCamera = function()
- {
+ GetCamera = function () {
return Camera;
}
}
-function AreEntityCollisionsEnabled(pEntity)
-{
+function AreEntityCollisionsEnabled(pEntity) {
return pEntity.collisionsEnabled;
}
-function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled)
-{
+function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled) {
pEntity.collisionsEnabled = bCollisionsEnabled;
}
-function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera)
-{
- if (game.processLineOfSight === undefined)
- {
+function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera) {
+ if (game.processLineOfSight === undefined) {
logToConsole(LOG_WARN, "game.processLineOfSight not implemented");
return [null];
}
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
if (Result == null)
return [null];
- return [Result.position.x, Result.position.y ,Result.position.z, Result.normal.x, Result.normal.y ,Result.normal.z, Result.entity];
+ return [Result.position.x, Result.position.y, Result.position.z, Result.normal.x, Result.normal.y, Result.normal.z, Result.entity];
}
-function SetPlaceableMatrix(pPlaceable, mat)
-{
- if (pPlaceable == GetCamera())
- {
+function SetPlaceableMatrix(pPlaceable, mat) {
+ if (pPlaceable == GetCamera()) {
game.setCameraMatrix(mat);
return;
}
@@ -149,20 +130,17 @@ let GetTickCount;
{
let FrameCount = 0;
- setInterval(() =>
- {
+ setInterval(() => {
++FrameCount;
}, 0);
let GTAFrameCount = 0;
- addEventHandler("OnProcess", (event, deltaTime) =>
- {
+ addEventHandler("OnProcess", (event, deltaTime) => {
++GTAFrameCount;
});
- GetTickCount = function(bGTA, bFrames)
- {
+ GetTickCount = function (bGTA, bFrames) {
if (bFrames)
return bGTA ? GTAFrameCount : FrameCount;
else
@@ -170,16 +148,16 @@ let GetTickCount;
}
}
-function easingSinusoidalInOut(t,b,c,d)//TODO: Move this to MathUtil.js
+function easingSinusoidalInOut(t, b, c, d)//TODO: Move this to MathUtil.js
{
- return -c/2 * (Math.cos((Math.PI)*t/d) - 1) + b;
+ return -c / 2 * (Math.cos((Math.PI) * t / d) - 1) + b;
}
//TODO: extract
-function applyMultiplierTimeStep(m,t)//TODO: Move this to MathUtil.js
+function applyMultiplierTimeStep(m, t)//TODO: Move this to MathUtil.js
{
- return Math.max(Math.min(1.0-(1.0-m)*(t),1),0);
+ return Math.max(Math.min(1.0 - (1.0 - m) * (t), 1), 0);
}
//TODO: getOffset
@@ -192,8 +170,7 @@ function applyMultiplierTimeStep(m,t)//TODO: Move this to MathUtil.js
//TODO: confirm
const identityMatrix = new Matrix4x4();
-if (identityMatrix.setIdentity === undefined)
-{
+if (identityMatrix.setIdentity === undefined) {
identityMatrix.m11 = 1;
identityMatrix.m12 = 0;
identityMatrix.m13 = 0;
@@ -230,72 +207,62 @@ cameraIdentityMatrix.m42 = 0;
cameraIdentityMatrix.m43 = 0;
cameraIdentityMatrix.m44 = 1;
-function createMultipliedMatrix()
-{
+function createMultipliedMatrix() {
let matrix = new Matrix4x4();
matrix.setMultiply.apply(matrix, arguments);
return matrix;
}
-function createXRotationMatrix(x)
-{
+function createXRotationMatrix(x) {
let matrix = new Matrix4x4();
matrix.setRotateX(x);
return matrix;
}
-function createYRotationMatrix(x)
-{
+function createYRotationMatrix(x) {
let matrix = new Matrix4x4();
matrix.setRotateY(x);
return matrix;
}
-function createZRotationMatrix(z)
-{
+function createZRotationMatrix(z) {
let matrix = new Matrix4x4();
matrix.setRotateZ(z);
return matrix;
}
-function createTranslationMatrix(x,y,z)
-{
+function createTranslationMatrix(x, y, z) {
let matrix = new Matrix4x4();
- matrix.setTranslate([x,y,z]);
+ matrix.setTranslate([x, y, z]);
return matrix;
}
//TODO: createScaleMatrix
-function getDotProduct(x,y,z,x2,y2,z2)
-{
- return x*x2 + y*y2 + z*z2;
+function getDotProduct(x, y, z, x2, y2, z2) {
+ return x * x2 + y * y2 + z * z2;
}
-function getCrossProduct(x,y,z,x2,y2,z2)
-{
- return [y*z2-z*y2, z*x2-x*z2, x*y2-y*x2];
+function getCrossProduct(x, y, z, x2, y2, z2) {
+ return [y * z2 - z * y2, z * x2 - x * z2, x * y2 - y * x2];
}
-function getLength(x,y,z)
-{
- return Math.sqrt(getDotProduct(x,y,z,x,y,z));
+function getLength(x, y, z) {
+ return Math.sqrt(getDotProduct(x, y, z, x, y, z));
}
-function normalise(x,y,z)
-{
- let length = getLength(x,y,z);
+function normalise(x, y, z) {
+ let length = getLength(x, y, z);
if (length == 0)
throw new Error("an attempt was made to normalise a three dimensional vector with a length of zero");
- return [x/length, y/length, z/length];
+ return [x / length, y / length, z / length];
}
-function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX,upY,upZ)
-{
+function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX, upY, upZ) {
let matrix = new Matrix4x4();
- let [lookX, lookY, lookZ] = normalise(atX-eyeX,atY-eyeY,atZ-eyeZ);
- let [rightX, rightY, rightZ] = normalise.apply(null,getCrossProduct(upX,upY,upZ,lookX, lookY, lookZ));
- [upX,upY,upZ] = getCrossProduct(lookX, lookY, lookZ,rightX, rightY, rightZ);
+ let [lookX, lookY, lookZ] = normalise(atX - eyeX, atY - eyeY, atZ - eyeZ);
+ let [rightX, rightY, rightZ] = normalise.apply(null, getCrossProduct(upX, upY, upZ, lookX, lookY, lookZ));
+ [upX, upY, upZ] = getCrossProduct(lookX, lookY, lookZ, rightX, rightY, rightZ);
matrix.m11 = rightX;
matrix.m12 = rightY;
matrix.m13 = rightZ;
@@ -323,10 +290,9 @@ function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX,upY,upZ)
return matrix;
}
-function getDifferenceBetweenAngles(current,target)
-{
- let f = (((target-current)+Math.PI)/(Math.PI*2));
- return ((f-Math.floor(f))*(Math.PI*2))-Math.PI;
+function getDifferenceBetweenAngles(current, target) {
+ let f = (((target - current) + Math.PI) / (Math.PI * 2));
+ return ((f - Math.floor(f)) * (Math.PI * 2)) - Math.PI;
}
let easeCamera = false;
@@ -336,46 +302,41 @@ let easeStartPosX, easeStartPosY, easeStartPosZ;
let easeStartLookX, easeStartLookY, easeStartLookZ;
let easeStartUpX, easeStartUpY, easeStartUpZ;
-function getCameraPositionInfo(matrix)
-{
+function getCameraPositionInfo(matrix) {
return [matrix.m41, matrix.m42, matrix.m43, matrix.m21, matrix.m22, matrix.m23, matrix.m31, matrix.m32, matrix.m33];
}
-function startCameraEase()
-{
+function startCameraEase() {
easeCamera = true;
- easeStartTicks = GetTickCount(true,false);
+ easeStartTicks = GetTickCount(true, false);
easeDuration = 1000;
let matrix = GetPlaceableMatrix(GetCamera());
[easeStartPosX, easeStartPosY, easeStartPosZ, easeStartLookX, easeStartLookY, easeStartLookZ, easeStartUpX, easeStartUpY, easeStartUpZ] = getCameraPositionInfo(matrix);
}
-function applyCameraEase(matrix)
-{
+function applyCameraEase(matrix) {
if (!easeCamera)
return matrix;
- let ease = (GetTickCount(true,false)-easeStartTicks)/easeDuration;
- if (ease < 1)
- {
- ease = easingSinusoidalInOut(ease,0,1,1);
+ let ease = (GetTickCount(true, false) - easeStartTicks) / easeDuration;
+ if (ease < 1) {
+ ease = easingSinusoidalInOut(ease, 0, 1, 1);
let [newPosX, newPosY, newPosZ, newLookX, newLookY, newLookZ, newUpX, newUpY, newUpZ] = getCameraPositionInfo(matrix);
- let easePosX = easeStartPosX+(newPosX-easeStartPosX)*ease;
- let easePosY = easeStartPosY+(newPosY-easeStartPosY)*ease;
- let easePosZ = easeStartPosZ+(newPosZ-easeStartPosZ)*ease;
- let easeLookX = easeStartLookX+(newLookX-easeStartLookX)*ease;
- let easeLookY = easeStartLookY+(newLookY-easeStartLookY)*ease;
- let easeLookZ = easeStartLookZ+(newLookZ-easeStartLookZ)*ease;
- let easeUpX = easeStartUpX+(newUpX-easeStartUpX)*ease;
- let easeUpY = easeStartUpY+(newUpY-easeStartUpY)*ease;
- let easeUpZ = easeStartUpZ+(newUpZ-easeStartUpZ)*ease;
- return createLookAtLHMatrix(easePosX,easePosY,easePosZ,easePosX+easeLookX,easePosY+easeLookY,easePosZ+easeLookZ,easeUpX,easeUpY,easeUpZ);
+ let easePosX = easeStartPosX + (newPosX - easeStartPosX) * ease;
+ let easePosY = easeStartPosY + (newPosY - easeStartPosY) * ease;
+ let easePosZ = easeStartPosZ + (newPosZ - easeStartPosZ) * ease;
+ let easeLookX = easeStartLookX + (newLookX - easeStartLookX) * ease;
+ let easeLookY = easeStartLookY + (newLookY - easeStartLookY) * ease;
+ let easeLookZ = easeStartLookZ + (newLookZ - easeStartLookZ) * ease;
+ let easeUpX = easeStartUpX + (newUpX - easeStartUpX) * ease;
+ let easeUpY = easeStartUpY + (newUpY - easeStartUpY) * ease;
+ let easeUpZ = easeStartUpZ + (newUpZ - easeStartUpZ) * ease;
+ return createLookAtLHMatrix(easePosX, easePosY, easePosZ, easePosX + easeLookX, easePosY + easeLookY, easePosZ + easeLookZ, easeUpX, easeUpY, easeUpZ);
}
return matrix;
}
-function isCameraEasing()
-{
- return easeCamera && GetTickCount(true,false) < (easeStartTicks+easeDuration);
+function isCameraEasing() {
+ return easeCamera && GetTickCount(true, false) < (easeStartTicks + easeDuration);
}
let oldCameraTarget = null;
@@ -383,14 +344,12 @@ let OldPosition = null;//2019 Lucas was here!
let cameraRotZ;
let cameraRotY;
-function getCameraTarget()
-{
+function getCameraTarget() {
let playerPed = GetPlayerPed(GetCurrentPlayerIndex());
let vehicle = GetPedVehicle(playerPed);
if (vehicle != null)
return vehicle;
- if (playerPed != null)
- {
+ if (playerPed != null) {
//if (playerPed.health <= 1)//Breaks because of fade//2019 Lucas was here!
// return null;
return playerPed;
@@ -398,59 +357,52 @@ function getCameraTarget()
return null;
}
-function isRelativeToTarget(target)
-{
+function isRelativeToTarget(target) {
if (GetEntityType(target) == ENTITYTYPE_PED)
return false;
return false
}
-function isClipped(target)
-{
+function isClipped(target) {
if (GetEntityType(target) == ENTITYTYPE_PED)
return true;
return true;
}
//2019 Lucas was here!
-function ShouldReturnToRestRotation(Target)
-{
+function ShouldReturnToRestRotation(Target) {
if (GetEntityType(Target) == ENTITYTYPE_PED)
return false;
return true;
}
-function getCameraRestRotation(target)
-{
+function getCameraRestRotation(target) {
let targetMatrix = GetPlaceableMatrix(target);
let rotZ;
if (isRelativeToTarget(target))
rotZ = 0;
else
- rotZ = -Math.atan2(targetMatrix.m21,targetMatrix.m22);
+ rotZ = -Math.atan2(targetMatrix.m21, targetMatrix.m22);
let rotY = -0.2;
return [rotZ, rotY];
}
-function resetCameraRotation()
-{
+function resetCameraRotation() {
[cameraRotZ, cameraRotY] = getCameraRestRotation(getCameraTarget());
}
//2019 Lucas was here!
let DeltaTime = 0;
-addEventHandler("OnProcess", (event, deltaTime) =>
-{
+addEventHandler("OnProcess", (event, deltaTime) => {
DeltaTime = deltaTime;
- if(!localPlayer) {
+ if (!localPlayer) {
return false;
}
});
let IdleTime = 0;//2019 Lucas was here!
-function processReturnToRestRotation()
-{
+function processReturnToRestRotation() {
//resetCameraRotation();//2019 Lucas was here!
//2019 Lucas was here!
@@ -458,37 +410,32 @@ function processReturnToRestRotation()
if (!ShouldReturnToRestRotation(Target))
return;
IdleTime += DeltaTime;
- if (IdleTime > 1.5)
- {
+ if (IdleTime > 1.5) {
let Velocity = Target.velocity;
let Matrix = Target.matrix;
- let Speed = getDotProduct(Velocity.x,Velocity.y,Velocity.z,Matrix.getElement(1*4+0),Matrix.getElement(1*4+1),Matrix.getElement(1*4+2));
+ let Speed = getDotProduct(Velocity.x, Velocity.y, Velocity.z, Matrix.getElement(1 * 4 + 0), Matrix.getElement(1 * 4 + 1), Matrix.getElement(1 * 4 + 2));
let AbsSpeed = Math.abs(Speed);
- let Multiplier = Math.min(AbsSpeed/0.75, 1);
- if (Multiplier != 0)
- {
+ let Multiplier = Math.min(AbsSpeed / 0.75, 1);
+ if (Multiplier != 0) {
let [TargetCameraRotZ2, TargetCameraRotY2] = getCameraRestRotation(Target);
if (Speed < 0)
TargetCameraRotZ2 += Math.PI;
- let TimeStep = game.timeStep/50*60;
- cameraRotZ += getDifferenceBetweenAngles(cameraRotZ,TargetCameraRotZ2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
- cameraRotY += getDifferenceBetweenAngles(cameraRotY,TargetCameraRotY2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
+ let TimeStep = game.timeStep / 50 * 60;
+ cameraRotZ += getDifferenceBetweenAngles(cameraRotZ, TargetCameraRotZ2) * applyMultiplierTimeStep(1 / 20, TimeStep) * Multiplier;
+ cameraRotY += getDifferenceBetweenAngles(cameraRotY, TargetCameraRotY2) * applyMultiplierTimeStep(1 / 20, TimeStep) * Multiplier;
}
}
}
-function cancelReturnToRestRotation()
-{
+function cancelReturnToRestRotation() {
IdleTime = 0;//2019 Lucas was here!
}
let distance;
let zIncrease;
-function getCameraOffsetInfo(target)
-{
- if (GetEntityType(target) == ENTITYTYPE_PED)
- {
+function getCameraOffsetInfo(target) {
+ if (GetEntityType(target) == ENTITYTYPE_PED) {
let distance = 4;
let zIncrease = 0.8;
let offsetX = 0;
@@ -507,8 +454,7 @@ function getCameraOffsetInfo(target)
let offsetX;
let offsetY;
let offsetZ;
- if (radius <= 3.0535011291504)
- {
+ if (radius <= 3.0535011291504) {
minDistance = 4;
maxDistance = 8;
minZIncrease = 0.5;
@@ -516,8 +462,7 @@ function getCameraOffsetInfo(target)
minRadius = 2;
maxRadius = 3.0535011291504;
}
- else
- {
+ else {
minDistance = 8;
maxDistance = 16;
minZIncrease = 1;
@@ -528,66 +473,59 @@ function getCameraOffsetInfo(target)
offsetX = 0;
offsetY = 0;
offsetZ = 0;
- distance = minDistance+(radius-minRadius)/(maxRadius-minRadius)*(maxDistance-minDistance);
- zIncrease = minZIncrease+(radius-minRadius)/(maxRadius-minRadius)*(maxZIncrease-minZIncrease);
+ distance = minDistance + (radius - minRadius) / (maxRadius - minRadius) * (maxDistance - minDistance);
+ zIncrease = minZIncrease + (radius - minRadius) / (maxRadius - minRadius) * (maxZIncrease - minZIncrease);
return [distance, zIncrease, offsetX, offsetY, offsetZ];
}
-function update()
-{
+function update() {
let target = getCameraTarget();
- if (target != null)
- {
- if (oldCameraTarget != target)
- {
+ if (target != null) {
+ if (oldCameraTarget != target) {
//if (oldCameraTarget != null)//2019 Lucas was here!
let Position = target.position;
- if (OldPosition == null || getLength(Position.x-OldPosition.x,Position.y-OldPosition.y,Position.z-OldPosition.z) < 10)
+ if (OldPosition == null || getLength(Position.x - OldPosition.x, Position.y - OldPosition.y, Position.z - OldPosition.z) < 10)
startCameraEase()
resetCameraRotation()
}
let [mouseSpeedX, mouseSpeedY] = GetMouseSpeed();
let [mouseSensitivityX, mouseSensitivityY] = GetMouseSensitivity();
- mouseSpeedX = mouseSpeedX*mouseSensitivityX*2;
- mouseSpeedY = mouseSpeedY*mouseSensitivityY*2;
- if (mouseSpeedX == 0 && mouseSpeedY == 0)
- {
+ mouseSpeedX = mouseSpeedX * mouseSensitivityX * 2;
+ mouseSpeedY = mouseSpeedY * mouseSensitivityY * 2;
+ if (mouseSpeedX == 0 && mouseSpeedY == 0) {
processReturnToRestRotation();
}
- else
- {
- cameraRotZ = cameraRotZ-mouseSpeedX;
- cameraRotY = cameraRotY-mouseSpeedY;
+ else {
+ cameraRotZ = cameraRotZ - mouseSpeedX;
+ cameraRotY = cameraRotY - mouseSpeedY;
cancelReturnToRestRotation();
}
- cameraRotY = Math.max(cameraRotY,-Math.PI/2+0.01);
+ cameraRotY = Math.max(cameraRotY, -Math.PI / 2 + 0.01);
if (GetEntityType(target) != ENTITYTYPE_PED)
- cameraRotY = Math.min(cameraRotY,Math.PI/8.5);//2019 Lucas was here!
+ cameraRotY = Math.min(cameraRotY, Math.PI / 8.5);//2019 Lucas was here!
else
- cameraRotY = Math.min(cameraRotY,Math.PI/4);
+ cameraRotY = Math.min(cameraRotY, Math.PI / 4);
let camera = GetCamera();
let targetMatrix = GetPlaceableMatrix(target);
let [distance, zIncrease, offsetX, offsetY, offsetZ] = getCameraOffsetInfo(target);
let offsetTranslationMatrix = createTranslationMatrix(offsetX, offsetY, offsetZ);
- targetMatrix = createMultipliedMatrix(offsetTranslationMatrix,targetMatrix);
+ targetMatrix = createMultipliedMatrix(offsetTranslationMatrix, targetMatrix);
let targetPosX, targetPosY, targetPosZ;
if (isRelativeToTarget(target))
- [targetPosX, targetPosY, targetPosZ] = [0,0,0];
+ [targetPosX, targetPosY, targetPosZ] = [0, 0, 0];
else
- [targetPosX, targetPosY, targetPosZ] = [targetMatrix.m41,targetMatrix.m42,targetMatrix.m43];
- let distanceTranslationMatrix = createTranslationMatrix(0,-distance,0);
- targetPosZ = targetPosZ+zIncrease;
+ [targetPosX, targetPosY, targetPosZ] = [targetMatrix.m41, targetMatrix.m42, targetMatrix.m43];
+ let distanceTranslationMatrix = createTranslationMatrix(0, -distance, 0);
+ targetPosZ = targetPosZ + zIncrease;
let targetTranslationMatrix = createTranslationMatrix(targetPosX, targetPosY, targetPosZ);
let offsetRotationX = createXRotationMatrix(cameraRotY);
let offsetRotationZ = createZRotationMatrix(cameraRotZ);
- let cameraMatrix = createMultipliedMatrix(cameraIdentityMatrix,distanceTranslationMatrix,offsetRotationX,offsetRotationZ,targetTranslationMatrix);
- if (isRelativeToTarget(target))
- {
- cameraMatrix = createMultipliedMatrix(cameraMatrix,targetMatrix);
- targetTranslationMatrix = createMultipliedMatrix(targetTranslationMatrix,targetMatrix);
+ let cameraMatrix = createMultipliedMatrix(cameraIdentityMatrix, distanceTranslationMatrix, offsetRotationX, offsetRotationZ, targetTranslationMatrix);
+ if (isRelativeToTarget(target)) {
+ cameraMatrix = createMultipliedMatrix(cameraMatrix, targetMatrix);
+ targetTranslationMatrix = createMultipliedMatrix(targetTranslationMatrix, targetMatrix);
}
- if (isClipped(target))
- {
+ if (isClipped(target)) {
let startX = targetTranslationMatrix.m41;
let startY = targetTranslationMatrix.m42;
let startZ = targetTranslationMatrix.m43;
@@ -603,17 +541,16 @@ function update()
let ignoreSomeObjectsForCamera = true;
let collisionsEnabled = AreEntityCollisionsEnabled(target);
if (collisionsEnabled)
- SetEntityCollisionsEnabled(target,false);
- let [positionX,positionY,positionZ,normalX,normalY,normalZ,targetEntity] = ProcessLineOfSight(startX,startY,startZ,endX,endY,endZ,checkBuildings,checkVehicles,checkPeds,checkObjects,checkDummies,checkSeeThroughStuff,ignoreSomeObjectsForCamera);
+ SetEntityCollisionsEnabled(target, false);
+ let [positionX, positionY, positionZ, normalX, normalY, normalZ, targetEntity] = ProcessLineOfSight(startX, startY, startZ, endX, endY, endZ, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, checkSeeThroughStuff, ignoreSomeObjectsForCamera);
if (collisionsEnabled)
- SetEntityCollisionsEnabled(target,true);
- if (positionX != null)
- {
+ SetEntityCollisionsEnabled(target, true);
+ if (positionX != null) {
//2019 Lucas was here!
let Distance = 0.3;
- positionX += normalX*Distance;
- positionY += normalY*Distance;
- positionZ += normalZ*Distance;
+ positionX += normalX * Distance;
+ positionY += normalY * Distance;
+ positionZ += normalZ * Distance;
cameraMatrix.m41 = positionX;
cameraMatrix.m42 = positionY;
@@ -622,7 +559,7 @@ function update()
}
if (isCameraEasing())
cameraMatrix = applyCameraEase(cameraMatrix);
- SetPlaceableMatrix(camera,cameraMatrix);
+ SetPlaceableMatrix(camera, cameraMatrix);
UpdateCamera(camera);
}
oldCameraTarget = target;
@@ -630,9 +567,8 @@ function update()
return target != null;
}
-addEventHandler("OnCameraProcess", (event) =>
-{
- if(mouseCameraEnabled) {
+addEventHandler("OnCameraProcess", (event) => {
+ if (mouseCameraEnabled) {
update();
event.preventDefault();
}
diff --git a/scripts/client/nametag.js b/scripts/client/nametag.js
index c90f0fc1..3c7f10c8 100644
--- a/scripts/client/nametag.js
+++ b/scripts/client/nametag.js
@@ -23,10 +23,10 @@ let playerPing = {};
// ===========================================================================
function initNameTagScript() {
- logToConsole(LOG_DEBUG, "[VRR.NameTag]: Initializing nametag script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.NameTag]: Initializing nametag script ...");
nametagFont = loadNameTagFont();
afkStatusFont = loadPausedStatusFont();
- logToConsole(LOG_DEBUG, "[VRR.NameTag]: Nametag script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.NameTag]: Nametag script initialized!");
}
// ===========================================================================
diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js
index aa352e94..985fd2c3 100644
--- a/scripts/client/native/connected.js
+++ b/scripts/client/native/connected.js
@@ -213,6 +213,7 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
// ===========================================================================
function setVehicleEngine(vehicleId, state) {
+ //getElementFromId(vehicleId).netFlags.sendSync = state;
getElementFromId(vehicleId).engine = state;
}
diff --git a/scripts/client/netevents.js b/scripts/client/netevents.js
index e7a1e715..2bdbf954 100644
--- a/scripts/client/netevents.js
+++ b/scripts/client/netevents.js
@@ -8,16 +8,15 @@
// TYPE: Client (JavaScript)
// ===========================================================================
-function initServerScript() {
- logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
- addAllNetworkHandlers();
- logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
+function initNetworkEventsScript() {
+ logToConsole(LOG_DEBUG, "[AGRP.NetEvents]: Initializing server script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.NetEvents]: Server script initialized!");
}
// ===========================================================================
function addAllNetworkHandlers() {
- logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Server]: Adding network handlers ...");
// Chat Box
addNetworkEventHandler("m", receiveChatBoxMessageFromServer); // Not prefixed with VRR to make it as small as possible
@@ -49,7 +48,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.heading", setLocalPlayerHeading);
addNetworkEventHandler("agrp.interior", setLocalPlayerInterior);
addNetworkEventHandler("agrp.spawned", onServerSpawnedLocalPlayer);
- addNetworkEventHandler("agrp.money", setLocalPlayerCash);
+ addNetworkEventHandler("agrp.money", setLocalPlayerMoney);
addNetworkEventHandler("agrp.armour", setLocalPlayerArmour);
addNetworkEventHandler("agrp.localPlayerSkin", setLocalPlayerSkin);
addNetworkEventHandler("agrp.pedSpeak", makeLocalPlayerPedSpeak);
@@ -69,7 +68,8 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.veh.lights", setVehicleLights);
addNetworkEventHandler("agrp.veh.engine", setVehicleEngine);
addNetworkEventHandler("agrp.veh.repair", repairVehicle);
- addNetworkEventHandler("agrp.cruiseControl", toggleVehicleCruiseControl);
+ addNetworkEventHandler("agrp.cruiseControl", toggleLocalVehicleCruiseControl);
+ addNetworkEventHandler("agrp.passenger", enterVehicleAsPassenger);
// Radio
addNetworkEventHandler("agrp.radioStream", playStreamingRadio);
@@ -108,6 +108,12 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.changePassword", showChangePasswordGUI);
addNetworkEventHandler("agrp.showLocaleChooser", showLocaleChooserGUI);
addNetworkEventHandler("agrp.guiColour", setGUIColours);
+ addNetworkEventHandler("agrp.mapChangeWarning", setMapChangeWarningState);
+
+ // 2D Rendering
+ addNetworkEventHandler("agrp.set2DRendering", set2DRendering);
+ addNetworkEventHandler("agrp.logo", setServerLogoRenderState);
+ addNetworkEventHandler("agrp.showItemActionDelay", showItemActionDelay);
// Business
addNetworkEventHandler("agrp.business", receiveBusinessFromServer);
@@ -122,13 +128,20 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.locale", setLocale);
addNetworkEventHandler("agrp.localeChooser", toggleLocaleChooserGUI);
+ // Animation
+ addNetworkEventHandler("agrp.anim", makePedPlayAnimation);
+ addNetworkEventHandler("agrp.stopAnim", makePedStopAnimation);
+ addNetworkEventHandler("agrp.forceAnim", forcePedAnimation);
+
+ // Nametags
+ addNetworkEventHandler("agrp.nametag", updatePlayerNameTag);
+ addNetworkEventHandler("agrp.nametagDistance", setNameTagDistance);
+
// Misc
addNetworkEventHandler("agrp.mouseCursor", toggleMouseCursor);
addNetworkEventHandler("agrp.mouseCamera", toggleMouseCamera);
addNetworkEventHandler("agrp.clearPeds", clearLocalPlayerOwnedPeds);
addNetworkEventHandler("agrp.clearPickups", clearLocalPlayerOwnedPickups);
- addNetworkEventHandler("agrp.passenger", enterVehicleAsPassenger);
- addNetworkEventHandler("agrp.logo", setServerLogoRenderState);
addNetworkEventHandler("agrp.ambience", setCityAmbienceState);
addNetworkEventHandler("agrp.runCode", runClientCode);
addNetworkEventHandler("agrp.minuteDuration", setMinuteDuration);
@@ -136,26 +149,20 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.enterPropertyKey", setEnterPropertyKey);
addNetworkEventHandler("agrp.skinSelect", toggleSkinSelect);
addNetworkEventHandler("agrp.hotbar", updatePlayerHotBar);
- addNetworkEventHandler("agrp.showItemActionDelay", showItemActionDelay);
- addNetworkEventHandler("agrp.set2DRendering", set2DRendering);
addNetworkEventHandler("agrp.mouseCameraForce", setMouseCameraState);
addNetworkEventHandler("agrp.logLevel", setLogLevel);
addNetworkEventHandler("agrp.hideAllGUI", hideAllGUI);
- addNetworkEventHandler("agrp.nametag", updatePlayerNameTag);
- addNetworkEventHandler("agrp.nametagDistance", setNameTagDistance);
addNetworkEventHandler("agrp.ping", updatePlayerPing);
- addNetworkEventHandler("agrp.anim", makePedPlayAnimation);
- addNetworkEventHandler("agrp.stopAnim", makePedStopAnimation);
- addNetworkEventHandler("agrp.forceAnim", forcePedAnimation);
addNetworkEventHandler("agrp.clientInfo", serverRequestedClientInfo);
addNetworkEventHandler("agrp.interiorLights", updateInteriorLightsState);
- addNetworkEventHandler("agrp.cutsceneInterior", setCutsceneInterior);
+ addNetworkEventHandler("agrp.scene", changeScene);
addNetworkEventHandler("agrp.syncElement", forceSyncElementProperties);
addNetworkEventHandler("agrp.elementPosition", setElementPosition);
addNetworkEventHandler("agrp.elementCollisions", setElementCollisionsEnabled);
addNetworkEventHandler("agrp.vehBuyState", setVehiclePurchaseState);
addNetworkEventHandler("agrp.holdObject", makePedHoldObject);
addNetworkEventHandler("agrp.profanityFilter", setProfanityFilterState);
+ addNetworkEventHandler("agrp.currencyString", receiveCurrencyStringFromServer);
}
// ===========================================================================
@@ -181,7 +188,7 @@ function sendResourceStoppedSignalToServer() {
// ===========================================================================
function set2DRendering(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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
renderHUD = hudState;
if (getGame() == AGRP_GAME_GTA_IV) {
@@ -206,7 +213,7 @@ function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardS
// ===========================================================================
function onServerSpawnedLocalPlayer(state) {
- logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Main] Setting spawned state to ${state}`);
isSpawned = state;
setUpInitialGame();
if (state) {
@@ -339,7 +346,7 @@ function setLocalPlayerInfiniteRun(state) {
// ===========================================================================
function setLocalPlayerSkin(skinId) {
- logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
+ logToConsole(LOG_INFO, `[AGRP.Server] Setting locale player skin to ${skinId}`);
if (getGame() == AGRP_GAME_GTA_IV) {
if (natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
@@ -364,12 +371,14 @@ function makePedHoldObject(pedId, modelIndex) {
// ===========================================================================
function sendLocalPlayerNetworkIdToServer() {
- sendNetworkEventToServer("agrp.playerPedId", natives.getNetworkIdFromPed(localPlayer));
+ if (getGame() == AGRP_GAME_GTA_IV || getGame() == AGRP_GAME_GTA_IV_EFLC) {
+ sendNetworkEventToServer("agrp.playerPedId", natives.getNetworkIdFromPed(localPlayer));
+ }
}
// ===========================================================================
-function setCutsceneInterior(cutsceneName) {
+function changeScene(sceneName) {
if (getGame() == AGRP_GAME_GTA_IV) {
if (cutsceneName == "") {
natives.clearCutscene();
@@ -379,6 +388,8 @@ function setCutsceneInterior(cutsceneName) {
}
natives.initCutscene(cutsceneName);
}
+ } else if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ game.changeMap(sceneName);
}
}
@@ -435,4 +446,22 @@ function clearLocalPlayerOwnedPickups() {
}
}
+// ===========================================================================
+
+function receiveCurrencyStringFromServer(newCurrencyString) {
+ currencyString = newCurrencyString;
+}
+
+// ===========================================================================
+
+function setMapChangeWarningState(state) {
+ mapChangeWarning = state;
+}
+
+// ===========================================================================
+
+function updatePlayerPing(playerName, ping) {
+ playerPing[playerName] = ping;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/radio.js b/scripts/client/radio.js
index 0c0325a1..842ddefb 100644
--- a/scripts/client/radio.js
+++ b/scripts/client/radio.js
@@ -44,4 +44,8 @@ function playAudioFile(audioName, loop, volume) {
findResourceByName("connectedrp-extra").exports.playCustomAudio(audioName, volume / 100, loop);
}
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
+
+function getStreamingRadioVolumeForPosition(position1, position2) {
+ return false;
+}
\ No newline at end of file
diff --git a/scripts/client/scoreboard.js b/scripts/client/scoreboard.js
index 4f332c65..7f2a4d0a 100644
--- a/scripts/client/scoreboard.js
+++ b/scripts/client/scoreboard.js
@@ -18,10 +18,10 @@ let scoreboardKey = SDLK_TAB;
// ===========================================================================
function initScoreBoardScript() {
- logToConsole(LOG_DEBUG, "[VRR.ScoreBoard]: Initializing scoreboard script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.ScoreBoard]: Initializing scoreboard script ...");
scoreBoardTitleFont = initScoreBoardTitleFont();
scoreBoardListFont = initScoreBoardListFont();
- logToConsole(LOG_DEBUG, "[VRR.ScoreBoard]: Scoreboard script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.ScoreBoard]: Scoreboard script initialized!");
}
// ===========================================================================
diff --git a/scripts/client/skin-select.js b/scripts/client/skin-select.js
index c918625e..4a14a93c 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -11,7 +11,7 @@
let skinSelectMessageFontTop = null;
let skinSelectMessageFontBottom = null;
let skinSelectMessageTextTop = "Skin Name";
-let skinSelectMessageTextBottom = "Choose a skin using PAGEUP and PAGEDOWN keys. Use ENTER to finish or BACKSPACE to cancel.";
+let skinSelectMessageTextBottom = "Choose a skin using LEFT and RIGHT arrow keys. Use ENTER to finish or BACKSPACE to cancel.";
let skinSelectMessageColourTop = COLOUR_YELLOW;
let skinSelectMessageColourBottom = COLOUR_WHITE;
@@ -24,10 +24,10 @@ let skinSelectHeading = null;
// ===========================================================================
function initSkinSelectScript() {
- logToConsole(LOG_DEBUG, "[VRR.SkinSelect]: Initializing skin selector script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.SkinSelect]: Initializing skin selector script ...");
skinSelectMessageFontTop = loadSkinSelectMessageFontTop();
skinSelectMessageFontBottom = loadSkinSelectMessageFontBottom();
- logToConsole(LOG_DEBUG, "[VRR.SkinSelect]: Skin selector script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.SkinSelect]: Skin selector script initialized!");
}
// ===========================================================================
@@ -46,7 +46,7 @@ function loadSkinSelectMessageFontBottom() {
function processSkinSelectKeyPress(keyCode) {
if (usingSkinSelector) {
- if (keyCode == SDLK_LEFT || keyCode == SDLK_A) {
+ if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
if (skinSelectorIndex >= allowedSkins.length - 1) {
skinSelectorIndex = 1;
} else {
@@ -55,7 +55,7 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
setLocalPlayerSkin(allowedSkins[skinSelectorIndex][0]);
- } else if (keyCode == SDLK_RIGHT || keyCode == SDLK_D) {
+ } else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
if (skinSelectorIndex <= 0) {
skinSelectorIndex = allowedSkins.length - 1;
} else {
@@ -64,16 +64,19 @@ function processSkinSelectKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
setLocalPlayerSkin(allowedSkins[skinSelectorIndex][0]);
- } else if (keyCode == SDLK_RETURN) {
+ } else if (keyCode == getKeyIdFromParams("enter")) {
sendNetworkEventToServer("agrp.skinSelected", skinSelectorIndex);
toggleSkinSelect(false);
return true;
- } else if (keyCode == SDLK_BACKSPACE) {
+ } else if (keyCode == getKeyIdFromParams("backspace")) {
sendNetworkEventToServer("agrp.skinSelected", -1);
toggleSkinSelect(false);
return true;
}
- localPlayer.heading = skinSelectHeading;
+
+ if (getGame() <= AGRP_GAME_GTA_SA) {
+ localPlayer.heading = skinSelectHeading;
+ }
}
}
@@ -104,10 +107,18 @@ function toggleSkinSelect(state) {
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);
+ let cameraPosition = localPlayer.position;
+ let playerPosition = localPlayer.position;
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ cameraPosition.y += 1.5;
+ playerPosition.y += 1.5;
+ distance = 3;
+ } else {
+ cameraPosition.z += 0.5;
+ distance = 3;
+ }
+ let frontCameraPosition = getPosInFrontOfPos(cameraPosition, localPlayer.heading, distance);
+ game.setCameraLookAt(frontCameraPosition, playerPosition, true);
}
if (getGame() == AGRP_GAME_GTA_IV) {
diff --git a/scripts/client/startup.js b/scripts/client/startup.js
index a8d30d48..c8ce9e8f 100644
--- a/scripts/client/startup.js
+++ b/scripts/client/startup.js
@@ -13,7 +13,7 @@ function initClientScripts() {
initNameTagScript();
initScoreBoardScript();
initMessagingScript();
- initServerScript();
+ initNetworkEventsScript();
initLogoScript();
initLabelScript();
initChatBoxScript();
@@ -21,6 +21,9 @@ function initClientScripts() {
initKeyBindScript();
initEventScript();
initSkinSelectScript();
+ initCursorScript();
+
+ addAllNetworkHandlers();
}
// ===========================================================================
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index c8b841cc..34cc7a78 100644
--- a/scripts/client/sync.js
+++ b/scripts/client/sync.js
@@ -40,7 +40,6 @@ function processSync(event, deltaTime) {
}
if (streamingRadioElement) {
- streamingRadio.position = getElementPosition(streamingRadioElement.id);
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
}
}
@@ -48,24 +47,14 @@ function processSync(event, deltaTime) {
// ===========================================================================
function setVehicleLights(vehicleId, state) {
- if (getGame() != AGRP_GAME_MAFIA_ONE) {
- if (!state) {
- getElementFromId(vehicleId).lightStatus = 2;
- } else {
- getElementFromId(vehicleId).lightStatus = 1;
- }
- } else if (getGame() == AGRP_GAME_GTA_IV) {
+ if (getGame() == AGRP_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;
- }
+ getElementFromId(vehicleId).lights = state;
}
}
@@ -122,7 +111,7 @@ function syncVehicleProperties(vehicle) {
vehicle.setSuspensionHeight(suspensionHeight);
}
- if (getGame() == AGRP_GAME_GTA_SA) {
+ if (isGameFeatureSupported("vehicleUpgrades")) {
//let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
//for(let i in allUpgrades) {
// vehicle.removeUpgrade(i);
@@ -157,7 +146,7 @@ function syncCivilianProperties(civilian) {
return false;
}
- if (getGame() == AGRP_GAME_GTA_III) {
+ if (isGameFeatureSupported("pedScale")) {
if (doesEntityDataExist(civilian, "agrp.scale")) {
let scaleFactor = getEntityData(civilian, "agrp.scale");
let tempMatrix = civilian.matrix;
@@ -176,7 +165,7 @@ function syncCivilianProperties(civilian) {
}
}
- if (getGame() == AGRP_GAME_GTA_III) {
+ if (getGame() == AGRP_GAME_GTA_SA) {
if (doesEntityDataExist(civilian, "agrp.walkStyle")) {
let walkStyle = getEntityData(civilian, "agrp.walkStyle");
civilian.walkStyle = walkStyle;
@@ -249,12 +238,32 @@ function syncCivilianProperties(civilian) {
// ===========================================================================
+function syncObjectProperties(object) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (isGameFeatureSupported("objectScale")) {
+ if (doesEntityDataExist(object, "agrp.scale")) {
+ let scaleFactor = getEntityData(object, "agrp.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 syncPlayerProperties(player) {
if (!areServerElementsSupported()) {
return false;
}
- if (getGame() == AGRP_GAME_GTA_III) {
+ if (isGameFeatureSupported("pedScale")) {
if (doesEntityDataExist(player, "agrp.scale")) {
let scaleFactor = getEntityData(player, "agrp.scale");
let tempMatrix = player.matrix;
@@ -367,9 +376,17 @@ function syncElementProperties(element) {
return false;
}
- if (doesEntityDataExist(element, "agrp.interior")) {
- if (typeof element.interior != "undefined") {
- element.interior = getEntityData(element, "agrp.interior");
+ if (isGameFeatureSupported("interior")) {
+ if (doesEntityDataExist(element, "agrp.interior")) {
+ if (typeof element.interior != "undefined") {
+ element.interior = getEntityData(element, "agrp.interior");
+ }
+ }
+ }
+
+ if (isGameFeatureSupported("toggleCollision")) {
+ if (doesEntityDataExist(element, "agrp.collisions")) {
+ element.collisionsEnabled = getEntityData(element, "agrp.collisions");
}
}
@@ -404,6 +421,10 @@ function syncElementProperties(element) {
syncPlayerProperties(element);
break;
+ case ELEMENT_OBJECT:
+ syncObjectProperties(element);
+ break;
+
default:
break;
}
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 05000645..490bcef1 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -9,18 +9,19 @@
// ===========================================================================
function setLocalPlayerFrozenState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
+ logToConsole(LOG_DEBUG, `[AGRP.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})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
controlsEnabled = controlState;
+ game.setPlayerControl(controlState);
if (getGame() == AGRP_GAME_GTA_III || getGame() == AGRP_GAME_GTA_VC) {
game.SET_PLAYER_CONTROL(game.GET_PLAYER_ID(), boolToInt(controlState));
- } else if (getGame() != AGRP_GAME_GTA_IV) {
+ } else if (getGame() <= AGRP_GAME_GTA_IV) {
setElementCollisionsEnabled(localPlayer, controlState);
setPedInvincible(localPlayer, true);
}
@@ -28,14 +29,15 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
// ===========================================================================
-function fadeLocalCamera(state, time) {
- if (isFadeCameraSupported()) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time} seconds`);
+function fadeLocalCamera(state, duration, colour) {
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time}ms`);
- if (isFadeCameraSupported()) {
- game.fadeCamera(state, time);
- }
- }
+ cameraFadeDuration = duration;
+ cameraFadeStart = sdl.ticks;
+ cameraFadeEnabled = true;
+ cameraFadeIn = state;
+ cameraFadeColour = colour;
+ cameraFadeAlpha = (state) ? 255 : 0;
}
// ===========================================================================
@@ -47,7 +49,7 @@ function removeLocalPlayerFromVehicle() {
// ===========================================================================
function restoreLocalCamera() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Camera restored`);
if (isGameFeatureSupported("customCamera")) {
game.restoreCamera(true);
}
@@ -55,16 +57,8 @@ function restoreLocalCamera() {
// ===========================================================================
-function clearLocalPlayerOwnedPeds() {
- 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}]`);
+ logToConsole(LOG_DEBUG, `[AGRP.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);
}
@@ -72,8 +66,16 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
// ===========================================================================
+function clearLocalPlayerOwnedPeds() {
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing all self-owned peds ...`);
+ clearSelfOwnedPeds();
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] All self-owned peds cleared`);
+};
+
+// ===========================================================================
+
function setCityAmbienceState(state, clearElements = false) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
game.setTrafficEnabled(state);
if (getMultiplayerMod() == AGRP_MPMOD_GTAC) {
@@ -133,7 +135,7 @@ function enterVehicleAsPassenger() {
// ===========================================================================
function giveLocalPlayerWeapon(weaponId, ammo, active) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
forceWeapon = weaponId;
if (getGame() == AGRP_GAME_MAFIA_ONE) {
localPlayer.giveWeapon(weaponId, 0, ammo);
@@ -154,7 +156,7 @@ function giveLocalPlayerWeapon(weaponId, ammo, active) {
// ===========================================================================
function clearLocalPlayerWeapons(clearData) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing weapons`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing weapons`);
localPlayer.clearWeapons();
if (clearData == true) {
forceWeapon = 0;
@@ -172,7 +174,7 @@ function getClosestVehicle(pos) {
// ===========================================================================
function setLocalPlayerPosition(position) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
if (typeof localPlayer.velocity != "undefined") {
localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
}
@@ -185,7 +187,7 @@ function setLocalPlayerPosition(position) {
// ===========================================================================
function setLocalPlayerHeading(heading) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting heading to ${heading}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting heading to ${heading}`);
if (typeof localPlayer.heading != "undefined") {
localPlayer.heading = heading;
}
@@ -194,7 +196,7 @@ function setLocalPlayerHeading(heading) {
// ===========================================================================
function setLocalPlayerInterior(interior) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting interior to ${interior}`);
if (getMultiplayerMod() == AGRP_MPMOD_GTAC) {
if (!isGTAIV()) {
localPlayer.interior = interior;
@@ -223,7 +225,7 @@ function setLocalPlayerInterior(interior) {
// ===========================================================================
function setSnowState(falling, ground) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
snowing = falling;
if (ground) {
forceSnowing(false);
@@ -240,7 +242,7 @@ function setLocalPlayerHealth(health) {
// ===========================================================================
function playPedSpeech(pedName, speechId) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
if (getMultiplayerMod() == AGRP_MPMOD_GTAC) {
game.SET_CHAR_SAY(int, int);
}
@@ -249,7 +251,7 @@ function playPedSpeech(pedName, speechId) {
// ===========================================================================
function clearLocalPedState() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing local ped state`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing local ped state`);
localPlayer.clearObjective();
}
@@ -263,7 +265,7 @@ function getWeaponSlot(weaponId) {
function setLocalPlayerDrunkEffect(amount, duration) {
if (getMultiplayerMod() == AGRP_MPMOD_GTAC) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
drunkEffectAmount = 0;
drunkEffectDurationTimer = setInterval(function () {
drunkEffectAmount = drunkEffectAmount;
@@ -313,7 +315,7 @@ function clearSelfOwnedVehicles() {
// ===========================================================================
function setMouseCameraState(state) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
mouseCameraEnabled = state;
SetStandardControlsEnabled(!mouseCameraEnabled);
}
@@ -321,50 +323,33 @@ function setMouseCameraState(state) {
// ===========================================================================
function toggleMouseCursor() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
+ logToConsole(LOG_DEBUG, `[AGRP.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`);
+ logToConsole(LOG_DEBUG, `[AGRP.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}`);
+ logToConsole(LOG_DEBUG, `[AGRP.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}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
weaponDamageEnabled[clientName] = state;
}
// ===========================================================================
-function setLocalPlayerCash(amount) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
- if (localPlayer == null) {
- return false;
- }
-
- if (typeof localPlayer.money != "undefined") {
- localPlayer.money = toInteger(amount);
- }
-
- if (getGame() == AGRP_GAME_GTA_IV) {
- natives.setMultiplayerHudCash(amount);
- }
-}
-
-// ===========================================================================
-
function destroyAutoCreatedPickups() {
if (typeof ELEMENT_PICKUP != "undefined") {
getElementsByType(ELEMENT_PICKUP).forEach(function (pickup) {
@@ -411,21 +396,24 @@ function processWantedLevelReset() {
function processLocalPlayerVehicleControlState() {
if (areServerElementsSupported()) {
- if (inVehicle && localPlayer.vehicle != null) {
+ if (localPlayer.vehicle != null) {
if (doesEntityDataExist(localPlayer.vehicle, "agrp.engine")) {
if (getEntityData(localPlayer.vehicle, "agrp.engine") == false) {
localPlayer.vehicle.engine = false;
+ //localPlayer.vehicle.netFlags.sendSync = 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(parkedVehiclePosition) {
+ //if (parkedVehiclePosition) {
// localPlayer.vehicle.position = parkedVehiclePosition;
// localPlayer.vehicle.heading = parkedVehicleHeading;
//}
}
+ } else {
+ //localPlayer.vehicle.netFlags.sendSync = true;
}
}
}
@@ -480,7 +468,7 @@ function getVehicleForNetworkEvent(vehicle) {
// ===========================================================================
function setMinuteDuration(minuteDuration) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting minute duration to ${minuteDuration}ms`);
if (isTimeSupported()) {
game.time.minuteDuration = minuteDuration;
@@ -574,4 +562,56 @@ function setProfanityFilterState(state) {
updateChatBox();
}
+// ===========================================================================
+
+function processVehicleCruiseControl() {
+ if (localPlayer.vehicle == null) {
+ return false;
+ }
+
+ if (!localPlayer.vehicle.isSyncer) {
+ return false;
+ }
+
+ if (getLocalPlayerVehicleSeat() != 0) {
+ return false;
+ }
+
+ if (cruiseControlEnabled) {
+ setVehicleSpeed(cruiseControlSpeed);
+ }
+}
+
+// ===========================================================================
+
+function getCurrencyString(amount) {
+ let tempString = currencyString;
+ tempString = tempString.replace("{AMOUNT}", toString(makeLargeNumberReadable(amount)));
+ return tempString;
+}
+
+// ===========================================================================
+
+function updateLocalPlayerMoney() {
+ if (localPlayer == null) {
+ return false;
+ }
+
+ if (typeof localPlayer.money != "undefined") {
+ localPlayer.money = toInteger(localPlayerMoney);
+ }
+
+ if (getGame() == AGRP_GAME_GTA_IV) {
+ natives.setMultiplayerHudCash(amount);
+ }
+}
+
+// ===========================================================================
+
+function setLocalPlayerMoney(amount) {
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting local player money`);
+ localPlayerMoney = amount;
+ updateLocalPlayerMoney();
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/vehicle.js b/scripts/client/vehicle.js
index 2d824e35..a9268d6c 100644
--- a/scripts/client/vehicle.js
+++ b/scripts/client/vehicle.js
@@ -31,7 +31,7 @@ class VehicleData {
// ===========================================================================
function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2, colour3 = 0, colour4 = 0, locked = false, lights = false, engine = false, licensePlate = "") {
- logToConsole(LOG_DEBUG, `[VRR.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
+ logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
if (getGame() != AGRP_GAME_GTA_IV) {
return false;
@@ -53,7 +53,7 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
} else {
- //logToConsole(LOG_DEBUG, `[VRR.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
//let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
//vehicles.push(tempVehicleData);
@@ -131,14 +131,13 @@ function setAllVehicleDataIndexes() {
// ===========================================================================
-function toggleVehicleCruiseControl(vehicle) {
- if (!vehicle.isSyncer) {
+function toggleLocalVehicleCruiseControl() {
+ if (!localPlayer.vehicle.isSyncer) {
return false;
}
-
-
- cruiseControl = !cruiseControl;
+ cruiseControlEnabled = !cruiseControlEnabled;
+ cruiseControlSpeed = getVehicleSpeed(vehicle);
}
// ===========================================================================
diff --git a/scripts/server/account.js b/scripts/server/account.js
index bd76b8e4..b3271070 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -58,6 +58,7 @@ class AccountData {
this.ircAccount = "";
this.discordAccount = 0;
this.settings = 0;
+ this.seenActionTips = 0;
this.emailAddress = "";
this.ipAddress = 0;
@@ -87,6 +88,7 @@ class AccountData {
this.ircAccount = toInteger(dbAssoc["acct_irc"]);
this.discordAccount = toInteger(dbAssoc["acct_discord"]);
this.settings = toInteger(dbAssoc["acct_svr_settings"]);
+ this.seenActionTips = toInteger(dbAssoc["acct_svr_seen_action_tips"]);
this.emailAddress = toString(dbAssoc["acct_email"]);
this.ipAddress = toString(dbAssoc["acct_ip"]);
@@ -193,8 +195,8 @@ class AccountStaffNoteData {
// ===========================================================================
function initAccountScript() {
- logToConsole(LOG_DEBUG, "[VRR.Account]: Initializing account script ...");
- logToConsole(LOG_DEBUG, "[VRR.Account]: Account script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Account]: Initializing account script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Account]: Account script initialized!");
}
// ===========================================================================
@@ -283,31 +285,31 @@ function toggleAccountGUICommand(command, params, client) {
if (doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
} else {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
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.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
}
if (!isPlayerLoggedIn(client)) {
if (getPlayerData().accountData.databaseId != 0) {
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginGUI(client);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
} else {
hideAllPlayerGUI(client);
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
}
} else {
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationGUI(client);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
hideAllPlayerGUI(client);
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
}
}
}
@@ -322,11 +324,11 @@ function toggleAccountLoginAttemptNotificationsCommand(command, params, client)
if (doesPlayerHaveLoginAlertsEnabled(client)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(false)}OFF{MAINCOLOUR} notification by email when somebody tries to login to your account`);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
} else {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(true)}ON{MAINCOLOUR} notification by email when somebody tries to login to your account`);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
}
return true;
@@ -340,14 +342,14 @@ function toggleAccountServerLogoCommand(command, params, client) {
if (!doesPlayerHaveLogoEnabled(client)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
if (getServerConfig().showLogo) {
updatePlayerShowLogoState(client, true);
}
} else {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
updatePlayerShowLogoState(client, false);
}
@@ -376,11 +378,11 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
} else {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
}
return true;
}
@@ -495,7 +497,7 @@ function changeAccountPasswordCommand(command, params, client) {
}
getPlayerData(client).accountData.password = hashAccountPassword(getPlayerData(client).accountData.name, params);
- messagePlayerSuccess(client, `Your password has been changed!`);
+ messagePlayerSuccess(client, getLocaleString(client, "PasswordChanged"));
}
// ===========================================================================
@@ -591,7 +593,7 @@ function verifyAccountEmailCommand(command, params, client) {
let verificationCode = getParam(params, " ", 1);
if (isAccountEmailVerified(getPlayerData(client).accountData)) {
- messagePlayerError(client, `You already verified your email!`);
+ messagePlayerError(client, getLocaleString(client, "AccountEmailAlreadyVerified"));
return false;
}
@@ -644,7 +646,7 @@ function resetAccountPasswordCommand(command, params, client) {
// ===========================================================================
function setAccountDiscordCommand(command, params, client) {
- messagePlayerError(client, `This command is not yet finished and will be available soon!`);
+ messagePlayerError(client, getLocaleString(client, "CommandDisabled"));
return false;
if (areParamsEmpty(params)) {
@@ -830,7 +832,7 @@ function saltAccountInfo(name, password) {
// ===========================================================================
function loginSuccess(client) {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
getPlayerData(client).loggedIn = true;
if (getPlayerData(client).loginTimeout != null) {
@@ -841,23 +843,23 @@ function loginSuccess(client) {
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
- logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
+ logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
setPlayerNativeAdminState(client, true);
}
if (doesServerHaveTesterOnlyEnabled()) {
if (!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
setTimeout(function () {
- getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
+ getPlayerData(client).customDisconnectReason = "NotATester";
disconnectPlayer(client);
}, 3500);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
return false;
} else {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
}
@@ -868,10 +870,10 @@ function loginSuccess(client) {
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = AGRP_PROMPT_CREATEFIRSTCHAR;
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
} else {
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
}
} else {
showCharacterSelectToClient(client);
@@ -921,6 +923,7 @@ function saveAccountToDatabase(accountData) {
let data2 = [
["acct_svr_settings", (accountData.settings != NaN) ? toInteger(accountData.settings) : 0],
+ ["acct_svr_seen_action_tips", (accountData.seenActionTips != NaN) ? toInteger(accountData.seenActionTips) : 0],
["acct_svr_staff_title", toString(safeStaffTitle)],
["acct_svr_staff_flags", (accountData.flags.admin != NaN) ? toInteger(accountData.flags.admin) : 0],
["acct_svr_mod_flags", (accountData.flags.moderation != NaN) ? toInteger(accountData.flags.moderation) : 0],
@@ -1064,41 +1067,41 @@ function createAccount(name, password, email = "") {
function checkLogin(client, password) {
getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining - 1;
if (getPlayerData(client).loginAttemptsRemaining <= 0) {
- getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ getPlayerData(client).customDisconnectReason = "FailedToLogin";
disconnectPlayer(client);
}
if (isPlayerLoggedIn(client)) {
- logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
+ logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
} else {
- messagePlayerError(client, "You are already logged in!");
+ messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
}
return false;
}
if (!isPlayerRegistered(client)) {
- logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
+ logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationGUI(client);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
}
return false;
}
if (areParamsEmpty(password)) {
- logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
+ logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
+ showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
} else {
- messagePlayerError(client, `You must enter a password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
+ messagePlayerError(client, getLocaleString(client, "LoginFailedNoPassword", getPlayerData(client).loginAttemptsRemaining));
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
}
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
@@ -1109,13 +1112,13 @@ function checkLogin(client, password) {
}
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
- logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
+ logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
+ showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
} else {
- messagePlayerError(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
+ messagePlayerError(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
}
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
@@ -1148,7 +1151,7 @@ function checkLogin(client, password) {
// ===========================================================================
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
- logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Checking registration for ${getPlayerName(client)}`);
if (isPlayerRegistered(client)) {
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
@@ -1175,7 +1178,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPassword"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
} else {
- messagePlayerError(client, "The password cannot be blank!");
+ messagePlayerError(client, getLocaleString(client, "RegistrationFailedNoPassword"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
}
return false;
@@ -1211,7 +1214,20 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordWeak"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password doesn't meet requirements)`);
} else {
- messagePlayerError(client, "Password doesn't meet requirements!");
+ messagePlayerError(client, getLocaleString(client, "PasswordNotGoodEnough"));
+ let passwordRequirements = []
+ if (getGlobalConfig().passwordRequiredCapitals > 0) {
+ passwordRequirements.push(getLocaleString(client, "PasswordNeedsCapitals", getGlobalConfig().passwordRequiredCapitals))
+ }
+
+ if (getGlobalConfig().passwordRequiredNumbers > 0) {
+ passwordRequirements.push(getLocaleString(client, "PasswordNeedsNumbers", getGlobalConfig().passwordRequiredNumbers))
+ }
+
+ if (getGlobalConfig().passwordRequiredSymbols > 0) {
+ passwordRequirements.push(getLocaleString(client, "PasswordNeedsSymbols", getGlobalConfig().passwordRequiredSymbols))
+ }
+ messagePlayerInfo(client, getLocaleString(client, "PasswordNeedsBase", passwordRequirements.join(", ")));
}
return false;
}
@@ -1231,7 +1247,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
}
- messagePlayerAlert(client, `${getServerName()} staff have been notified of the problem and will fix it shortly.`);
+ messagePlayerAlert(client, getLocaleString(client, "DevelopersNotified"));
return false;
}
@@ -1251,16 +1267,16 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
if (doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
setTimeout(function () {
- getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
+ getPlayerData(client).customDisconnectReason = "NotATester";
disconnectPlayer(client);
}, 5000);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
return false;
} else {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
}
@@ -1272,7 +1288,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = AGRP_PROMPT_CREATEFIRSTCHAR;
} else {
- messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage"), `{ALTCOLOUR}/newchar{MAINCOLOUR}`);
+ messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
}
}
};
@@ -1313,7 +1329,7 @@ function checkAccountResetPasswordRequest(client, inputText) {
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, ${getPlayerData(client).passwordResetAttemptsRemaining} attempts remaining)`);
if (getPlayerData(client).passwordResetAttemptsRemaining <= 0) {
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, no more attempts remaining, kicking ...)`);
- getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ getPlayerData(client).customDisconnectReason = "FailedToLogin";
disconnectPlayer(client);
return false;
}
@@ -1352,9 +1368,9 @@ function checkAccountChangePassword(client, newPassword, confirmNewPassword) {
if (!doesPasswordMeetRequirements(newPassword)) {
let passwordRequirementsString = `${needsCapitals}, ${needsNumbers}, ${needsSymbols}`;
- let needsCapitals = getLocaleString(client, "PasswordNeedsCapitals", "1");
- let needsNumbers = getLocaleString(client, "PasswordNeedsNumbers", "1");
- let needsSymbols = getLocaleString(client, "PasswordNeedsSymbols", "1");
+ let needsCapitals = getLocaleString(client, "PasswordNeedsCapitals", getGlobalConfig().passwordRequiredCapitals);
+ let needsNumbers = getLocaleString(client, "PasswordNeedsNumbers", getGlobalConfig().passwordRequiredNumbers);
+ let needsSymbols = getLocaleString(client, "PasswordNeedsSymbols", getGlobalConfig().passwordRequiredSymbols);
messagePlayerError(client, getLocaleString(client, "AccountPasswordNeedsImproved"));
messagePlayerInfo(client, getLocaleString(client, "PasswordNeedsBase", passwordRequirementsString));
@@ -1391,11 +1407,11 @@ function isValidEmailAddress(emailAddress) {
// ===========================================================================
function saveAllPlayersToDatabase() {
- logToConsole(LOG_DEBUG, "[VRR.Account]: Saving all clients to database ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Account]: Saving all clients to database ...");
getClients().forEach(function (client) {
savePlayerToDatabase(client);
});
- logToConsole(LOG_DEBUG, "[VRR.Account]: All clients saved to database successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.Account]: All clients saved to database successfully!");
}
// ===========================================================================
@@ -1409,7 +1425,7 @@ function savePlayerToDatabase(client) {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Account]: Saving client ${getPlayerName(client)} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Saving client ${getPlayerName(client)} to database ...`);
saveAccountToDatabase(getPlayerData(client).accountData);
if (getPlayerData(client).currentSubAccount != -1) {
@@ -1431,100 +1447,12 @@ function savePlayerToDatabase(client) {
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
}
- logToConsole(LOG_DEBUG, `[VRR.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
return true;
}
// ===========================================================================
-function initClient(client) {
- logToConsole(LOG_DEBUG, `[VRR.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
-
- if (isConsole(client)) {
- logToConsole(LOG_DEBUG | LOG_ERROR, `[VRR.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
- return false;
- }
-
- logToConsole(LOG_DEBUG, `[VRR.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
-
- if (playerInitialized[client.index] == true) {
- logToConsole(LOG_DEBUG | LOG_ERROR, `[VRR.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
- return false;
- }
-
- playerInitialized[client.index] = true;
-
- //setEntityData(client, "agrp.isInitialized", true, false);
-
- logToConsole(LOG_DEBUG, `[VRR.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
- sendPlayerGUIColours(client);
- sendPlayerGUIInit(client);
- updatePlayerSnowState(client);
-
- //logToConsole(LOG_DEBUG, `[VRR.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
- //showConnectCameraToPlayer(client);
-
- messageClient(`Please wait ...`, client, getColourByName("softGreen"));
-
- logToConsole(LOG_DEBUG, `[VRR.Account] Waiting for 2.5 seconds to prevent race attack ...`);
- setTimeout(function () {
- if (client != null) {
- clearChatBox(client);
- logToConsole(LOG_DEBUG, `[VRR.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
- let tempAccountData = loadAccountFromName(getPlayerName(client), true);
-
- logToConsole(LOG_DEBUG, `[VRR.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
- let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
-
- getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
-
- getServerData().clients[getPlayerId(client)].sessionId = saveConnectionToDatabase(client);
- getServerData().clients[getPlayerId(client)].connectTime = getCurrentUnixTimestamp();
- requestClientInfo(client);
-
- if (tempAccountData != false) {
- sendPlayerLocaleId(client, getPlayerData(client).accountData.locale);
- if (isAccountAutoIPLoginEnabled(tempAccountData) && getPlayerData(client).accountData.ipAddress == getPlayerIP(client)) {
- messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
- loginSuccess(client);
- playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
- } else {
- if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
- showPlayerLoginGUI(client);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
- messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
-
- //if(checkForGeoIPModule()) {
- // let iso = module.geoip.getCountryISO(getPlayerIP(client));
- // let localeId = getLocaleFromCountryISO(iso);
- //}
- //showSmallGameMessage(client, getLocaleString(client, "LocaleOffer", `/lang ${getLocaleData(localeId)[2]}`), getColourByName("white"), 10000, "Roboto");
- }
- startLoginTimeoutForPlayer(client);
- playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
- }
- } else {
- sendPlayerLocaleId(client, 0);
- if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
- showPlayerRegistrationGUI(client);
- } else {
- logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
- messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
- }
- playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
- }
-
- getServerData().clients[getPlayerId(client)].keyBinds = loadAccountKeybindsFromDatabase(getServerData().clients[getPlayerId(client)].accountData.databaseId);
- sendAccountKeyBindsToClient(client);
- }
- }, 2500);
-}
-
-// ===========================================================================
-
function saveConnectionToDatabase(client) {
let dbConnection = connectToDatabase();
if (dbConnection) {
@@ -1548,7 +1476,7 @@ function createDefaultAccountServerData(accountDatabaseId) {
// ===========================================================================
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
- logToConsole(LOG_DEBUG, `[VRR.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
let tempAccountKeybinds = [];
let dbConnection = connectToDatabase();
@@ -1572,7 +1500,7 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountKeyBindData = new KeyBindData(dbAssoc);
tempAccountKeybinds.push(tempAccountKeyBindData);
- logToConsole(LOG_DEBUG, `[VRR.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -1581,14 +1509,14 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
}
}
- logToConsole(LOG_DEBUG, `[VRR.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
return tempAccountKeybinds;
}
// ===========================================================================
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
- logToConsole(LOG_DEBUG, `[VRR.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
let tempAccountStaffNotes = [];
let dbConnection = connectToDatabase();
@@ -1602,7 +1530,7 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc);
tempAccountStaffNotes.push(tempAccountStaffNoteData);
- logToConsole(LOG_DEBUG, `[VRR.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -1610,14 +1538,14 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
return tempAccountStaffNotes;
}
// ===========================================================================
function loadAccountContactsFromDatabase(accountDatabaseID) {
- logToConsole(LOG_DEBUG, `[VRR.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
let tempAccountContacts = [];
let dbConnection = connectToDatabase();
@@ -1631,7 +1559,7 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountContactData = new AccountContactData(dbAssoc);
tempAccountContacts.push(tempAccountContactData);
- logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -1639,14 +1567,14 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
return tempAccountContacts;
}
// ===========================================================================
function loadAccountMessagesFromDatabase(accountDatabaseID) {
- logToConsole(LOG_DEBUG, `[VRR.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
let tempAccountMessages = [];
let dbConnection = connectToDatabase();
@@ -1660,7 +1588,7 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempAccountMessageData = new AccountContactData(dbAssoc);
tempAccountMessages.push(tempAccountMessageData);
- logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -1668,7 +1596,7 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
return tempAccountMessages;
}
@@ -1747,34 +1675,34 @@ function generateEmailVerificationCode() {
// ===========================================================================
-function sendEmailVerificationEmail(client, emailVerificationCode) {
+async function sendEmailVerificationEmail(client, emailVerificationCode) {
let emailBodyText = getEmailConfig().bodyContent.confirmEmail;
emailBodyText = emailBodyText.replace("{VERIFICATIONCODE}", emailVerificationCode);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
- sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerName()}`, emailBodyText);
+ await sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerName()}`, emailBodyText);
}
// ===========================================================================
-function sendPasswordResetEmail(client, verificationCode) {
+async function sendPasswordResetEmail(client, verificationCode) {
let emailBodyText = getEmailConfig().bodyContent.confirmPasswordReset;
emailBodyText = emailBodyText.replace("{VERIFICATIONCODE}", verificationCode);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
- sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Reset your password on ${getServerName()}`, emailBodyText);
+ await sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Reset your password on ${getServerName()}`, emailBodyText);
}
// ===========================================================================
-function verifyAccountEmail(accountData, verificationCode) {
+async function verifyAccountEmail(accountData, verificationCode) {
let emailVerificationCode = generateRandomString(10);
let emailBodyText = getEmailConfig().bodyContent.confirmEmail;
emailBodyText = emailBodyText.replace("{VERIFICATIONCODE}", emailVerificationCode);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
- sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerName()}`, emailBodyText);
+ await sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerName()}`, emailBodyText);
getPlayerData(client).accountData.emailAddress = emailAddress;
getPlayerData(client).accountData.emailVerificationCode = module.hashing.sha512(emailVerificationCode);
@@ -1782,7 +1710,7 @@ function verifyAccountEmail(accountData, verificationCode) {
// ===========================================================================
-function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getGame()) {
+async function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getGame()) {
let countryName = module.geoip.getCountryName(getGlobalConfig().geoIPCountryDatabaseFilePath, ip);
let subDivisionName = module.geoip.getSubdivisionName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
let cityName = module.geoip.getCityName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
@@ -1794,13 +1722,13 @@ function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getGa
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
- sendEmail(emailAddress, name, `Login failed on ${getServerName()}`, emailBodyText);
+ await sendEmail(emailAddress, name, `Login failed on ${getServerName()}`, emailBodyText);
return true;
}
// ===========================================================================
-function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getGame()) {
+async function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getGame()) {
let countryName = module.geoip.getCountryName(getGlobalConfig().geoIPCountryDatabaseFilePath, ip);
let subDivisionName = module.geoip.getSubdivisionName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
let cityName = module.geoip.getCityName(getGlobalConfig().geoIPCityDatabaseFilePath, ip);
@@ -1812,7 +1740,7 @@ function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getG
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
- sendEmail(emailAddress, name, `Login successful on ${getServerName()}`, emailBodyText);
+ await sendEmail(emailAddress, name, `Login successful on ${getServerName()}`, emailBodyText);
return true;
}
@@ -1845,7 +1773,7 @@ function checkPlayerTwoFactorAuthentication(client, authCode) {
}
}
- getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ getPlayerData(client).customDisconnectReason = "FailedToLogin";
disconnectPlayer(client);
return false;
}
@@ -1858,13 +1786,13 @@ function isPlayerATester(client) {
// ===========================================================================
-function sendAccountTwoFactorAuthCode(emailAddress, name, twoFactorAuthCode) {
+async function sendAccountTwoFactorAuthCode(emailAddress, name, twoFactorAuthCode) {
let emailBodyText = getEmailConfig().bodyContent.twoFactorAuthentication;
emailBodyText = emailBodyText.replace("{2FACODE}", twoFactorAuthCode);
emailBodyText = emailBodyText.replace("{GAMENAME}", getGameName(getGame()));
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
- sendEmail(emailAddress, name, `Login code for ${getServerName()}`, emailBodyText);
+ await sendEmail(emailAddress, name, `Login code for ${getServerName()}`, emailBodyText);
return true;
}
@@ -1873,7 +1801,7 @@ function sendAccountTwoFactorAuthCode(emailAddress, name, twoFactorAuthCode) {
function startLoginTimeoutForPlayer(client) {
getPlayerData(client).loginTimeout = setTimeout(function () {
if (isPlayerLoggedIn(client) == false) {
- getPlayerData(client).customDisconnectReason = "Kicked - Login timeout";
+ getPlayerData(client).customDisconnectReason = "FailedToLogin";
disconnectPlayer(client);
}
}, getGlobalConfig().loginTimeout);
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index d92d493d..ce41a7a4 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initAnimationScript() {
- logToConsole(LOG_DEBUG, "[VRR.Animation]: Initializing animation script ...");
- logToConsole(LOG_DEBUG, "[VRR.Animation]: Animation script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Animation]: Initializing animation script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Animation]: Animation script initialized!");
}
// ===========================================================================
@@ -44,7 +44,9 @@ function playPlayerAnimationCommand(command, params, client) {
return false;
}
- messagePlayerTip(client, getLocaleString(client, "AnimationStopCommandTip", "{ALTCOLOUR}/stopanim{MAINCOLOUR}"));
+ if (hasPlayerSeenActionTip(client, "AnimationStop")) {
+ messagePlayerTip(client, getGroupedLocaleString(client, "ActionTips", "AnimationStop", "{ALTCOLOUR}/stopanim{MAINCOLOUR}"));
+ }
makePlayerPlayAnimation(client, animationSlot, animationPositionOffset);
}
@@ -66,6 +68,8 @@ function stopPlayerAnimationCommand(command, params, client) {
getPlayerData(client).animationForced = false;
//setPlayerMouseCameraState(client, false);
+
+ markPlayerActionTipSeen(client, "AnimationStop");
}
// ===========================================================================
@@ -98,7 +102,7 @@ function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
getPlayerData(client).animationForced = false;
makePedPlayAnimation(getPlayerPed(client), animationSlot, offsetPosition);
- setEntityData(getPlayerPed(client), "agrp.anim", animationSlot, true);
+ //setEntityData(getPlayerPed(client), "agrp.anim", animationSlot, true);
//if(getAnimationData(animationSlot)[9] != AGRP_ANIMMOVE_NONE) {
// if(getGame() < AGRP_GAME_GTA_SA) {
// setPlayerMouseCameraState(client, true);
diff --git a/scripts/server/anticheat.js b/scripts/server/anticheat.js
index fea0c43d..15af26e6 100644
--- a/scripts/server/anticheat.js
+++ b/scripts/server/anticheat.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initAntiCheatScript() {
- logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
- logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.AntiCheat]: Initializing anticheat script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.AntiCheat]: Anticheat script initialized!");
}
// ===========================================================================
diff --git a/scripts/server/ban.js b/scripts/server/ban.js
index 3650bdf9..74ba35f3 100644
--- a/scripts/server/ban.js
+++ b/scripts/server/ban.js
@@ -39,8 +39,8 @@ class BanData {
// ===========================================================================
function initBanScript() {
- logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
- logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
+ logToConsole(LOG_INFO, "[AGRP.Ban]: Initializing ban script ...");
+ logToConsole(LOG_INFO, "[AGRP.Ban]: Ban script initialized!");
}
// ===========================================================================
@@ -66,12 +66,12 @@ function accountBanCommand(command, params, client) {
return false;
}
- logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
+ logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
- getPlayerData(targetClient).customDisconnectReason = `Banned - ${reason}`;
+ getPlayerData(targetClient).customDisconnectReason = "Banned";
disconnectPlayer(targetClient);
}
@@ -98,12 +98,12 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
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, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
- getPlayerData(targetClient).customDisconnectReason = `Banned - ${reason}`;
+ getPlayerData(targetClient).customDisconnectReason = "Banned";
disconnectPlayer(targetClient);
}
@@ -133,7 +133,7 @@ function ipBanCommand(command, params, client, fromDiscord) {
announceAdminAction(`PlayerIPBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
banIPAddress(getPlayerIP(targetClient), getPlayerData(client).accountData.databaseId, reason);
- getPlayerData(targetClient).customDisconnectReason = `IP Banned - ${reason}`;
+ getPlayerData(targetClient).customDisconnectReason = "Banned";
serverBanIP(getPlayerIP(targetClient));
disconnectPlayer(targetClient);
}
@@ -165,7 +165,7 @@ function subNetBanCommand(command, params, client, fromDiscord) {
announceAdminAction(`PlayerSubNetBanned`, `{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR}`);
banSubNet(getPlayerIP(targetClient), getSubNet(getPlayerIP(targetClient), octetAmount), getPlayerData(client).accountData.databaseId, reason);
- getPlayerData(client).customDisconnectReason = `IP Subnet Banned - ${reason}`;
+ getPlayerData(client).customDisconnectReason = "Banned";
serverBanIP(getPlayerIP(targetClient));
}
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index e0635c77..8aa99b08 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -16,7 +16,7 @@ let serverBitFlags = {
accountSettingsFlags: {},
subAccountSettingsFlags: {},
accountFlags: {},
- seenHelpTipsFlags: {},
+ seenActionTipsFlags: {},
npcTriggerTypeFlags: {},
npcTriggerConditionTypesFlags: {},
npcTriggerResponseTypeFlags: {},
@@ -240,12 +240,28 @@ let serverBitFlagKeys = {
"EnterProperty",
"SearchArea",
],
- seenHelpTipsKeys: [
+ seenActionTipsKeys: [
"None",
"VehicleEngineOffWhenEntering",
"VehicleLockedAfterEntryAttempt",
"ShowItemsAfterPurchase",
"BuyCommandAfterEnterBusiness",
+ "UseItemKeyAfterEquipping",
+ "UseItemKeyAfterEquippingWalkieTalkie",
+ "RadioCommandAfterEnablingWalkieTalkie",
+ "ReplyToDirectMessage",
+ "UseItemKeyAmmoAfterEquippingWeapon",
+ "AnimationStop",
+ "JobEquipmentInventory",
+ "ViewInventory",
+ "VehicleRepairItemUsage",
+ "VehicleColourItemUsage",
+ "VehiclePartItemUsage",
+ "AmmoClipItemUsage",
+ "GenericItemUsage",
+ "EnterJobVehicleForRoute",
+ "JobLocations",
+ "JobRouteStart",
],
jobRankKeys: [
"None",
@@ -265,7 +281,7 @@ let serverBitFlagKeys = {
// ===========================================================================
function initBitFlagScript() {
- logToConsole(LOG_DEBUG, "[VRR.BitFlag]: Initializing bit flag script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.BitFlag]: Initializing bit flag script ...");
serverBitFlags.staffFlags = createBitFlagTable(serverBitFlagKeys.staffFlagKeys);
serverBitFlags.moderationFlags = createBitFlagTable(serverBitFlagKeys.moderationFlagKeys);
serverBitFlags.accountSettingsFlags = createBitFlagTable(serverBitFlagKeys.accountSettingsFlagKeys);
@@ -277,9 +293,9 @@ function initBitFlagScript() {
serverBitFlags.npcTriggerTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerTypeKeys);
serverBitFlags.npcTriggerConditionTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerConditionTypeKeys);
serverBitFlags.npcTriggerResponseTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerResponseTypeKeys);
- serverBitFlags.seenHelpTips = createBitFlagTable(serverBitFlagKeys.seenHelpTipsKeys);
+ serverBitFlags.seenActionTips = createBitFlagTable(serverBitFlagKeys.seenActionTipsKeys);
serverBitFlags.jobRankFlags = createBitFlagTable(serverBitFlagKeys.jobRankKeys);
- logToConsole(LOG_INFO, "[VRR.BitFlag]: Bit flag script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.BitFlag]: Bit flag script initialized successfully!");
return true;
}
@@ -443,6 +459,20 @@ function getClanDiscordWebhookValue(flagName) {
// ===========================================================================
+function getSeenActionTipsValue(flagName) {
+ if (flagName == "All") {
+ return -1;
+ }
+
+ if (typeof serverBitFlags.seenActionTips[flagName] == "undefined") {
+ return false;
+ }
+
+ return serverBitFlags.seenActionTips[flagName];
+}
+
+// ===========================================================================
+
function givePlayerStaffFlag(client, flagName) {
if (!getStaffFlagValue(flagName)) {
return false;
diff --git a/scripts/server/business.js b/scripts/server/business.js
index ea801d8c..bc2dd99b 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -59,6 +59,7 @@ class BusinessData {
this.needsSaved = false;
this.interiorLights = true;
this.type = AGRP_BIZ_TYPE_NONE;
+ this.propertyType = AGRP_PROPERTY_TYPE_BUSINESS;
this.floorItemCache = [];
this.storageItemCache = [];
@@ -73,6 +74,7 @@ class BusinessData {
this.entranceBlipModel = -1;
this.entrancePickup = null;
this.entranceBlip = null;
+ this.entranceScene = "";
this.exitPosition = false;
this.exitRotation = 0.0;
@@ -82,6 +84,7 @@ class BusinessData {
this.exitBlipModel = -1;
this.exitPickup = null;
this.exitBlip = null;
+ this.exitScene = "";
this.entranceFee = 0;
this.till = 0;
@@ -108,6 +111,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.entranceScene = toString(dbAssoc["biz_entrance_scene"]);
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"]);
@@ -115,6 +119,7 @@ class BusinessData {
this.exitDimension = toInteger(dbAssoc["biz_exit_vw"]);
this.exitPickupModel = toInteger(dbAssoc["biz_exit_pickup"]);
this.exitBlipModel = toInteger(dbAssoc["biz_exit_blip"]);
+ this.exitScene = toString(dbAssoc["biz_exit_scene"]);
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
this.till = toInteger(dbAssoc["biz_till"]);
@@ -182,8 +187,8 @@ class BusinessGameScriptData {
// ===========================================================================
function initBusinessScript() {
- logToConsole(LOG_INFO, "[VRR.Business]: Initializing business script ...");
- logToConsole(LOG_INFO, "[VRR.Business]: Business script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Business]: Initializing business script ...");
+ logToConsole(LOG_INFO, "[AGRP.Business]: Business script initialized successfully!");
return true;
}
@@ -208,7 +213,7 @@ function loadBusinessFromId(businessId) {
// ===========================================================================
function loadBusinessesFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Business]: Loading businesses from database ...");
+ logToConsole(LOG_INFO, "[AGRP.Business]: Loading businesses from database ...");
let tempBusinesses = [];
let dbConnection = connectToDatabase();
@@ -224,7 +229,7 @@ function loadBusinessesFromDatabase() {
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
tempBusinesses.push(tempBusinessData);
- logToConsole(LOG_VERBOSE, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -232,14 +237,14 @@ function loadBusinessesFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
return tempBusinesses;
}
// ===========================================================================
function loadBusinessLocationsFromDatabase(businessId) {
- logToConsole(LOG_VERBOSE, `[VRR.Business]: Loading business locations for business ${businessId} from database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business locations for business ${businessId} from database ...`);
let tempBusinessLocations = [];
let dbConnection = connectToDatabase();
@@ -255,7 +260,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessLocationData = new BusinessLocationData(dbAssoc);
tempBusinessLocations.push(tempBusinessLocationData);
- logToConsole(LOG_VERBOSE, `[VRR.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -263,7 +268,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_VERBOSE, `[VRR.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
return tempBusinessLocations;
}
@@ -271,7 +276,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
/*
function loadBusinessGameScriptsFromDatabase(businessId) {
- logToConsole(LOG_VERBOSE, `[VRR.Business]: Loading business game scripts for business ${businessId} from database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business game scripts for business ${businessId} from database ...`);
let tempBusinessGameScripts = [];
let dbConnection = connectToDatabase();
@@ -287,7 +292,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc);
tempBusinessGameScripts.push(tempBusinessGameScriptData);
- logToConsole(LOG_VERBOSE, `[VRR.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -295,7 +300,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_VERBOSE, `[VRR.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
return tempBusinessGameScripts;
}
*/
@@ -312,9 +317,17 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
*
*/
function createBusinessCommand(command, params, client) {
- createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getGame()].Business, -1, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorCutscene);
+ createBusiness(
+ params,
+ getPlayerPosition(client),
+ toVector3(0.0, 0.0, 0.0),
+ (isGameFeatureSupported("pickup")) ? getGameConfig().pickupModels[getGame()].Business : -1,
+ -1,
+ getPlayerInterior(client),
+ getPlayerDimension(client),
+ getPlayerData(client).interiorScene);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`, true);
}
// ===========================================================================
@@ -349,12 +362,12 @@ function createBusinessLocationCommand(command, params, client) {
let tempBusinessLocationData = createBusinessLocation(locationType, businessId);
getServerData().businesses[businessId].push(tempBusinessLocationData);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`, true);
}
// ===========================================================================
-function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceCutscene = -1) {
+function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1) {
let tempBusinessData = new BusinessData(false);
tempBusinessData.name = name;
@@ -364,7 +377,7 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
tempBusinessData.entranceBlipModel = entranceBlipModel;
tempBusinessData.entranceInterior = entranceInterior;
tempBusinessData.entranceDimension = entranceDimension;
- tempBusinessData.entranceCutscene = entranceCutscene;
+ tempBusinessData.entranceScene = entranceScene;
tempBusinessData.exitPosition = exitPosition;
tempBusinessData.exitRotation = 0.0;
@@ -372,7 +385,7 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
tempBusinessData.exitBlipModel = -1;
tempBusinessData.exitInterior = 0;
tempBusinessData.exitDimension = 0;
- tempBusinessData.exitCutscene = -1;
+ tempBusinessData.exitScene = -1;
tempBusinessData.needsSaved = true;
let businessId = getServerData().businesses.push(tempBusinessData);
@@ -409,7 +422,7 @@ function deleteBusinessCommand(command, params, client) {
}
deleteBusiness(businessId, getPlayerData(client).accountData.databaseId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`, true);
}
// ===========================================================================
@@ -459,7 +472,7 @@ function setBusinessNameCommand(command, params, client) {
getBusinessData(businessId).name = newBusinessName;
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true);
}
// ===========================================================================
@@ -543,7 +556,7 @@ function setBusinessJobCommand(command, params, client) {
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {jobYellow}${getJobData(jobId).name}`);
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to the {jobYellow}${getJobData(jobId).name}`);
}
// ===========================================================================
@@ -582,8 +595,9 @@ function setBusinessClanCommand(command, params, client) {
return false;
}
+ // Use confirm prompt
showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
- getPlayerData(client).promptType = AGRP_PROMPT_BIZGIVETOCLAN;
+ getPlayerData(client).promptType = AGRP_PROMPT_GIVEBIZTOCLAN;
//getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_CLAN;
//getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
@@ -847,7 +861,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
getBusinessData(businessId).entranceFee = entranceFee;
getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to [#AAAAAAA]$${entranceFee}`);
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
}
// ===========================================================================
@@ -940,14 +954,14 @@ function getBusinessInfoCommand(command, params, client) {
[`ID`, `${businessData.index}/${businessData.databaseId}`],
[`Owner`, `${ownerName} (${getBusinessOwnerTypeText(businessData.ownerType)})`],
[`Locked`, `${getLockedUnlockedFromBool(businessData.locked)}`],
- [`BuyPrice`, `$${businessData.buyPrice}`],
+ [`BuyPrice`, `${getCurrencyString(businessData.buyPrice)}`],
//[`RentPrice`, `${businessData.rentPrice}`],
[`HasInterior`, `${getYesNoFromBool(businessData.hasInterior)}`],
[`CustomInterior`, `${getYesNoFromBool(businessData.customInterior)}`],
[`HasBuyableItems`, `${getYesNoFromBool(doesBusinessHaveAnyItemsToBuy(businessId))}`],
- [`EntranceFee`, `$${businessData.entranceFee}`],
+ [`EntranceFee`, `${getCurrencyString(businessData.entranceFee)}`],
[`InteriorLights`, `${getOnOffFromBool(businessData.interiorLights)}`],
- [`Balance`, `$${businessData.till}`],
+ [`Balance`, `${getCurrencyString(businessData.till)}`],
[`RadioStation`, `${businessData.streamingRadioStation}`],
[`LabelHelpType`, `${businessData.labelHelpType}`],
];
@@ -1012,6 +1026,11 @@ function getBusinessStorageItemsCommand(command, params, client) {
return false;
}
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
showBusinessStorageInventoryToPlayer(client, businessId);
}
@@ -1057,7 +1076,7 @@ function setBusinessPickupCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup display to {ALTCOLOUR}${typeParam}!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup to {ALTCOLOUR}${typeParam}!`, true);
}
// ===========================================================================
@@ -1091,10 +1110,11 @@ function setBusinessInteriorTypeCommand(command, params, client) {
getBusinessData(businessId).exitDimension = 0;
getBusinessData(businessId).exitInterior = -1;
getBusinessData(businessId).hasInterior = false;
- getBusinessData(businessId).interiorCutscene = "";
+ getBusinessData(businessId).entranceScene = "";
+ getBusinessData(businessId).exitScene = "";
getBusinessData(businessId).exitPickupModel = -1;
getBusinessData(businessId).customInterior = false;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`, true);
return false;
}
@@ -1113,10 +1133,17 @@ function setBusinessInteriorTypeCommand(command, params, client) {
getBusinessData(businessId).exitPosition = getGameConfig().interiors[getGame()][typeParam][0];
getBusinessData(businessId).exitInterior = getGameConfig().interiors[getGame()][typeParam][1];
getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId + getGlobalConfig().businessDimensionStart;
- getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
+ getBusinessData(businessId).exitPickupModel = (isGameFeatureSupported("pickup")) ? getGameConfig().pickupModels[getGame()].Exit : -1;
getBusinessData(businessId).hasInterior = true;
getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
- getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getGame()][typeParam][3];
+
+ if (isGameFeatureSupported("interiorScene")) {
+ if (isMainWorldScene(getPlayerData(client).scene)) {
+ getBusinessData(businessId).exitScene = getGameConfig().mainWorldScene[getGame()];
+ } else {
+ getBusinessData(businessId).exitScene = getGameConfig().interiors[getGame()][typeParam][3];
+ }
+ }
}
//deleteBusinessExitPickup(businessId);
@@ -1128,7 +1155,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`, true);
}
// ===========================================================================
@@ -1175,7 +1202,7 @@ function addBusinessPropertyTemplateEntities(command, params, client) {
getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
getBusinessData(businessId).hasInterior = true;
getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
- getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getGame()][typeParam][3];
+ getBusinessData(businessId).interiorScene = getGameConfig().interiors[getGame()][typeParam][3];
}
//deleteBusinessExitPickup(businessId);
@@ -1187,7 +1214,7 @@ function addBusinessPropertyTemplateEntities(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} property template to {ALTCOLOUR}${typeParam}`, true);
}
// ===========================================================================
@@ -1232,7 +1259,7 @@ function setBusinessBlipCommand(command, params, client) {
resetBusinessBlips(businessId);
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip to {ALTCOLOUR}${typeParam}`, true);
}
// ===========================================================================
@@ -1283,7 +1310,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) {
cacheBusinessItems(businessId);
updateBusinessPickupLabelData(businessId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${typeParam}`, true);
}
// ===========================================================================
@@ -1308,7 +1335,7 @@ function setBusinessDealershipCommand(command, params, client) {
getBusinessData(businessId).labelHelpType == AGRP_PROPLABEL_INFO_ENTERVEHICLE;
getBusinessData(businessId).type = AGRP_BIZ_TYPE_DEALERSHIP;
updateBusinessPickupLabelData(businessId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the business type of {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true);
}
// ===========================================================================
@@ -1337,7 +1364,7 @@ function deleteBusinessFloorItemsCommand(command, params, client) {
cacheBusinessItems(businessId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`, true);
}
// ===========================================================================
@@ -1366,7 +1393,7 @@ function deleteBusinessStorageItemsCommand(command, params, client) {
cacheBusinessItems(businessId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all storage items for business {businessBlue}${getBusinessData(businessId).name}`, true);
}
// ===========================================================================
@@ -1409,7 +1436,7 @@ function withdrawFromBusinessCommand(command, params, client) {
updatePlayerCash(client);
getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `You withdrew $${amount} from business {businessBlue}${getBusinessData(businessId).name} till`);
+ messagePlayerSuccess(client, `You withdrew ${getCurrencyString(amount)} from business {businessBlue}${getBusinessData(businessId).name} till`);
}
// ===========================================================================
@@ -1451,7 +1478,7 @@ function setBusinessBuyPriceCommand(command, params, client) {
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s {MAINCOLOUR}for-sale price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`);
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
}
// ===========================================================================
@@ -1486,7 +1513,7 @@ function depositIntoBusinessCommand(command, params, client) {
//}
if (getPlayerCurrentSubAccount(client).cash < amount) {
- messagePlayerError(client, `You don't have that much money! You only have $${getPlayerCurrentSubAccount(client).cash}`);
+ messagePlayerError(client, `You don't have that much money! You only have ${getCurrencyString(getPlayerCurrentSubAccount(client).cash)}`);
return false;
}
@@ -1495,7 +1522,7 @@ function depositIntoBusinessCommand(command, params, client) {
updatePlayerCash(client);
getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `You deposited $${amount} into business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}till`);
+ messagePlayerSuccess(client, `You deposited ${getCurrencyString(amount)} into business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till`);
}
// ===========================================================================
@@ -1524,17 +1551,17 @@ function orderItemForBusinessCommand(command, params, client) {
let itemType = getItemTypeFromParams(splitParams.slice(0, -2).join(" "));
if (!getItemTypeData(itemType)) {
- messagePlayerError(client, `Invalid item type name or ID!`);
- messagePlayerInfo(client, `Use {ALTCOLOUR}/itemtypes {MAINCOLOUR}for a list of items`);
+ messagePlayerError(client, getLocaleString(client, "InvalidItemType"));
+ messagePlayerInfo(client, `Use {ALTCOLOUR}/itemtypes{MAINCOLOUR} for a list of items`);
return false;
}
let pricePerItem = getOrderPriceForItemType(itemType);
let amount = toInteger(splitParams.slice(-2, -1)) || 1;
- let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
+ let value = getItemTypeData(itemType).orderValue;
let businessId = getPlayerBusiness(client);
- logToConsole(LOG_DEBUG, `[VRR.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
@@ -1552,11 +1579,10 @@ function orderItemForBusinessCommand(command, params, client) {
getPlayerData(client).businessOrderAmount = amount;
getPlayerData(client).businessOrderBusiness = businessId;
getPlayerData(client).businessOrderItem = itemType;
- getPlayerData(client).businessOrderValue = value;
getPlayerData(client).businessOrderCost = orderTotalCost;
getBusinessData(businessId).needsSaved = true;
- showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${makeLargeNumberReadable(pricePerItem)} each will cost a total of $${makeLargeNumberReadable(orderTotalCost)}`, "Business Order Cost");
+ showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} will cost a total of ${getCurrencyString(orderTotalCost)}`, "Business Order Cost");
getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
}
@@ -1574,13 +1600,13 @@ function orderItemForBusinessCommand(command, params, client) {
function orderItemForBusiness(businessId, itemType, amount) {
if (getBusinessData(businessId).till < orderTotalCost) {
let neededAmount = orderTotalCost - getBusinessData(businessId).till;
- //messagePlayerError(client, `The business doesn't have enough money (needs {ALTCOLOUR}$${neededAmount} {MAINCOLOUR}more)! Use {ALTCOLOUR}/bizdeposit {MAINCOLOUR}to add money to the business.`);
+ //messagePlayerError(client, `The business doesn't have enough money (needs {ALTCOLOUR}${getCurrencyString(neededAmount)} {MAINCOLOUR}more)! Use {ALTCOLOUR}/bizdeposit {MAINCOLOUR}to add money to the business.`);
return false;
}
getBusinessData(businessId).till -= orderTotalCost;
addToBusinessInventory(businessId, itemType, amount);
- //messagePlayerSuccess(client, `You ordered ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${getItemTypeData(itemType).orderPrice} each for business {businessBlue}${getBusinessData(businessId).name}`);
+ //messagePlayerSuccess(client, `You ordered ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at ${getCurrencyString(getItemTypeData(itemType).orderPrice)} each for business {businessBlue}${getBusinessData(businessId).name}`);
}
// ===========================================================================
@@ -1611,7 +1637,7 @@ function viewBusinessTillAmountCommand(command, params, client) {
return false;
}
- messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till has {ALTCOLOUR}$${getBusinessData(businessId).till}`);
+ messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till has {ALTCOLOUR}${getCurrencyString(getBusinessData(businessId).till)}`);
}
// ===========================================================================
@@ -1644,7 +1670,7 @@ function buyBusinessCommand(command, params, client) {
}
showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
- getPlayerData(client).promptType = AGRP_PROMPT_BIZBUY;
+ getPlayerData(client).promptType = AGRP_PROMPT_BUYBIZ;
}
// ===========================================================================
@@ -1684,7 +1710,7 @@ function moveBusinessEntranceCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`, true);
}
// ===========================================================================
@@ -1722,7 +1748,7 @@ function moveBusinessExitCommand(command, params, client) {
getBusinessData(businessId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}exit to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} exit to their position`, true);
}
// ===========================================================================
@@ -1874,7 +1900,7 @@ function saveBusinessToDatabase(businessId) {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Business]: Saving business '${tempBusinessData.name}' to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
@@ -1895,7 +1921,7 @@ function saveBusinessToDatabase(businessId) {
["biz_entrance_vw", tempBusinessData.entranceDimension],
["biz_entrance_pickup", tempBusinessData.entrancePickupModel],
["biz_entrance_blip", tempBusinessData.entranceBlipModel],
- //["biz_entrance_cutscene", tempBusinessData.entranceCutscene],
+ ["biz_entrance_scene", tempBusinessData.entranceScene],
["biz_exit_pos_x", tempBusinessData.exitPosition.x],
["biz_exit_pos_y", tempBusinessData.exitPosition.y],
["biz_exit_pos_z", tempBusinessData.exitPosition.z],
@@ -1904,11 +1930,11 @@ function saveBusinessToDatabase(businessId) {
["biz_exit_vw", tempBusinessData.exitDimension],
["biz_exit_pickup", tempBusinessData.exitPickupModel],
["biz_exit_blip", tempBusinessData.exitBlipModel],
- //["biz_exit_cutscene", tempBusinessData.exitCutscene],
+ ["biz_exit_scene", tempBusinessData.exitScene],
["biz_has_interior", boolToInt(tempBusinessData.hasInterior)],
["biz_interior_lights", boolToInt(tempBusinessData.interiorLights)],
["biz_label_help_type", tempBusinessData.labelHelpType],
- ["biz_radio_station", toInteger(tempBusinessData.streamingRadioStation)],
+ ["biz_radio_station", (getRadioStationData(tempBusinessData.streamingRadioStationIndex) != false) ? toInteger(getRadioStationData(tempBusinessData.streamingRadioStationIndex).databaseId) : -1],
["biz_custom_interior", boolToInt(tempBusinessData.customInterior)],
["biz_buy_price", tempBusinessData.buyPrice],
//["biz_rent_price", tempBusinessData.rentPrice],
@@ -1930,7 +1956,7 @@ function saveBusinessToDatabase(businessId) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Business]: Saved business '${tempBusinessData.name}' to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Business]: Saved business '${tempBusinessData.name}' to database!`);
return false;
}
@@ -1948,10 +1974,6 @@ function createAllBusinessPickups() {
return false;
}
- if (!isGameFeatureSupported("pickup")) {
- return false;
- }
-
for (let i in getServerData().businesses) {
createBusinessEntrancePickup(i);
createBusinessExitPickup(i);
@@ -1994,38 +2016,34 @@ function createAllBusinessBlips() {
*
*/
function createBusinessEntrancePickup(businessId) {
- if (!areServerElementsSupported()) {
- return false;
- }
-
if (!getServerConfig().createBusinessPickups) {
return false;
}
- if (!isGameFeatureSupported("pickup")) {
- return false;
- }
-
let businessData = getBusinessData(businessId);
//if(businessData.hasInterior) {
// return false;
//}
- if (businessData.entrancePickupModel == -1) {
- return false;
- }
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
- let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+ if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
+ let entrancePickup = null;
+ if (isGameFeatureSupported("pickup")) {
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
- if (businessData.entrancePickupModel != 0) {
- pickupModelId = businessData.entrancePickupModel;
- }
+ if (businessData.entrancePickupModel == -1) {
+ return false;
+ }
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${businessData.name} (model ${pickupModelId})`);
+ if (businessData.entrancePickupModel != 0) {
+ pickupModelId = businessData.entrancePickupModel;
+ }
+
+ entrancePickup = createGamePickup(pickupModelId, businessData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
+ }
- if (areServerElementsSupported()) {
- let entrancePickup = createGamePickup(pickupModelId, businessData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
if (entrancePickup != null) {
if (businessData.entranceDimension != -1) {
setElementDimension(entrancePickup, businessData.entranceDimension);
@@ -2044,15 +2062,10 @@ function createBusinessEntrancePickup(businessId) {
getBusinessData(businessId).entrancePickup = entrancePickup;
updateBusinessPickupLabelData(businessId);
}
- } else {
- let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
-
- if (businessData.entrancePickupModel != 0) {
- pickupModelId = businessData.entrancePickupModel;
- }
- sendBusinessToPlayer(null, businessId, businessData.name, businessData.entrancePosition, blipModelId, pickupModelId, businessData.hasInterior, doesBusinessHaveAnyItemsToBuy(businessId));
}
+ updateBusinessPickupLabelData(businessId);
+
return false;
}
@@ -2066,10 +2079,6 @@ function createBusinessEntrancePickup(businessId) {
*
*/
function createBusinessEntranceBlip(businessId) {
- if (!areServerElementsSupported()) {
- return false;
- }
-
if (!getServerConfig().createBusinessBlips) {
return false;
}
@@ -2094,9 +2103,9 @@ function createBusinessEntranceBlip(businessId) {
blipModelId = businessData.entranceBlipModel;
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
- if (areServerElementsSupported()) {
+ if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
if (entranceBlip != null) {
if (businessData.entranceDimension != -1) {
@@ -2136,10 +2145,6 @@ function createBusinessExitPickup(businessId) {
return false;
}
- if (!isGameFeatureSupported("pickup")) {
- return false;
- }
-
let businessData = getBusinessData(businessId);
//if(!businessData.hasInterior) {
@@ -2150,15 +2155,19 @@ function createBusinessExitPickup(businessId) {
return false;
}
- let pickupModelId = getGameConfig().pickupModels[getGame()].Exit;
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
- if (businessData.exitPickupModel != 0) {
- pickupModelId = businessData.exitPickupModel;
+ let exitPickup = null;
+ if (isGameFeatureSupported("pickup")) {
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Exit;
+
+ if (businessData.exitPickupModel != 0) {
+ pickupModelId = businessData.exitPickupModel;
+ }
+
+ exitPickup = createGamePickup(pickupModelId, businessData.exitPosition, getGameConfig().pickupTypes[getGame()].business);
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${businessData.name} (model ${pickupModelId})`);
-
- let exitPickup = createGamePickup(pickupModelId, businessData.exitPosition, getGameConfig().pickupTypes[getGame()].business);
if (exitPickup != null) {
if (businessData.exitDimension != -1) {
setElementDimension(exitPickup, businessData.exitDimension);
@@ -2177,6 +2186,7 @@ function createBusinessExitPickup(businessId) {
getBusinessData(businessId).exitPickup = exitPickup;
updateBusinessPickupLabelData(businessId);
}
+
}
// ===========================================================================
@@ -2217,7 +2227,7 @@ function createBusinessExitBlip(businessId) {
blipModelId = businessData.exitBlipModel;
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
if (exitBlip != null) {
@@ -2404,10 +2414,6 @@ function deleteBusinessEntrancePickup(businessId) {
return false;
}
- if (!isGameFeatureSupported("pickup")) {
- return false;
- }
-
if (getBusinessData(businessId).entrancePickup != null) {
//removeFromWorld(getBusinessData(businessId).entrancePickup);
deleteGameElement(getBusinessData(businessId).entrancePickup);
@@ -2431,10 +2437,6 @@ function deleteBusinessExitPickup(businessId) {
return false;
}
- if (!isGameFeatureSupported("pickup")) {
- return false;
- }
-
if (getBusinessData(businessId).exitPickup != null) {
//removeFromWorld(getBusinessData(businessId).exitPickup);
deleteGameElement(getBusinessData(businessId).exitPickup);
@@ -2670,12 +2672,16 @@ function buyFromBusinessCommand(command, params, client) {
//messagePlayerSuccess(client, `You bought ${amount} {ALTCOLOUR}${itemName} {MAINCOLOUR}for ${totalCost} ${priceEach}`);
meActionToNearbyPlayers(client, `buys a ${itemName}`);
- if (doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
- let keyData = getPlayerKeyBindForCommand("inv");
- messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryKeyPressTip", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
- } else {
- messagePlayerNewbieTip(client, getLocaleString(client, "ViewInventoryCommandTip", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
+ if (!hasPlayerSeenActionTip(client, "ViewInventory")) {
+ if (doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
+ let keyData = getPlayerKeyBindForCommand("inv");
+ messagePlayerActionTip(client, getGroupedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
+ } else {
+ messagePlayerActionTip(client, getGroupedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
+ }
}
+
+ markPlayerActionTipSeen(client, "ViewInventory");
}
// ===========================================================================
@@ -2718,7 +2724,7 @@ function setBusinessItemSellPriceCommand(command, params, client) {
getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).buyPrice = newPrice;
- messagePlayerSuccess(client, `You changed the price of the {ALTCOLOUR}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name}'s {MAINCOLOUR}in slot {ALTCOLOUR}${itemSlot} {MAINCOLOUR}from $${makeLargeNumberReadable(oldPrice)} to $${makeLargeNumberReadable(newprice)}`);
+ messagePlayerSuccess(client, `You changed the price of the {ALTCOLOUR}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name}'s {MAINCOLOUR}in slot {ALTCOLOUR}${itemSlot} {MAINCOLOUR}from ${getCurrencyString(oldPrice)} to ${getCurrencyString(newprice)}`);
}
// ===========================================================================
@@ -2827,11 +2833,11 @@ function getBusinessFloorFirstFreeItemSlot(businessId) {
// Caches all items for all businesses
function cacheAllBusinessItems() {
- logToConsole(LOG_DEBUG, "[VRR.Business] Caching all business items ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Business] Caching all business items ...");
for (let i in getServerData().businesses) {
cacheBusinessItems(i);
}
- logToConsole(LOG_DEBUG, "[VRR.Business] Cached all business items successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.Business] Cached all business items successfully!");
}
// ===========================================================================
@@ -2842,11 +2848,11 @@ function cacheBusinessItems(businessId) {
clearArray(getBusinessData(businessId).storageItemCache);
//let businessData = getBusinessData(businessId);
- //logToConsole(LOG_VERBOSE, `[VRR.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
+ //logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == AGRP_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
- logToConsole(LOG_VERBOSE, `[VRR.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
for (let i in getServerData().items) {
if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
getBusinessData(businessId).floorItemCache.push(i);
@@ -2855,7 +2861,7 @@ function cacheBusinessItems(businessId) {
}
}
- logToConsole(LOG_VERBOSE, `[VRR.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
}
// ===========================================================================
@@ -2869,7 +2875,8 @@ function getBusinessIdFromDatabaseId(databaseId) {
// Updates all pickup data for a business by businessId
function updateBusinessPickupLabelData(businessId) {
- if (!areServerElementsSupported()) {
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
+ sendBusinessToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), getBusinessData(businessId).buyPrice, getBusinessData(businessId).rentPrice, getBusinessData(businessId).hasInterior, getBusinessData(businessId).locked, doesBusinessHaveAnyItemsToBuy(businessId));
return false;
}
@@ -3202,4 +3209,34 @@ function doesBusinessHaveBuyableItemOfUseType(businessId, useType) {
return false;
}
+// ===========================================================================
+
+function getBusinessEntranceBlipModelForNetworkEvent(businessIndex) {
+ let blipModelId = -1;
+ if (isGameFeatureSupported("blip")) {
+ blipModelId = getGameConfig().blipSprites[getGame()].Business;
+
+ if (getBusinessData(businessIndex).entranceBlipModel != 0) {
+ blipModelId = getBusinessData(businessIndex).entranceBlipModel;
+ }
+ }
+
+ return blipModelId;
+}
+
+// ===========================================================================
+
+function getBusinessEntrancePickupModelForNetworkEvent(businessIndex) {
+ let pickupModelId = -1;
+ if (isGameFeatureSupported("pickup")) {
+ pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+
+ if (getBusinessData(businessIndex).entrancePickupModel != 0) {
+ pickupModelId = getBusinessData(businessIndex).entrancePickupModel;
+ }
+ }
+
+ return pickupModelId;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/casino.js b/scripts/server/casino.js
index 0a0299c4..bddcaadf 100644
--- a/scripts/server/casino.js
+++ b/scripts/server/casino.js
@@ -118,20 +118,7 @@ function blackJackHitCommand(command, params, client) {
hand.push(deck.pop());
- let tempHandValue = 0;
-
- for (let i in hand) {
- if (hand[i].value == 1) {
-
- if ((tempHandValue + 11) > 21) {
- tempHandValue += 1;
- } else {
- tempHandValue += 11;
- }
- } else {
- tempHandValue += hand[i].value;
- }
- }
+ let tempHandValue = getValueOfBlackJackHand(hand);
if (handValue > 21) {
playerBustBlackJack(client);
@@ -155,14 +142,6 @@ function blackJackStandCommand(command, params, client) {
// ===========================================================================
-function blackJackHit(hand, deck) {
-
-
- return handValue;
-}
-
-// ===========================================================================
-
function dealPlayerBlackJackHand(deck, players) {
// Alternate handing cards to each player, 2 cards each
for (var i = 0; i < 2; i++) {
@@ -174,4 +153,23 @@ function dealPlayerBlackJackHand(deck, players) {
}
}
+// ===========================================================================
+
+function calculateValueOfBlackJackHand(hand) {
+ let tempHandValue = 0;
+
+ for (let i in hand) {
+ if (hand[i].value == 1) {
+
+ if ((tempHandValue + 11) > 21) {
+ tempHandValue += 1;
+ } else {
+ tempHandValue += 11;
+ }
+ } else {
+ tempHandValue += hand[i].value;
+ }
+ }
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index c2cc5673..f8381793 100644
--- a/scripts/server/chat.js
+++ b/scripts/server/chat.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initChatScript() {
- logToConsole(LOG_INFO, "[VRR.Chat]: Initializing chat script ...");
- logToConsole(LOG_INFO, "[VRR.Chat]: Chat script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Chat]: Initializing chat script ...");
+ logToConsole(LOG_INFO, "[AGRP.Chat]: Chat script initialized successfully!");
return true;
}
@@ -174,7 +174,14 @@ function adminChatCommand(command, params, client) {
return false;
}
- messageAdmins(`{jobYellow}[Admin Chat] {ALTCOLOUR}${getPlayerName(client)}: ${params}`);
+ let clients = getClients();
+ for (let i in clients) {
+ if (doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
+ messagePlayerAdminChat(clients[i], client, params);
+ }
+ }
+
+ messageDiscordAdminChannel(`${getPlayerData(client).accountData.staffTitle} ${getPlayerData(client).accountData.name}: ${messageText}`);
}
// ===========================================================================
@@ -217,7 +224,10 @@ function privateMessageCommand(command, params, client) {
getPlayerData(targetClient).privateMessageReplyTo = client;
messagePlayerPrivateMessage(targetClient, client, messageText);
- messagePlayerTip(client, getLocaleString(client, "PrivateMessageReplyCommandTip", "{ALTCOLOUR}/reply{MAINCOLOUR}"))
+
+ if (hasPlayerSeenActionTip(targetClient, "ReplyToDirectMessage")) {
+ messagePlayerTip(targetClient, getGroupedLocaleString(targetClient, "ActionTips", "ReplyToDirectMessage", "{ALTCOLOUR}/reply{MAINCOLOUR}"));
+ }
}
// ===========================================================================
@@ -240,6 +250,8 @@ function replyToLastPrivateMessageCommand(command, params, client) {
getPlayerData(targetClient).privateMessageReplyTo = client;
messagePlayerPrivateMessage(targetClient, client, messageText);
+
+ markPlayerActionTipSeen(client, "ReplyToDirectMessage");
}
// ===========================================================================
diff --git a/scripts/server/clan.js b/scripts/server/clan.js
index 618dc971..7b35c88e 100644
--- a/scripts/server/clan.js
+++ b/scripts/server/clan.js
@@ -110,15 +110,15 @@ class ClanMemberData {
// ===========================================================================
function initClanScript() {
- logToConsole(LOG_INFO, "[VRR.Clan]: Initializing clans script ...");
- logToConsole(LOG_INFO, "[VRR.Clan]: Clan script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Clan]: Initializing clans script ...");
+ logToConsole(LOG_INFO, "[AGRP.Clan]: Clan script initialized successfully!");
return true;
}
// ===========================================================================
function loadClansFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Clan]: Loading clans from database ...");
+ logToConsole(LOG_INFO, "[AGRP.Clan]: Loading clans from database ...");
let tempClans = [];
let dbConnection = connectToDatabase();
@@ -133,7 +133,7 @@ function loadClansFromDatabase() {
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
tempClans.push(tempClanData);
- logToConsole(LOG_DEBUG, `[VRR.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -141,14 +141,14 @@ function loadClansFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Clan]: ${tempClans.length} clans loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
return tempClans;
}
// ===========================================================================
function loadClanMembersFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Clan]: Loading clans from database ...");
+ logToConsole(LOG_INFO, "[AGRP.Clan]: Loading clans from database ...");
let tempClans = [];
let dbConnection = connectToDatabase();
@@ -161,7 +161,7 @@ function loadClanMembersFromDatabase() {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempClanData = new ClanData(dbAssoc);
tempClans.push(tempClanData);
- logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -169,14 +169,14 @@ function loadClanMembersFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Clan]: ${tempClans.length} clans loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
return tempClans;
}
// ===========================================================================
function loadClanRanksFromDatabase(clanDatabaseId) {
- logToConsole(LOG_INFO, `[VRR.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
+ logToConsole(LOG_INFO, `[AGRP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
let dbConnection = connectToDatabase();
let dbAssoc;
@@ -189,7 +189,7 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempClanRankData = new ClanRankData(dbAssoc);
tempClanRanks.push(tempClanRankData);
- logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -197,7 +197,7 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
return tempClanRanks;
}
@@ -1292,10 +1292,10 @@ function setClanRankTitle(clanId, rankId, title) {
// ===========================================================================
function saveAllClansToDatabase() {
- logToConsole(LOG_DEBUG, `[VRR.Clan]: Saving all server clans to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Clan]: Saving all server clans to database ...`);
if (getServerConfig().devServer) {
- logToConsole(LOG_DEBUG, `[VRR.Clan]: Aborting save all clans to database, dev server is enabled.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Clan]: Aborting save all clans to database, dev server is enabled.`);
return false;
}
@@ -1303,7 +1303,7 @@ function saveAllClansToDatabase() {
saveClanToDatabase(i);
}
- logToConsole(LOG_INFO, `[VRR.Clan]: Saved all server clans to database`);
+ logToConsole(LOG_INFO, `[AGRP.Clan]: Saved all server clans to database`);
}
// ===========================================================================
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 9037c59c..d8b20f8b 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -17,13 +17,12 @@ const AGRP_RETURNTO_TYPE_SKINSELECT = 2; // "Return to" data is from sk
/**
* @class Representing extra data for a client
+ * @property {AccountData} accountData
+ * @property {Array.} subAccounts
*/
class ClientData {
constructor(client, accountData, subAccounts) {
- /** @member {AccountData} accountData */
this.accountData = accountData;
-
- /** @member {Array.} subAccounts */
this.subAccounts = subAccounts; // Characters
// General Info
@@ -126,12 +125,14 @@ class ClientData {
this.locale = 0;
this.enteringVehicle = null;
this.customDisconnectReason = "";
- this.interiorCutscene = -1;
+ this.scene = "";
this.playerBlip = null;
this.alcoholLevel = 0;
this.pedState = AGRP_PEDSTATE_NONE;
this.promptType = AGRP_PROMPT_NONE;
this.privateMessageReplyTo = null;
+ this.enteringExitingProperty = null;
+ this.inProperty = null;
// Paintball
this.inPaintBall = false;
@@ -155,14 +156,14 @@ class ClientData {
// ===========================================================================
function initClientScript() {
- logToConsole(LOG_DEBUG, "[VRR.Client]: Initializing client script ...");
- logToConsole(LOG_DEBUG, "[VRR.Client]: Client script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Client]: Initializing client script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Client]: Client script initialized!");
}
// ===========================================================================
function resetClientStuff(client) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
if (!getPlayerData(client)) {
return false;
@@ -172,24 +173,128 @@ function resetClientStuff(client) {
stopJobRoute(client, false, false);
}
+ if (isPlayerWorking(client)) {
+ stopWorking(client);
+ }
+
if (getPlayerData(client).rentingVehicle) {
stopRentingVehicle(client);
}
+ if (isPlayerInPaintBall(client)) {
+ stopPaintBall(client);
+ }
+
+ //if (isPlayerFishing(client)) {
+ // stopFishing(client);
+ //}
+
deleteJobItems(client);
deletePaintBallItems(client);
//deletePlayerTemporaryLockerItems(client);
- getPlayerData(client).lastVehicle = null;
+ //getPlayerData(client).lastVehicle = null;
}
// ===========================================================================
function kickAllClients() {
getClients().forEach((client) => {
- getPlayerData(client).customDisconnectReason = `Kicked - All clients are being disconnected`;
+ getPlayerData(client).customDisconnectReason = "ServerRestarting";
disconnectPlayer(client);
})
}
+// ===========================================================================
+
+function initClient(client) {
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
+
+ if (isConsole(client)) {
+ logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
+ return false;
+ }
+
+ if (playerInitialized[client.index] == true) {
+ logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
+ return false;
+ }
+
+ playerInitialized[client.index] = true;
+
+ //setEntityData(client, "agrp.isInitialized", true, false);
+
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
+ sendPlayerCurrencyString(client);
+ sendPlayerGUIColours(client);
+ sendPlayerGUIInit(client);
+ updatePlayerSnowState(client);
+
+ //logToConsole(LOG_DEBUG, `[AGRP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
+ //showConnectCameraToPlayer(client);
+
+ messageClient(`Please wait ...`, client, getColourByName("softGreen"));
+
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
+ setTimeout(function () {
+ if (client != null) {
+ clearChatBox(client);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
+ let tempAccountData = loadAccountFromName(getPlayerName(client), true);
+
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
+ let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
+
+ getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
+
+ getServerData().clients[getPlayerId(client)].sessionId = saveConnectionToDatabase(client);
+ getServerData().clients[getPlayerId(client)].connectTime = getCurrentUnixTimestamp();
+ requestClientInfo(client);
+
+ if (tempAccountData != false) {
+ sendPlayerLocaleId(client, getPlayerData(client).accountData.locale);
+ if (isAccountAutoIPLoginEnabled(tempAccountData) && getPlayerData(client).accountData.ipAddress == getPlayerIP(client)) {
+ messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
+ loginSuccess(client);
+ playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
+ } else {
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
+ showPlayerLoginGUI(client);
+ } else {
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
+ messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
+
+ if (checkForGeoIPModule()) {
+ let iso = module.geoip.getCountryISO(getGlobalConfig().geoIPCountryDatabaseFilePath, getPlayerIP(client));
+ let localeId = getLocaleFromCountryISO(iso);
+
+ if (localeId != 0) {
+ if (getLocaleData(localeId).enabled) {
+ messagePlayerTip(client, getLanguageLocaleString(localeId, "LocaleOffer", `/lang ${getLocaleData(localeId).isoCode}`), getColourByName("white"), 10000, "Roboto");
+ }
+ }
+ }
+ }
+ startLoginTimeoutForPlayer(client);
+ playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
+ }
+ } else {
+ sendPlayerLocaleId(client, 0);
+ if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
+ showPlayerRegistrationGUI(client);
+ } else {
+ logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
+ messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
+ }
+ playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
+ }
+
+ getServerData().clients[getPlayerId(client)].keyBinds = loadAccountKeybindsFromDatabase(getServerData().clients[getPlayerId(client)].accountData.databaseId);
+ sendAccountKeyBindsToClient(client);
+ }
+ }, 2500);
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/command.js b/scripts/server/command.js
index a9d9a784..d5342c76 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -44,8 +44,8 @@ let serverCommands = [];
// ===========================================================================
function initCommandScript() {
- logToConsole(LOG_INFO, "[VRR.Command]: Initializing commands script ...");
- logToConsole(LOG_INFO, "[VRR.Command]: Initialized commands script!");
+ logToConsole(LOG_INFO, "[AGRP.Command]: Initializing commands script ...");
+ logToConsole(LOG_INFO, "[AGRP.Command]: Initialized commands script!");
}
// ===========================================================================
@@ -353,6 +353,7 @@ function loadCommands() {
new CommandData("itemtypeorderprice", setItemTypeOrderPriceCommand, "- ", getStaffFlagValue("ManageItems"), true, false, "Sets an item type's order price (base price when ordering for a business"),
new CommandData("itemtyperiskmult", setItemTypeRiskMultiplierCommand, "
- ", getStaffFlagValue("ManageItems"), true, false, "Sets an item type's risk multiplayer (higher value for more dangerous or rare illegal items)"),
new CommandData("itemtypeenabled", toggleItemTypeEnabledCommand, "
- ", getStaffFlagValue("ManageItems"), true, false, "Toggles an item type on or off (if off, any items with that type can't be interacted with)"),
+ new CommandData("itemtypedropmodel", setItemTypeDropModelCommand, "
-