GrOxFc;)zEcvBw)(U>qv`(n%rK|fCfw7XXU7P!v=7P?;s9Leu1
z8E#^@6VQT~hXL~t(<1U27P|MqKZgBd89Ep`88&n1ZsczfE$rXJ{&vo-129Es+~t5;
zhSB`S#L$BHDWZm9yL$@!9e^2-CEo)``DchmhRqCH7`6gh5oZ-3)ys;~63j;`D{A*B
zpp*TS)`~sm6u{l?I{{nRzlZ&lk48nJU8ew{s~=;d24AuB
zckQSP`J>%i0Zj}oXg9kU$nOU;EMqtfx!J`?_E(}*b}^d$RltHB`Wq+*C&L=fVIzlb
zV%W&AiQ!I$&79kAhAj;DFl^<}{S4drD;0a$=`JBL|C
z<6Z|y_$@@vks)wG@ht?BB$&k>BiOKh>*{%Tvhp
zD&+DMidK%(j`k@;?N(uSqw*9nbrm7>9Og9*LoLHG$Y%&GtsPt!2i~7U9SBnn#*~9w#=)3!aLYJ2e+Mvi
z3UN9Bot)OmX`P&>lT$f4XD6p}GG?8Ke-3jyjTkjNV$|@6QG-6X2XAP^s1Y<`)PT+j
zQje}df22?vF=}|ks1Y<`)L@QH1f&sT6SvPMZkbKoGL1ZrHFAG%1Z5>+9xoC@0jb3r
z8B>kiN{!q~O&q_8<2P}6n$Tv6sE-BXL$gSCtpc?3n>>d3G*Tcp>KmSz4&>jA_8?fp
zsaBz%HsdQ4=Kx>}=hnixwQz3K2NLm~a%i9xgGDf0_LH$+ZiwI9H$+5
zCgROle(zvN6yA=t)KIiOrS0If9h|m<({^y$4o=&_X*+<^J%~wZJ2-6@kBwbio-Q7f
zyLe3QLfS{M3ZgN&i~CU*kI7v;CU^0e+yxrA6QR_DcovhCSWEg~y-8j2U70r9;LJ?L
I^
Date: Tue, 20 Sep 2022 02:22:34 -0500
Subject: [PATCH 063/311] Update meta.xml
---
meta.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta.xml b/meta.xml
index 33f9142e..6d97cdbd 100644
--- a/meta.xml
+++ b/meta.xml
@@ -55,6 +55,7 @@
+
@@ -85,6 +86,7 @@
+
From a93d07982ce84a45f360ae4f3aa85a6bea86e2bc Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:22:48 -0500
Subject: [PATCH 064/311] Add squirrel thread stuff
---
scripts/server/thread.nut | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 scripts/server/thread.nut
diff --git a/scripts/server/thread.nut b/scripts/server/thread.nut
new file mode 100644
index 00000000..1fe092a6
--- /dev/null
+++ b/scripts/server/thread.nut
@@ -0,0 +1,25 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: thread.nut
+// DESC: Provides threaded functions (used in Squirrel since JavaScript thread hacks don't work)
+// TYPE: Server (Squirrel)
+// ===========================================================================
+
+bindEventHandler("OnResourceStart", thisResource, function(event, resource) {
+ emailThread <- newthread("sendEmail");
+
+ exportFunction("sendEmailSquirrel", function(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
+ emailThread.call(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName);
+ });
+});
+
+// ===========================================================================
+
+function sendEmailSquirrel(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
+ module.smtp.send(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName);
+}
+
+// ===========================================================================
\ No newline at end of file
From e27423e72b1c4e2488faaf639ef796fe60bc30c4 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:23:17 -0500
Subject: [PATCH 065/311] Start working on consolidating biz/house into single
property
---
scripts/server/property.js | 2641 ++++++++++++++++++++++++++++++++++++
1 file changed, 2641 insertions(+)
create mode 100644 scripts/server/property.js
diff --git a/scripts/server/property.js b/scripts/server/property.js
new file mode 100644
index 00000000..cd551974
--- /dev/null
+++ b/scripts/server/property.js
@@ -0,0 +1,2641 @@
+// ===========================================================================
+// Asshat Gaming Roleplay
+// https://github.com/VortrexFTW/agrp_main
+// (c) 2022 Asshat Gaming
+// ===========================================================================
+// FILE: property.js
+// DESC: Provides property (house, business, etc) with functions and usage
+// TYPE: Server (JavaScript)
+// ===========================================================================
+
+// Property Types
+const AGRP_PROP_TYPE_NONE = 0; // None (invalid)
+const AGRP_PROP_TYPE_BIZ_NORMAL = 1; // Normal business (sells items)
+const AGRP_PROP_TYPE_BIZ_BANK = 2; // Bank business
+const AGRP_PROP_TYPE_BIZ_PUBLIC = 3; // Public business (Government, public service, etc)
+const AGRP_PROP_TYPE_BIZ_PAINTBALL = 4; // Paintball arena. Player joins paintball/airsoft when they enter
+const AGRP_PROP_TYPE_BIZ_DEALERSHIP = 5; // Vehicle Dealership (also for airplane, boat, etc)
+const AGRP_PROP_TYPE_HOUSE = 6; // House
+
+// ===========================================================================
+
+// Business Location Types
+const AGRP_PROP_LOC_NONE = 0; // None
+const AGRP_PROP_LOC_GATE = 1; // Moveable gate that belongs to the property
+const AGRP_PROP_LOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
+const AGRP_PROP_LOC_FUEL = 3; // Fuel pump
+const AGRP_PROP_LOC_DRIVETHRU = 4; // Drivethrough
+const AGRP_PROP_LOC_VENDMACHINE = 5; // Vending machine
+const AGRP_PROP_LOC_ATM = 6; // ATM
+const AGRP_PROP_LOC_PAYPHONE = 7; // Payphone
+
+// ===========================================================================
+
+// Business Owner Types
+const AGRP_PROP_OWNER_NONE = 0; // Not owned
+const AGRP_PROP_OWNER_PLAYER = 1; // Owned by a player (character/subaccount)
+const AGRP_PROP_OWNER_JOB = 2; // Owned by a job
+const AGRP_PROP_OWNER_CLAN = 3; // Owned by a clan
+const AGRP_PROP_OWNER_FACTION = 4; // Owned by a faction (not used at the moment)
+const AGRP_PROP_OWNER_PUBLIC = 5; // Public property. Used for goverment/official places like police, fire, city hall, DMV, etc
+
+// ===========================================================================
+
+/**
+ * @class Representing a property's data. Loaded and saved in the database
+ * @property {Array.} locations
+ */
+class PropertyData {
+ constructor(dbAssoc = false) {
+ this.databaseId = 0;
+ this.name = "";
+ this.ownerType = AGRP_PROP_OWNER_NONE;
+ this.ownerId = 0;
+ this.buyPrice = 0;
+ this.locked = false;
+ this.hasInterior = false;
+ this.index = -1;
+ this.needsSaved = false;
+ this.interiorLights = true;
+ this.propertyType = AGRP_PROP_TYPE_NONE;
+
+ this.entrancePosition = false;
+ this.entranceRotation = 0.0;
+ this.entranceInterior = 0;
+ this.entranceDimension = 0;
+ this.entrancePickupModel = -1;
+ this.entranceBlipModel = -1;
+ this.entrancePickup = null;
+ this.entranceBlip = null;
+ this.entranceScene = "";
+
+ this.exitPosition = false;
+ this.exitRotation = 0.0;
+ this.exitInterior = 0;
+ this.exitDimension = 0;
+ this.exitPickupModel = -1;
+ this.exitBlipModel = -1;
+ this.exitPickup = null;
+ this.exitBlip = null;
+ this.exitScene = "";
+
+ this.streamingRadioStation = 0;
+ this.streamingRadioStationIndex = -1;
+
+ this.labelHelpType = AGRP_PROPLABEL_INFO_NONE;
+
+ if (dbAssoc) {
+ this.databaseId = toInteger(dbAssoc["prop_id"]);
+ this.name = toString(dbAssoc["prop_name"]);
+ this.ownerType = toInteger(dbAssoc["prop_owner_type"]);
+ this.ownerId = toInteger(dbAssoc["prop_owner_id"]);
+ this.buyPrice = toInteger(dbAssoc["prop_buy_price"]);
+ this.locked = intToBool(toInteger(dbAssoc["prop_locked"]));
+ this.hasInterior = intToBool(toInteger(dbAssoc["prop_has_interior"]));
+ this.interiorLights = intToBool(toInteger(dbAssoc["prop_interior_lights"]));
+ this.type = toInteger(dbAssoc["prop_type"]);
+
+ this.entrancePosition = toVector3(toFloat(dbAssoc["prop_entrance_pos_x"]), toFloat(dbAssoc["prop_entrance_pos_y"]), toFloat(dbAssoc["prop_entrance_pos_z"]));
+ this.entranceRotation = toInteger(dbAssoc["prop_entrance_rot_z"]);
+ this.entranceInterior = toInteger(dbAssoc["prop_entrance_int"]);
+ this.entranceDimension = toInteger(dbAssoc["prop_entrance_vw"]);
+ this.entrancePickupModel = toInteger(dbAssoc["prop_entrance_pickup"]);
+ this.entranceBlipModel = toInteger(dbAssoc["prop_entrance_blip"]);
+ this.entranceScene = toString(dbAssoc["prop_entrance_scene"]);
+
+ this.exitPosition = toVector3(dbAssoc["prop_exit_pos_x"], dbAssoc["prop_exit_pos_y"], dbAssoc["prop_exit_pos_z"]);
+ this.exitRotation = toInteger(dbAssoc["prop_exit_rot_z"]);
+ this.exitInterior = toInteger(dbAssoc["prop_exit_int"]);
+ this.exitDimension = toInteger(dbAssoc["prop_exit_vw"]);
+ this.exitPickupModel = toInteger(dbAssoc["prop_exit_pickup"]);
+ this.exitBlipModel = toInteger(dbAssoc["prop_exit_blip"]);
+ this.exitScene = toString(dbAssoc["prop_exit_scene"]);
+
+ this.labelHelpType = toInteger(dbAssoc["prop_label_help_type"]);
+ this.streamingRadioStation = toInteger(dbAssoc["prop_radio_station"]);
+ }
+ };
+};
+
+/**
+ * @class Representing a property's location data. Multiple can be used for a single property. Used for things like doors, fuel pumps, drive thru positions, etc. Loaded and saved in the database
+ */
+class PropertyLocationData {
+ constructor(dbAssoc = false) {
+ this.databaseId = 0;
+ this.name = "";
+ this.type = 0;
+ this.propertyIndex = 0;
+ this.propertyId = 0;
+ this.enabled = false;
+ this.index = -1;
+ this.needsSaved = false;
+
+ this.position = toVector3(0.0, 0.0, 0.0);
+ this.interior = 0;
+ this.dimension = 0;
+
+ if (dbAssoc) {
+ this.databaseId = toInteger(dbAssoc["prop_loc_id"]);
+ this.name = toString(dbAssoc["prop_loc_name"]);
+ this.type = toInteger(dbAssoc["prop_loc_type"]);
+ this.business = toInteger(dbAssoc["prop_loc_biz"]);
+ this.enabled = intToBool(toInteger(dbAssoc["prop_loc_enabled"]));
+
+ this.position = toVector3(toFloat(dbAssoc["prop_loc_pos_x"]), toFloat(dbAssoc["prop_loc_pos_y"]), toFloat(dbAssoc["prop_loc_pos_z"]));
+ this.interior = toInteger(dbAssoc["prop_loc_int"]);
+ this.dimension = toInteger(dbAssoc["prop_loc_vw"]);
+ }
+ }
+};
+
+// ===========================================================================
+
+function initPropertyScript() {
+ logToConsole(LOG_INFO, "[AGRP.Property]: Initializing property script ...");
+ logToConsole(LOG_INFO, "[AGRP.Property]: Property script initialized successfully!");
+ return true;
+}
+
+// ===========================================================================
+
+function loadPropertyFromId(propertyIndex) {
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let dbQueryString = `SELECT * FROM prop_main WHERE prop_id = ${businessId} LIMIT 1;`;
+ let dbQuery = queryDatabase(dbConnection, dbQueryString);
+ if (dbQuery) {
+ let dbAssoc = fetchQueryAssoc(dbQuery);
+ freeDatabaseQuery(dbQuery);
+ return new PropertyData(dbAssoc);
+ }
+ disconnectFromDatabase(dbConnection);
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function loadPropertiesFromDatabase() {
+ logToConsole(LOG_INFO, "[AGRP.Property]: Loading properties from database ...");
+
+ let tempProperties = [];
+ let dbConnection = connectToDatabase();
+ let dbQuery = null;
+ let dbAssoc;
+
+ if (dbConnection) {
+ dbQuery = queryDatabase(dbConnection, `SELECT * FROM prop_main WHERE prop_deleted = 0 AND prop_server = ${getServerId()}`);
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
+ let tempPropertyData = new PropertyData(dbAssoc);
+ tempPropertyData.locations = loadBusinessLocationsFromDatabase(tempPropertyData.databaseId);
+ tempProperties.push(tempPropertyData);
+ logToConsole(LOG_VERBOSE, `[AGRP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
+ }
+ }
+ freeDatabaseQuery(dbQuery);
+ }
+ disconnectFromDatabase(dbConnection);
+ }
+
+ logToConsole(LOG_INFO, `[AGRP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
+ return tempProperties;
+}
+
+// ===========================================================================
+
+function loadPropertyLocationsFromDatabase(propertyIndex) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
+
+ let tempPropertyLocations = [];
+ let dbConnection = connectToDatabase();
+ let dbQuery = null;
+ let dbAssoc;
+ let dbQueryString = "";
+
+ if (dbConnection) {
+ dbQueryString = `SELECT * FROM prop_loc WHERE prop_loc_prop = ${propertyIndex}`;
+ dbQuery = queryDatabase(dbConnection, dbQueryString);
+ if (dbQuery) {
+ if (dbQuery.numRows > 0) {
+ while (dbAssoc = fetchQueryAssoc(dbQuery)) {
+ let tempPropertyLocationData = new PropertyLocationData(dbAssoc);
+ tempPropertyLocations.push(tempPropertyLocationData);
+ logToConsole(LOG_VERBOSE, `[AGRP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
+ }
+ }
+ freeDatabaseQuery(dbQuery);
+ }
+ disconnectFromDatabase(dbConnection);
+ }
+
+ logToConsole(LOG_VERBOSE, `[AGRP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
+ return tempPropertyLocations;
+}
+
+// ===========================================================================
+
+function createPropertyCommand(command, params, client) {
+ createProperty(
+ params,
+ getPlayerPosition(client),
+ toVector3(0.0, 0.0, 0.0),
+ (isGameFeatureSupported("pickups")) ? getGameConfig().pickupModels[getGame()].Business : -1,
+ -1,
+ getPlayerInterior(client),
+ getPlayerDimension(client),
+ getPlayerData(client).interiorScene);
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`);
+}
+
+// ===========================================================================
+
+function createBusinessLocationCommand(command, params, client) {
+ if (!isPlayerSpawned(client)) {
+ messagePlayerError(client, "You must be spawned to use this command!");
+ return false;
+ }
+
+ let locationType = toString(getParam(params, " ", 1));
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ 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}`);
+}
+
+// ===========================================================================
+
+/*
+function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1) {
+ let tempBusinessData = new BusinessData(false);
+ tempBusinessData.name = name;
+
+ tempBusinessData.entrancePosition = entrancePosition;
+ tempBusinessData.entranceRotation = 0.0;
+ tempBusinessData.entrancePickupModel = entrancePickupModel;
+ tempBusinessData.entranceBlipModel = entranceBlipModel;
+ tempBusinessData.entranceInterior = entranceInterior;
+ tempBusinessData.entranceDimension = entranceDimension;
+ tempBusinessData.entranceScene = entranceScene;
+
+ tempBusinessData.exitPosition = exitPosition;
+ tempBusinessData.exitRotation = 0.0;
+ tempBusinessData.exitPickupModel = 0;
+ tempBusinessData.exitBlipModel = -1;
+ tempBusinessData.exitInterior = 0;
+ tempBusinessData.exitDimension = 0;
+ tempBusinessData.exitScene = -1;
+
+ tempBusinessData.needsSaved = true;
+ let businessId = getServerData().businesses.push(tempBusinessData);
+ setBusinessDataIndexes();
+ saveAllBusinessesToDatabase();
+
+ createBusinessPickups(businessId - 1);
+ createBusinessBlips(businessId - 1);
+
+ return tempBusinessData;
+}
+
+// ===========================================================================
+
+function deleteBusinessCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ deleteBusiness(businessId, getPlayerData(client).accountData.databaseId);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`);
+}
+
+// ===========================================================================
+
+function deleteBusinessLocationCommand(command, params, client) {
+ //let businessId = toInteger(getParam(params, " ", 2));
+ //deleteBusinessLocation(businessId);
+ //messagePlayerSuccess(client, `Business '${tempBusinessData.name} deleted!`);
+}
+
+// ===========================================================================
+
+function setBusinessNameCommand(command, params, client) {
+ let newBusinessName = toString(params);
+
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ let oldBusinessName = getBusinessData(businessId).name;
+ 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}`);
+}
+
+// ===========================================================================
+
+function setBusinessOwnerCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let newBusinessOwner = getPlayerFromParams(params);
+ let businessId = getPlayerBusiness(client);
+
+ if (!newBusinessOwner) {
+ messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
+ return false;
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_PLAYER;
+ getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
+ getBusinessData(businessId).needsSaved = true;
+
+ messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to {ALTCOLOUR}${getCharacterFullName(newBusinessOwner)}`);
+}
+
+// ===========================================================================
+
+function setBusinessJobCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let jobId = getJobFromParams(params);
+ let businessId = getPlayerBusiness(client);
+
+ if (!getJobData(jobId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidJob"));
+ return false;
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_JOB;
+ 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}`);
+}
+
+// ===========================================================================
+
+function setBusinessClanCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let clanId = getPlayerClan(client);
+
+ if (!getClanData(clanId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidClan"));
+ return false;
+ }
+
+ if (getBusinessData(business).ownerType != AGRP_VEHOWNER_PLAYER) {
+ messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
+ return false;
+ }
+
+ if (getBusinessData(business).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
+ messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
+ return false;
+ }
+
+ showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ getPlayerData(client).promptType = AGRP_PROMPT_BIZGIVETOCLAN;
+
+ //getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_CLAN;
+ //getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
+ //getBusinessData(businessId).needsSaved = true;
+}
+
+// ===========================================================================
+
+function setBusinessRankCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let rankId = params;
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_CLAN) {
+ let clanId = getClanIndexFromDatabaseId(getBusinessData(businessId).ownerId);
+ rankId = getClanRankFromParams(clanId, params);
+ if (!getClanRankData(clanId, rankId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidClanRank"));
+ return false;
+ }
+ getBusinessData(businessId).rank = getClanRankData(clanId, rankId).databaseId;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${getClanRankData(clanId, rankId).name} {MAINCOLOUR}of the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`);
+ } else if (getBusinessData(businessId).ownerType == AGRP_VEHOWNER_JOB) {
+ getBusinessData(businessId).rank = rankId;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${rankId} {MAINCOLOUR}of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getBusinessData(businessId).ownerId)).name} {MAINCOLOUR}job!`);
+ }
+
+ getBusinessData(businessId).needsSaved = true;
+}
+
+// ===========================================================================
+
+function setBusinessRankCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let clanId = getPlayerClan(client);
+
+ if (!getClanData(clanId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidClan"));
+ return false;
+ }
+
+ let clanRankId = getClanRankFromParams(clanId, params);
+
+ if (!getClanRankData(clanId, clanRankId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidClanRank"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ if (getClanRankData(clanId, clanRankId).level > getPlayerCurrentSubAccount(client).clanRank) {
+ messagePlayerError(client, "That rank is above your level!");
+ return false;
+ }
+
+ getBusinessData(businessId).clanRank = getClanRankData(clanId, clanRankId).level;
+
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}'s clan rank to {clanOrange}${getClanRankData(clanId, clanRankId).name} {MAINCOLOUR}(level ${getClanRankData(clanId, clanRankId).level}) and above!`);
+}
+
+// ===========================================================================
+
+function setBusinessJobCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle));
+ let jobId = closestJobLocation.job;
+
+ if (!areParamsEmpty(params)) {
+ jobId = getJobIdFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!getJobData(jobId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidJob"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_JOB;
+ getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
+
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
+}
+
+// ===========================================================================
+
+function setBusinessPublicCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_PUBLIC;
+ getBusinessData(businessId).ownerId = 0;
+
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
+}
+
+// ===========================================================================
+
+function removeBusinessOwnerCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_NONE;
+ getBusinessData(businessId).ownerId = -1;
+ getBusinessData(businessId).needsSaved = true;
+
+ messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} owner`);
+}
+
+// ===========================================================================
+
+function toggleBusinessInteriorLightsCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, "You can't change the interior lights for this business!");
+ return false;
+ }
+
+ getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
+ updateBusinessInteriorLightsForOccupants(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+ meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
+}
+
+// ===========================================================================
+
+function setBusinessEntranceFeeCommand(command, params, client) {
+ let entranceFee = toInteger(getParam(params, " ", 1)) || 0;
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).entranceFee = entranceFee;
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
+}
+
+// ===========================================================================
+
+function setBusinessPaintBallCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).type = AGRP_BIZ_TYPE_PAINTBALL;
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
+}
+
+// ===========================================================================
+
+function getBusinessInfoCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let businessData = getBusinessData(businessId);
+
+ let ownerName = "Unknown";
+ switch (businessData.ownerType) {
+ case AGRP_BIZ_OWNER_CLAN:
+ ownerName = getClanData(businessData.ownerId).name;
+ break;
+
+ case AGRP_BIZ_OWNER_JOB:
+ ownerName = getJobData(businessData.ownerId).name;
+ break;
+
+ case AGRP_BIZ_OWNER_PLAYER:
+ let subAccountData = loadSubAccountFromId(businessData.ownerId);
+ ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
+ break;
+
+ case AGRP_BIZ_OWNER_PUBLIC:
+ ownerName = "Public";
+ break;
+
+ case AGRP_BIZ_OWNER_NONE:
+ //submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType for business ${businessId}/${getBusinessData(businessId).databaseId}`);
+ ownerName = "None";
+ break;
+
+ default:
+ submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType ${businessData.ownerType} for business ${businessId}/${getBusinessData(businessId).databaseId}`);
+ ownerName = "None";
+ break;
+ }
+
+
+ let tempStats = [
+ [`Name`, `${businessData.name}`],
+ [`ID`, `${businessData.index}/${businessData.databaseId}`],
+ [`Owner`, `${ownerName} (${getBusinessOwnerTypeText(businessData.ownerType)})`],
+ [`Locked`, `${getLockedUnlockedFromBool(businessData.locked)}`],
+ [`BuyPrice`, `${getCurrencyString(businessData.buyPrice)}`],
+ //[`RentPrice`, `${businessData.rentPrice}`],
+ [`HasInterior`, `${getYesNoFromBool(businessData.hasInterior)}`],
+ [`CustomInterior`, `${getYesNoFromBool(businessData.customInterior)}`],
+ [`HasBuyableItems`, `${getYesNoFromBool(doesBusinessHaveAnyItemsToBuy(businessId))}`],
+ [`EntranceFee`, `${getCurrencyString(businessData.entranceFee)}`],
+ [`InteriorLights`, `${getOnOffFromBool(businessData.interiorLights)}`],
+ [`Balance`, `${getCurrencyString(businessData.till)}`],
+ [`RadioStation`, `${businessData.streamingRadioStation}`],
+ [`LabelHelpType`, `${businessData.labelHelpType}`],
+ ];
+
+ let stats = tempStats.map(stat => `{MAINCOLOUR}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessInfo", businessData.name)));
+ let chunkedList = splitArrayIntoChunks(stats, 6);
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+
+ //messagePlayerInfo(client, `🏢 {businessBlue}[Business Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getBusinessData(businessId).name}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${businessId}/${getBusinessData(businessId).databaseId}`);
+}
+
+// ===========================================================================
+
+function getBusinessFloorItemsCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ showBusinessFloorInventoryToPlayer(client, businessId);
+}
+
+// ===========================================================================
+
+function getBusinessStorageItemsCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ showBusinessStorageInventoryToPlayer(client, businessId);
+}
+
+// ===========================================================================
+
+function setBusinessPickupCommand(command, params, client) {
+ let typeParam = getParam(params, " ", 1) || "business";
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (isNaN(typeParam)) {
+ if (isNull(getGameConfig().pickupModels[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid pickup type! Use a pickup type name or a model ID");
+ let pickupTypes = Object.keys(getGameConfig().pickupModels[getGame()]);
+ let chunkedList = splitArrayIntoChunks(pickupTypes, 10);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderPickupTypes")));
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+ return false;
+ }
+
+ getBusinessData(businessId).entrancePickupModel = getGameConfig().pickupModels[getGame()][typeParam];
+ } else {
+ getBusinessData(businessId).entrancePickupModel = toInteger(typeParam);
+ }
+
+ resetBusinessPickups(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup display to {ALTCOLOUR}${typeParam}!`);
+}
+
+// ===========================================================================
+
+function setBusinessInteriorTypeCommand(command, params, client) {
+ let typeParam = getParam(params, " ", 1) || "business";
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (typeof getGameConfig().interiors[getGame()] == "undefined") {
+ messagePlayerError(client, `There are no interiors available for this game!`);
+ return false;
+ }
+
+ if (isNaN(typeParam)) {
+ if (toLowerCase(typeParam) == "None") {
+ getBusinessData(businessId).exitPosition = toVector3(0.0, 0.0, 0.0);
+ getBusinessData(businessId).exitDimension = 0;
+ getBusinessData(businessId).exitInterior = -1;
+ getBusinessData(businessId).hasInterior = false;
+ 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`);
+ return false;
+ }
+
+ if (isNull(getGameConfig().interiors[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid interior type! Use an interior type name");
+ let interiorTypesList = Object.keys(getGameConfig().interiors[getGame()]);
+ let chunkedList = splitArrayIntoChunks(interiorTypesList, 10);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderInteriorTypes")));
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+ return false;
+ }
+
+ 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).hasInterior = true;
+ getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
+
+ 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);
+ //deleteBusinessExitBlip(businessId);
+ //createBusinessExitBlip(businessId);
+ //createBusinessExitPickup(businessId);
+
+ resetBusinessPickups(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
+}
+
+// ===========================================================================
+
+function addBusinessPropertyTemplateEntities(command, params, client) {
+ let propertyTemplateParam = getParam(params, " ", 1) || "business";
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (typeof getGameConfig().interiors[getGame()] == "undefined") {
+ messagePlayerError(client, `There are no property templates available for this game!`);
+ return false;
+ }
+
+ if (isNaN(propertyTemplateParam)) {
+ if (isNull(getGameConfig().interiors[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid interior type! Use an interior type name");
+ let interiorTypesList = Object.keys(getGameConfig().properties[getGame()]);
+ let chunkedList = splitArrayIntoChunks(interiorTypesList, 10);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderPropertyTemplateTypes")));
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+ return false;
+ }
+
+ 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).hasInterior = true;
+ getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
+ getBusinessData(businessId).interiorScene = getGameConfig().interiors[getGame()][typeParam][3];
+ }
+
+ //deleteBusinessExitPickup(businessId);
+ //deleteBusinessExitBlip(businessId);
+ //createBusinessExitBlip(businessId);
+ //createBusinessExitPickup(businessId);
+
+ resetBusinessPickups(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
+}
+
+// ===========================================================================
+
+function setBusinessBlipCommand(command, params, client) {
+ let typeParam = getParam(params, " ", 1) || "business";
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (isNaN(typeParam)) {
+ if (isNull(getGameConfig().blipSprites[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid business type! Use a business type name or a blip image ID");
+
+ let blipTypes = Object.keys(getGameConfig().blipSprites[getGame()]);
+ let chunkedList = splitArrayIntoChunks(blipTypes, 10);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBlipTypes")));
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+ return false;
+ }
+
+ getBusinessData(businessId).entranceBlipModel = getGameConfig().blipSprites[getGame()][typeParam];
+ } else {
+ getBusinessData(businessId).entranceBlipModel = toInteger(typeParam);
+ }
+
+ resetBusinessBlips(businessId);
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`);
+}
+
+// ===========================================================================
+
+function giveDefaultItemsToBusinessCommand(command, params, client) {
+ let typeParam = getParam(params, " ", 1) || "business";
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!isNaN(typeParam)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (isNull(getGameConfig().defaultBusinessItems[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid business items type! Use a business items type name");
+ let businessItemTypes = Object.keys(getGameConfig().defaultBusinessItems[getGame()]);
+ let chunkedList = splitArrayIntoChunks(businessItemTypes, 10);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDefaultBusinessItemTypes")));
+ for (let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+ return false;
+ }
+
+ for (let i in getGameConfig().defaultBusinessItems[getGame()][typeParam]) {
+ let itemTypeId = getItemTypeFromParams(getGameConfig().defaultBusinessItems[getGame()][typeParam][i][0]);
+ let itemTypeData = getItemTypeData(itemTypeId);
+ if (itemTypeData) {
+ let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, AGRP_ITEM_OWNER_BIZFLOOR, getBusinessData(businessId).databaseId, getGameConfig().defaultBusinessItems[getGame()][typeParam][i][1]);
+ getItemData(newItemIndex).buyPrice = applyServerInflationMultiplier(itemTypeData.orderPrice) * getGameConfig().defaultBusinessItems[getGame()][typeParam][i][2];
+ }
+ }
+
+ cacheBusinessItems(businessId);
+ updateBusinessPickupLabelData(businessId);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`);
+}
+
+// ===========================================================================
+
+function setBusinessDealershipCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ 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`);
+}
+
+// ===========================================================================
+
+function deleteBusinessFloorItemsCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let tempCache = getBusinessData(businessId).floorItemCache;
+ for (let i in tempCache) {
+ deleteItem(tempCache[i]);
+ }
+
+ cacheBusinessItems(businessId);
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`);
+}
+
+// ===========================================================================
+
+function deleteBusinessStorageItemsCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let tempCache = getBusinessData(businessId).storageItemCache;
+ for (let i in tempCache) {
+ deleteItem(tempCache[i]);
+ }
+
+ cacheBusinessItems(businessId);
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`);
+}
+
+// ===========================================================================
+
+function withdrawFromBusinessCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let amount = toInteger(getParam(params, " ", 1)) || 0;
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ if (getBusinessData(businessId).till < amount) {
+ messagePlayerError(client, `Business {businessBlue}${tempBusinessData.name} doesn't have that much money! Use /bizbalance.`);
+ return false;
+ }
+
+ getBusinessData(businessId).till -= amount;
+ givePlayerCash(client, amount);
+ updatePlayerCash(client);
+ getBusinessData(businessId).needsSaved = true;
+
+ messagePlayerSuccess(client, `You withdrew ${getCurrencyString(amount)} from business {businessBlue}${getBusinessData(businessId).name} till`);
+}
+
+// ===========================================================================
+
+function setBusinessBuyPriceCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let amount = toInteger(getParam(params, " ", 1)) || 0;
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ if (amount < 0) {
+ messagePlayerError(client, `The amount can't be less than 0!`);
+ return false;
+ }
+
+ getBusinessData(businessId).buyPrice = amount;
+ 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}${getCurrencyString(amount)}`);
+}
+
+// ===========================================================================
+
+function depositIntoBusinessCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let amount = toInteger(getParam(params, " ", 1)) || 0;
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ // Let anybody deposit money
+ //if(!canPlayerManageBusiness(client, businessId)) {
+ // messagePlayerError(client, "You can't deposit cash into this business!");
+ // return false;
+ //}
+
+ if (getPlayerCurrentSubAccount(client).cash < amount) {
+ messagePlayerError(client, `You don't have that much money! You only have ${getCurrencyString(getPlayerCurrentSubAccount(client).cash)}`);
+ return false;
+ }
+
+ getBusinessData(businessId).till += amount;
+ takePlayerCash(client, amount);
+ updatePlayerCash(client);
+
+ getBusinessData(businessId).needsSaved = true;
+ messagePlayerSuccess(client, `You deposited ${getCurrencyString(amount)} into business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till`);
+}
+
+// ===========================================================================
+
+function orderItemForBusinessCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ if (!areThereEnoughParams(params, 3, " ")) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let splitParams = params.split(" ");
+ 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`);
+ return false;
+ }
+ let pricePerItem = getOrderPriceForItemType(itemType);
+
+ let amount = toInteger(splitParams.slice(-2, -1)) || 1;
+ let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
+ let businessId = getPlayerBusiness(client);
+
+ logToConsole(LOG_DEBUG, `[AGRP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ let orderTotalCost = pricePerItem * amount;
+
+ //getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
+ 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 ${getCurrencyString(pricePerItem)} each will cost a total of ${getCurrencyString(orderTotalCost)}`, "Business Order Cost");
+ getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
+}
+
+// ===========================================================================
+
+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}${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 ${getCurrencyString(getItemTypeData(itemType).orderPrice)} each for business {businessBlue}${getBusinessData(businessId).name}`);
+}
+
+// ===========================================================================
+
+function viewBusinessTillAmountCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (!canPlayerManageBusiness(client, businessId)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ return false;
+ }
+
+ messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till has {ALTCOLOUR}${getCurrencyString(getBusinessData(businessId).till)}`);
+}
+
+// ===========================================================================
+
+function buyBusinessCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (getBusinessData(businessId).buyPrice <= 0) {
+ messagePlayerError(client, getLocaleString(client, "BusinessNotForSale"));
+ return false;
+ }
+
+ if (getPlayerCurrentSubAccount(client).cash < getBusinessData(businessId).buyPrice) {
+ messagePlayerError(client, getLocaleString(client, "BusinessPurchaseNotEnoughMoney"));
+ return false;
+ }
+
+ showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ getPlayerData(client).promptType = AGRP_PROMPT_BIZBUY;
+}
+
+// ===========================================================================
+
+function moveBusinessEntranceCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).entrancePosition = getPlayerPosition(client);
+ getBusinessData(businessId).entranceDimension = getPlayerDimension(client);
+ getBusinessData(businessId).entranceInterior = getPlayerInterior(client);
+
+ //deleteBusinessEntranceBlip(businessId);
+ //deleteBusinessEntrancePickup(businessId);
+ //createBusinessEntranceBlip(businessId);
+ //createBusinessEntrancePickup(businessId);
+
+ resetBusinessPickups(businessId);
+ resetBusinessBlips(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`);
+}
+
+// ===========================================================================
+
+function moveBusinessExitCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!areParamsEmpty(params)) {
+ businessId = getBusinessFromParams(params);
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ getBusinessData(businessId).exitPosition = getPlayerPosition(client);
+ getBusinessData(businessId).exitDimension = getPlayerDimension(client);
+ getBusinessData(businessId).exitInterior = getPlayerInterior(client);
+
+ deleteBusinessExitBlip(businessId);
+ deleteBusinessExitPickup(businessId);
+
+ createBusinessExitBlip(businessId);
+ createBusinessExitPickup(businessId);
+
+ getBusinessData(businessId).needsSaved = true;
+
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}exit to their position`);
+}
+
+// ===========================================================================
+
+function getBusinessDataFromDatabaseId(databaseId) {
+ if (databaseId <= 0) {
+ return false;
+ }
+
+ let matchingBusinesses = getServerData().businesses.filter(b => b.databaseId == databaseId)
+ if (matchingBusinesses.length == 1) {
+ return matchingBusinesses[0];
+ }
+ return false;
+}
+
+// ===========================================================================
+
+function getClosestBusinessEntrance(position, dimension) {
+ let closest = 0;
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].entranceDimension == dimension) {
+ if (getDistance(position, getServerData().businesses[i].entrancePosition) <= getDistance(position, getServerData().businesses[closest].entrancePosition)) {
+ closest = i;
+ }
+ }
+ }
+ return closest;
+}
+
+// ===========================================================================
+
+function getClosestBusinessExit(position, dimension) {
+ let closest = 0;
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == dimension) {
+ if (getDistance(position, getServerData().businesses[i].exitPosition) <= getDistance(position, getServerData().businesses[closest].exitPosition)) {
+ closest = i;
+ }
+ }
+ }
+ return closest;
+}
+
+// ===========================================================================
+
+function isPlayerInAnyBusiness(client) {
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
+ return i;
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function getPlayerBusiness(client) {
+ if (getServerData().businesses.length == 0) {
+ return -1;
+ }
+
+ if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()]) {
+ let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
+ return getBusinessData(closestEntrance).index;
+ }
+ } else {
+ let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
+ return getBusinessData(closestEntrance).index;
+ }
+
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+// ===========================================================================
+
+function saveAllBusinessesToDatabase() {
+ if (getServerConfig().devServer) {
+ return false;
+ }
+
+ for (let i in getServerData().businesses) {
+ if (getServerData().businesses[i].needsSaved) {
+ saveBusinessToDatabase(i);
+ }
+ }
+
+ return true
+}
+
+// ===========================================================================
+
+function saveBusinessToDatabase(businessId) {
+ let tempBusinessData = getServerData().businesses[businessId];
+
+ if (!tempBusinessData.needsSaved) {
+ return false;
+ }
+
+ logToConsole(LOG_DEBUG, `[AGRP.Property]: Saving business '${tempBusinessData.name}' to database ...`);
+ let dbConnection = connectToDatabase();
+ if (dbConnection) {
+ let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
+
+ let data = [
+ ["biz_server", getServerId()],
+ ["biz_name", safeBusinessName],
+ ["biz_owner_type", tempBusinessData.ownerType],
+ ["biz_owner_id", tempBusinessData.ownerId],
+ ["biz_locked", boolToInt(tempBusinessData.locked)],
+ ["biz_entrance_fee", tempBusinessData.entranceFee],
+ ["biz_till", tempBusinessData.till],
+ ["biz_entrance_pos_x", tempBusinessData.entrancePosition.x],
+ ["biz_entrance_pos_y", tempBusinessData.entrancePosition.y],
+ ["biz_entrance_pos_z", tempBusinessData.entrancePosition.z],
+ ["biz_entrance_rot_z", tempBusinessData.entranceRotation],
+ ["biz_entrance_int", tempBusinessData.entranceInterior],
+ ["biz_entrance_vw", tempBusinessData.entranceDimension],
+ ["biz_entrance_pickup", tempBusinessData.entrancePickupModel],
+ ["biz_entrance_blip", tempBusinessData.entranceBlipModel],
+ ["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],
+ ["biz_exit_rot_z", tempBusinessData.exitRotation],
+ ["biz_exit_int", tempBusinessData.exitInterior],
+ ["biz_exit_vw", tempBusinessData.exitDimension],
+ ["biz_exit_pickup", tempBusinessData.exitPickupModel],
+ ["biz_exit_blip", tempBusinessData.exitBlipModel],
+ ["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", (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],
+ ];
+
+ let dbQuery = null;
+ if (tempBusinessData.databaseId == 0) {
+ let queryString = createDatabaseInsertQuery("biz_main", data);
+ dbQuery = queryDatabase(dbConnection, queryString);
+ getServerData().businesses[businessId].databaseId = getDatabaseInsertId(dbConnection);
+ } else {
+ let queryString = createDatabaseUpdateQuery("biz_main", data, `biz_id=${tempBusinessData.databaseId}`);
+ dbQuery = queryDatabase(dbConnection, queryString);
+ }
+
+ getBusinessData(businessId).needsSaved = false;
+
+ freeDatabaseQuery(dbQuery);
+ disconnectFromDatabase(dbConnection);
+ return true;
+ }
+ logToConsole(LOG_DEBUG, `[AGRP.Property]: Saved business '${tempBusinessData.name}' to database!`);
+
+ return false;
+}
+
+// ===========================================================================
+
+function createAllBusinessPickups() {
+ if (!getServerConfig().createBusinessPickups) {
+ return false;
+ }
+
+ for (let i in getServerData().businesses) {
+ createBusinessEntrancePickup(i);
+ createBusinessExitPickup(i);
+ updateBusinessPickupLabelData(i);
+ }
+
+ return true;
+}
+
+// ===========================================================================
+
+function createAllBusinessBlips() {
+ if (!getServerConfig().createBusinessBlips) {
+ return false;
+ }
+
+ if (!isGameFeatureSupported("blip")) {
+ return false;
+ }
+
+ for (let i in getServerData().businesses) {
+ createBusinessEntranceBlip(i);
+ createBusinessExitBlip(i);
+ }
+}
+
+// ===========================================================================
+
+function createBusinessEntrancePickup(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (!getServerConfig().createBusinessPickups) {
+ 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}`);
+
+ 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;
+ }
+
+ entrancePickup = createGamePickup(pickupModelId, businessData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
+ } else if (isGameFeatureSupported("dummyElement")) {
+ entrancePickup = createGameDummyElement(businessData.entrancePosition);
+ }
+
+ if (entrancePickup != null) {
+ if (businessData.entranceDimension != -1) {
+ setElementDimension(entrancePickup, businessData.entranceDimension);
+ setElementOnAllDimensions(entrancePickup, false);
+ } else {
+ setElementOnAllDimensions(entrancePickup, true);
+ }
+
+ if (getGlobalConfig().businessPickupStreamInDistance == -1 || getGlobalConfig().businessPickupStreamOutDistance == -1) {
+ entrancePickup.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(entrancePickup, getGlobalConfig().businessPickupStreamInDistance);
+ setElementStreamOutDistance(entrancePickup, getGlobalConfig().businessPickupStreamOutDistance);
+ }
+ setElementTransient(entrancePickup, false);
+ 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, businessData.buyPrice, businessData.rentPrice, doesBusinessHaveAnyItemsToBuy(businessId));
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function createBusinessEntranceBlip(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (!getServerConfig().createBusinessBlips) {
+ return false;
+ }
+
+ if (!isGameFeatureSupported("blip")) {
+ return false;
+ }
+
+ let businessData = getBusinessData(businessId);
+
+ //if(businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.entranceBlipModel == -1) {
+ return false;
+ }
+
+ let blipModelId = getGameConfig().blipSprites[getGame()].Business;
+
+ if (businessData.entranceBlipModel != 0) {
+ blipModelId = businessData.entranceBlipModel;
+ }
+
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
+
+ if (areServerElementsSupported()) {
+ let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
+ if (entranceBlip != null) {
+ if (businessData.entranceDimension != -1) {
+ setElementDimension(entranceBlip, businessData.entranceDimension);
+ setElementOnAllDimensions(entranceBlip, false);
+ } else {
+ setElementOnAllDimensions(entranceBlip, true);
+ }
+
+ if (getGlobalConfig().businessBlipStreamInDistance == -1 || getGlobalConfig().businessBlipStreamOutDistance == -1) {
+ entranceBlip.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(entranceBlip, getGlobalConfig().businessBlipStreamInDistance);
+ setElementStreamOutDistance(entranceBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ }
+ setElementTransient(entranceBlip, false);
+ businessData.entranceBlip = entranceBlip;
+ }
+ }
+}
+
+// ===========================================================================
+
+function createBusinessExitPickup(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (!getServerConfig().createBusinessPickups) {
+ return false;
+ }
+
+ let businessData = getBusinessData(businessId);
+
+ //if(!businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.exitPickupModel == -1) {
+ return false;
+ }
+
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
+
+ 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);
+ } else if (isGameFeatureSupported("dummyElement")) {
+ //exitPickup = createGameDummyElement(businessData.exitPosition);
+ }
+
+ if (exitPickup != null) {
+ if (businessData.exitDimension != -1) {
+ setElementDimension(exitPickup, businessData.exitDimension);
+ setElementOnAllDimensions(exitPickup, false);
+ } else {
+ setElementOnAllDimensions(exitPickup, true);
+ }
+
+ if (getGlobalConfig().businessPickupStreamInDistance == -1 || getGlobalConfig().businessPickupStreamOutDistance == -1) {
+ exitPickup.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(exitPickup, getGlobalConfig().businessPickupStreamInDistance);
+ setElementStreamOutDistance(exitPickup, getGlobalConfig().businessPickupStreamOutDistance);
+ }
+ setElementTransient(exitPickup, false);
+ getBusinessData(businessId).exitPickup = exitPickup;
+ updateBusinessPickupLabelData(businessId);
+ }
+
+}
+
+// ===========================================================================
+
+function createBusinessExitBlip(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (!getServerConfig().createBusinessBlips) {
+ return false;
+ }
+
+ if (!isGameFeatureSupported("blip")) {
+ return false;
+ }
+
+ let businessData = getBusinessData(businessId);
+
+ //if(!businessData.hasInterior) {
+ // return false;
+ //}
+
+ if (businessData.exitBlipModel == -1) {
+ return false;
+ }
+
+ let blipModelId = getGameConfig().blipSprites[getGame()].Business;
+
+ if (businessData.exitBlipModel != 0) {
+ blipModelId = businessData.exitBlipModel;
+ }
+
+ 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) {
+ if (businessData.exitDimension != -1) {
+ setElementDimension(exitBlip, businessData.exitDimension);
+ setElementOnAllDimensions(exitBlip, false);
+ } else {
+ setElementOnAllDimensions(exitBlip, true);
+ }
+
+ if (getGlobalConfig().businessBlipStreamInDistance == -1 || getGlobalConfig().businessBlipStreamOutDistance == -1) {
+ exitBlip.netFlags.distanceStreaming = false;
+ } else {
+ setElementStreamInDistance(exitBlip, getGlobalConfig().businessBlipStreamInDistance);
+ setElementStreamOutDistance(exitBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ }
+ setElementTransient(exitBlip, false);
+ businessData.exitBlip = exitBlip;
+ }
+}
+
+// ===========================================================================
+
+function deleteBusiness(businessId, whoDeleted = 0) {
+ let tempBusinessData = getBusinessData(businessId);
+
+ let dbConnection = connectToDatabase();
+ let dbQuery = null;
+
+ deleteBusinessBlips(businessId);
+ deleteBusinessPickups(businessId);
+
+ if (dbConnection) {
+ dbQuery = queryDatabase(dbConnection, `UPDATE biz_main SET biz_deleted = 1, biz_when_deleted = UNIX_TIMESTAMP(), biz_who_deleted = ${whoDeleted} WHERE biz_id = ${tempBusinessData.databaseId}`);
+ if (dbQuery) {
+ freeDatabaseQuery(dbQuery);
+ }
+ disconnectFromDatabase(dbConnection);
+ }
+
+ removePlayersFromBusiness(businessId);
+
+ getServerData().businesses.splice(businessId, 1);
+
+ return true;
+}
+
+// ===========================================================================
+
+function removePlayersFromBusiness(businessIndex) {
+ getClients().forEach(function (client) {
+ if (doesBusinessHaveInterior(businessIndex)) {
+ if (getPlayerBusiness(client) == businessIndex) {
+ if (getPlayerInterior(client) == getBusinessData(businessIndex).exitInterior && getPlayerDimension(client) == getBusinessData(businessIndex).exitDimension) {
+ exitBusiness(client);
+ }
+ }
+ }
+ });
+
+ return true;
+}
+
+// ===========================================================================
+
+function removePlayerFromBusiness(client) {
+ exitBusiness(client);
+ return false;
+}
+
+// ===========================================================================
+
+function exitBusiness(client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (businessId == false) {
+ return false;
+ }
+
+ if (isPlayerSpawned(client)) {
+ setPlayerInterior(client, getServerData().businesses[businessId].entranceInterior);
+ setPlayerDimension(client, getServerData().businesses[businessId].entranceDimension);
+ setPlayerPosition(client, getServerData().businesses[businessId].entrancePosition);
+ return true;
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function getBusinessOwnerTypeText(ownerType) {
+ switch (ownerType) {
+ case AGRP_BIZ_OWNER_CLAN:
+ return "clan";
+
+ case AGRP_BIZ_OWNER_JOB:
+ return "job";
+
+ case AGRP_BIZ_OWNER_PLAYER:
+ return "player";
+
+ case AGRP_BIZ_OWNER_NONE:
+ case AGRP_BIZ_OWNER_PUBLIC:
+ return "not owned";
+
+ default:
+ return "unknown";
+ }
+}
+
+// ===========================================================================
+
+function getBusinessData(businessId) {
+ if (businessId == -1) {
+ return false;
+ }
+
+ if (typeof getServerData().businesses[businessId] != null) {
+ return getServerData().businesses[businessId];
+ }
+ return false;
+}
+
+// ===========================================================================
+
+function doesBusinessHaveInterior(businessId) {
+ return getBusinessData(businessId).hasInterior;
+}
+
+// ===========================================================================
+
+function deleteBusinessEntrancePickup(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).entrancePickup != null) {
+ //removeFromWorld(getBusinessData(businessId).entrancePickup);
+ deleteGameElement(getBusinessData(businessId).entrancePickup);
+ getBusinessData(businessId).entrancePickup = null;
+
+ return true;
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function deleteBusinessExitPickup(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).exitPickup != null) {
+ //removeFromWorld(getBusinessData(businessId).exitPickup);
+ deleteGameElement(getBusinessData(businessId).exitPickup);
+ getBusinessData(businessId).exitPickup = null;
+ }
+}
+
+// ===========================================================================
+
+function deleteBusinessEntranceBlip(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (!isGameFeatureSupported("blip")) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).entranceBlip != null) {
+ //removeFromWorld(getBusinessData(businessId).entranceBlip);
+ deleteGameElement(getBusinessData(businessId).entranceBlip);
+ getBusinessData(businessId).entranceBlip = null;
+ }
+}
+
+// ===========================================================================
+
+function deleteBusinessExitBlip(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (!isGameFeatureSupported("blip")) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).exitBlip != null) {
+ //removeFromWorld(getBusinessData(businessId).exitBlip);
+ deleteGameElement(getBusinessData(businessId).exitBlip);
+ getBusinessData(businessId).exitBlip = null;
+ }
+}
+
+// ===========================================================================
+
+function reloadAllBusinessesCommand(command, params, client) {
+ let clients = getClients();
+ for (let i in clients) {
+ removePlayerFromBusiness(clients[i]);
+ }
+
+ for (let i in getServerData().businesses) {
+ deleteBusinessExitBlip(i);
+ deleteBusinessEntranceBlip(i);
+ deleteBusinessExitPickup(i);
+ deleteBusinessEntrancePickup(i);
+ }
+
+ //forceAllPlayersToStopWorking();
+ clearArray(getServerData().businesses);
+ getServerData().businesses = loadBusinessesFromDatabase();
+ createAllBusinessPickups();
+ createAllBusinessBlips();
+ setBusinessDataIndexes();
+ cacheAllBusinessItems();
+
+ announceAdminAction(`AllBusinessesReloaded`);
+}
+
+// ===========================================================================
+
+function setBusinessDataIndexes() {
+ for (let i in getServerData().businesses) {
+ getServerData().businesses[i].index = i;
+
+ //if (getServerData().businesses[i].streamingRadioStation > 0) {
+ // let radioStationIndex = getRadioStationFromDatabaseId(getServerData().businesses[i].streamingRadioStation);
+ // if (radioStationIndex != -1) {
+ // getServerData().businesses[i].streamingRadioStationIndex = radioStationIndex;
+ // }
+ //}
+
+ for (let j in getServerData().businesses[i].locations) {
+ if (getServerData().businesses[i].locations[j].type == AGRP_BIZ_LOC_ATM) {
+ getServerData().atmLocationCache.push([i, j, getServerData().businesses[i].locations[j].position]);
+ }
+ }
+ }
+}
+
+// ===========================================================================
+
+// Adds an item to a business inventory by item type, amount and buy price
+function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
+ let tempItemData = new ItemData(false);
+ tempItemData.amount = amount;
+ tempItemData.buyPrice = buyPrice;
+ tempItemData.itemType = getItemTypeData(itemType).databaseId;
+ tempItemData.ownerId = getBusinessData(business).databaseId;
+ tempItemData.ownerType = AGRP_ITEMOWNER_BIZ;
+ tempItemData.ownerIndex = businessId;
+ tempItemData.itemTypeIndex = itemType;
+ saveItemToDatabase(tempItemData);
+ getServerData().items.push(tempItemData);
+
+ let index = getServerData().items.length - 1;
+ getServerData().items[index].index = index;
+}
+
+// ===========================================================================
+
+function buyFromBusinessCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (areParamsEmpty(params)) {
+ showBusinessFloorInventoryToPlayer(client, businessId);
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ if (getBusinessData(businessId).locked) {
+ messagePlayerError(client, `This business is closed!`);
+ return false;
+ }
+
+ if (getBusinessData(businessId).hasInterior) {
+ if (!getPlayerBusiness(client)) {
+ if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
+ messagePlayerTip(client, getLocaleString(client, "NeedToEnterPropertyKeyPress", "business", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)}{MAINCOLOUR}`));
+ } else {
+ messagePlayerNormal(client, getLocaleString(client, "NeedToEnterBusinessCommand", "business", "{ALTCOLOUR}/enter{MAINCOLOUR}"));
+ }
+ return false;
+ }
+ }
+
+ let itemSlot = toInteger(getParam(params, " ", 1)) || 1;
+
+ if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
+ return false;
+ }
+
+ if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
+ return false;
+ }
+
+ let amount = 1;
+ if (areThereEnoughParams(params, 2, " ")) {
+ amount = toInteger(getParam(params, " ", 2)) || 1;
+ if (amount <= 0) {
+ messagePlayerError(client, getLocaleString(client, "AmountMustBeMoreThan", "0"));
+ return false;
+ }
+ }
+
+ if (getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount < amount) {
+ messagePlayerError(client, `There are only ${getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount} ${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name} in slot ${itemSlot - 1}`);
+ return false;
+ }
+
+ let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
+ if (firstSlot == -1) {
+ messagePlayerError(client, messagePlayerError(client, getLocaleString(client, "InventoryFullCantCarry")));
+ return false;
+ }
+
+ let totalCost = getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).buyPrice * amount;
+ let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name;
+
+ if (getPlayerCurrentSubAccount(client).cash < totalCost) {
+ messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice * amount - getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
+ return false;
+ }
+
+ takePlayerCash(client, totalCost);
+ createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).value, AGRP_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
+ cachePlayerHotBarItems(client);
+ getBusinessData(businessId).till = getBusinessData(businessId).till + totalCost;
+
+ getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount = getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount - amount;
+ if (getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount == 0) {
+ destroyItem(getBusinessData(businessId).floorItemCache[itemSlot - 1]);
+ }
+
+ let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
+ if (useType == AGRP_ITEM_USE_TYPE_WEAPON || AGRP_ITEM_USE_TYPE_TAZER || useType == AGRP_ITEM_USE_TYPE_AMMO_CLIP) {
+ if (isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
+ messagePlayerError(client, getLocaleString(client, "WeaponBanned"));
+ return false;
+ }
+ }
+
+ //messagePlayerSuccess(client, `You bought ${amount} {ALTCOLOUR}${itemName} {MAINCOLOUR}for ${totalCost} ${priceEach}`);
+ meActionToNearbyPlayers(client, `buys a ${itemName}`);
+
+ if (!hasPlayerSeenActionTip(client, "ViewInventory")) {
+ if (doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
+ let keyData = getPlayerKeyBindForCommand("inv");
+ messagePlayerActionTip(client, getIndexedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
+ } else {
+ messagePlayerActionTip(client, getIndexedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
+ }
+ }
+
+ markPlayerActionTipSeen(client, "ViewInventory");
+}
+
+// ===========================================================================
+
+function setBusinessItemSellPriceCommand(command, params, client) {
+ let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
+
+ if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ messagePlayerError(client, `Item slot ${itemSlot - 1} doesn't exist!`);
+ return false;
+ }
+
+ if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ messagePlayerError(client, `Item slot ${itemSlot - 1} slot is empty!`);
+ return false;
+ }
+
+ let oldPrice = getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice;
+ let newPrice = toInteger(getParam(params, " ", 2)) || oldPrice;
+ if (newPrice < 0) {
+ messagePlayerError(client, "The price can't be negative!");
+ return false;
+ }
+
+ 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 ${getCurrencyString(oldPrice)} to ${getCurrencyString(newprice)}`);
+}
+
+// ===========================================================================
+
+function storeItemInBusinessStorageCommand(command, params, client) {
+ let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
+
+ if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
+ return false;
+ }
+
+ if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
+ return false;
+ }
+
+ let firstSlot = getBusinessStorageFirstFreeItemSlot(businessId);
+
+ if (firstSlot == -1) {
+ messagePlayerError(client, `There isn't any room in this business storage`);
+ return false;
+ }
+
+ getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZSTORAGE;
+ getBusinessData(businessId).storageItemCache[firstSlot] = getBusinessData(businessId).floorItemCache[itemSlot - 1];
+ getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
+ messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} to the business storage in slot ${firstSlot}`);
+}
+
+// ===========================================================================
+
+function stockItemOnBusinessFloorCommand(command, params, client) {
+ let businessId = getPlayerBusiness(client);
+
+ if (!getBusinessData(businessId)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ return false;
+ }
+
+ let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
+
+ if (typeof getBusinessData(businessId).storageItemCache[itemSlot - 1] == "undefined") {
+ messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
+ return false;
+ }
+
+ if (getBusinessData(businessId).storageItemCache[itemSlot - 1] == -1) {
+ messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
+ return false;
+ }
+
+ let firstSlot = getBusinessFloorFirstFreeItemSlot(businessId);
+
+ if (firstSlot == -1) {
+ messagePlayerError(client, `There isn't any room in this business storage`);
+ return false;
+ }
+
+ getItemData(getBusinessData(businessId).storageItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZFLOOR;
+ getBusinessData(businessId).floorItemCache[firstSlot] = getBusinessData(businessId).storageItemCache[itemSlot - 1];
+ getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
+ messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} of the business storage to the business floor slot ${firstSlot}`);
+}
+
+// ===========================================================================
+
+// Gets the first free slot in a business's storage items
+function getBusinessStorageFirstFreeItemSlot(businessId) {
+ return getBusinessData(businessId).storageItemCache.findIndex(item => item == -1);
+}
+
+// ===========================================================================
+
+// Gets the first free slot in a business's floor items
+function getBusinessFloorFirstFreeItemSlot(businessId) {
+ return getBusinessData(businessId).floorItemCache.findIndex(item => item == -1);
+}
+
+// ===========================================================================
+
+// Caches all items for all businesses
+function cacheAllBusinessItems() {
+ logToConsole(LOG_DEBUG, "[AGRP.Property] Caching all business items ...");
+ for (let i in getServerData().businesses) {
+ cacheBusinessItems(i);
+ }
+ logToConsole(LOG_DEBUG, "[AGRP.Property] Cached all business items successfully!");
+}
+
+// ===========================================================================
+
+// Caches all items for a business by businessId
+function cacheBusinessItems(businessId) {
+ clearArray(getBusinessData(businessId).floorItemCache);
+ clearArray(getBusinessData(businessId).storageItemCache);
+
+ //let businessData = getBusinessData(businessId);
+ //logToConsole(LOG_VERBOSE, `[AGRP.Property] 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, `[AGRP.Property] 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);
+ } else if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
+ getBusinessData(businessId).storageItemCache.push(i);
+ }
+ }
+
+ logToConsole(LOG_VERBOSE, `[AGRP.Property] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
+}
+
+// ===========================================================================
+
+// Gets a business's data index from a business's databaseId
+function getBusinessIdFromDatabaseId(databaseId) {
+ return getServerData().businesses.findIndex(business => business.databaseId == databaseId);
+}
+
+// ===========================================================================
+
+// Updates all pickup data for a business by businessId
+function updateBusinessPickupLabelData(businessId) {
+ if (!areServerElementsSupported()) {
+ return false;
+ }
+
+ if (getBusinessData(businessId).exitPickup != null) {
+ setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_EXIT, false);
+ setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.id", businessId, false);
+ setEntityData(getBusinessData(businessId).exitPickup, "agrp.label.type", AGRP_LABEL_EXIT, true);
+ }
+
+ if (getBusinessData(businessId).entrancePickup != null) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_ENTRANCE, false);
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.id", businessId, false);
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.type", AGRP_LABEL_BUSINESS, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.locked", getBusinessData(businessId).locked, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_NONE, true);
+
+ switch (getBusinessData(businessId).labelHelpType) {
+ case AGRP_PROPLABEL_INFO_ENTERVEHICLE: {
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTERVEHICLE, true);
+ break;
+ }
+
+ case AGRP_PROPLABEL_INFO_ENTER: {
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
+ break;
+ }
+
+ case AGRP_PROPLABEL_INFO_REPAIR: {
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_REPAIR, true);
+ break;
+ }
+
+ default: {
+ if (getBusinessData(businessId).hasInterior) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
+ } else {
+ if (doesBusinessHaveAnyItemsToBuy(businessId)) {
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_BUY, true);
+ } else {
+ removeEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help");
+ }
+ }
+ break;
+ }
+ }
+
+ setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
+ }
+}
+
+// ===========================================================================
+
+function resetBusinessPickups(businessId) {
+ deleteBusinessPickups(businessId);
+ createBusinessEntrancePickup(businessId);
+ createBusinessExitPickup(businessId);
+}
+
+// ===========================================================================
+
+function resetBusinessBlips(businessId) {
+ deleteBusinessBlips(businessId);
+ createBusinessEntranceBlip(businessId);
+ createBusinessExitBlip(businessId);
+}
+
+// ===========================================================================
+
+function resetAllBusinessPickups(businessId) {
+ deleteBusinessPickups(businessId);
+ createBusinessEntrancePickup(businessId);
+ createBusinessExitPickup(businessId);
+}
+
+// ===========================================================================
+
+function resetAllBusinessBlips() {
+ for (let i in getServerData().businesses) {
+ deleteBusinessBlips(i);
+ createBusinessBlips(i);
+ }
+}
+
+// ===========================================================================
+
+function createBusinessBlips(businessId) {
+ createBusinessEntranceBlip(businessId);
+ createBusinessExitBlip(businessId);
+}
+
+// ===========================================================================
+
+function resetAllBusinessPickups() {
+ for (let i in getServerData().businesses) {
+ deleteBusinessPickups(i);
+ createBusinessPickups(i);
+ }
+}
+
+// ===========================================================================
+
+function createBusinessPickups(businessId) {
+ createBusinessEntrancePickup(businessId);
+ createBusinessExitPickup(businessId);
+}
+
+// ===========================================================================
+
+function doesBusinessHaveAnyItemsToBuy(businessId) {
+ return (getBusinessData(businessId).floorItemCache.length > 0);
+}
+
+// ===========================================================================
+
+//function sendPlayerBusinessGameScripts(client, businessId) {
+// for(let i in getBusinessData(businessId).gameScripts) {
+// sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
+// }
+//}
+
+// ===========================================================================
+
+//function clearPlayerBusinessGameScripts(client, businessId) {
+// for(let i in getBusinessData(businessId).gameScripts) {
+// sendPlayerGameScriptState(client, AGRP_GAMESCRIPT_DENY);
+// }
+//}
+
+// ===========================================================================
+
+function updateBusinessInteriorLightsForOccupants(businessId) {
+ let clients = getClients()
+ for (let i in clients) {
+ if (getPlayerBusiness(clients[i]) == businessId) {
+ updateInteriorLightsForPlayer(clients[i], getBusinessData(businessId).interiorLights);
+ }
+ }
+}
+
+// ===========================================================================
+
+function canPlayerWithdrawFromBusinessTill(client, businessId) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function canPlayerSetBusinessInteriorLights(client, businessId) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function canPlayerLockUnlockBusiness(client, businessId) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function canPlayerManageBusiness(client, businessId) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER) {
+ if (getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ return true;
+ }
+ }
+
+ if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN) {
+ if (getBusinessData(businessId).ownerId == getPlayerClan(client)) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ return true;
+ }
+
+ //if(getBusinessData(businessId).clanRank <= getClanRankData(getPlayerClan(client), getPlayerClanRank(client)).level) {
+ // return true;
+ //}
+ }
+ }
+
+ return false;
+}
+
+// ===========================================================================
+
+function deleteBusinessBlips(business) {
+ deleteBusinessExitBlip(business);
+ deleteBusinessEntranceBlip(business);
+}
+
+// ===========================================================================
+
+function deleteBusinessPickups(business) {
+ deleteBusinessExitPickup(business);
+ deleteBusinessEntrancePickup(business);
+}
+
+// ===========================================================================
+
+function getBusinessFromParams(params) {
+ if (isNaN(params)) {
+ for (let i in getServerData().businesses) {
+ if (toLowerCase(getServerData().businesses[i].name).indexOf(toLowerCase(params)) != -1) {
+ return i;
+ }
+ }
+ } else {
+ if (typeof getServerData().businesses[params] != "undefined") {
+ return toInteger(params);
+ }
+ }
+ return false;
+}
+
+// ===========================================================================
+
+function deleteAllBusinessBlips() {
+ for (let i in getServerData().businesses) {
+ deleteBusinessBlips(i);
+ }
+}
+
+// ===========================================================================
+
+function deleteAllBusinessPickups() {
+ for (let i in getServerData().businesses) {
+ deleteBusinessPickups(i);
+ }
+}
+
+// ===========================================================================
+
+function getBusinessFromInteriorAndDimension(dimension, interior) {
+ let businesses = getServerData().businesses;
+ for (let i in businesses) {
+ if (businesses[i].exitInterior == interior && businesses[i].exitDimension == dimension) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+// ===========================================================================
+
+function getClosestBusinessWithBuyableItemOfUseType(position, useType) {
+ let availableBusinesses = getBusinessesWithBuyableItemOfUseType(useType);
+
+ let closestBusiness = 0;
+ for (let i in availableBusinesses) {
+ if (getDistance(position, getBusinessData(availableBusinesses[i]).entrancePosition) < getDistance(position, getBusinessData(availableBusinesses[closestBusiness]).entrancePosition)) {
+ closestBusiness = i;
+ }
+ }
+ return availableBusinesses[closestBusiness];
+}
+
+// ===========================================================================
+
+function getBusinessesWithBuyableItemOfUseType(useType) {
+ let businesses = getServerData().businesses;
+ let availableBusinesses = [];
+ for (let i in businesses) {
+ if (doesBusinessHaveBuyableItemOfUseType(i, useType)) {
+ availableBusinesses.push(i);
+ }
+ }
+
+ return availableBusinesses;
+}
+
+// ===========================================================================
+
+function doesBusinessHaveBuyableItemOfUseType(businessId, useType) {
+ let floorItems = getBusinessData(businessId).floorItemCache;
+ for (let i in floorItems) {
+ if (floorItems[i] != -1) {
+ if (getItemData(floorItems[i]) != false) {
+ if (getItemTypeData(getItemData(floorItems[i])).useType == useType) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+// ===========================================================================
+
+*/
\ No newline at end of file
From 237f3fdc409ad7865b43cdf8c9ee88475207afb9 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:23:33 -0500
Subject: [PATCH 066/311] Add workaround for Mafia 1 on pos above/below utils
---
scripts/shared/utilities.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/shared/utilities.js b/scripts/shared/utilities.js
index 0cf85906..5d31cde5 100644
--- a/scripts/shared/utilities.js
+++ b/scripts/shared/utilities.js
@@ -2076,12 +2076,18 @@ function getPosBehindPos(pos, angle, distance) {
// ===========================================================================
function getPosAbovePos(pos, distance) {
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ return toVector3(pos.x, pos.y + distance, pos.z);
+ }
return toVector3(pos.x, pos.y, pos.z + distance);
}
// ===========================================================================
function getPosBelowPos(pos, distance) {
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ return toVector3(pos.x, pos.y - distance, pos.z);
+ }
return toVector3(pos.x, pos.y, pos.z - distance);
}
From a077699648bcb8251cc9a9a248db70fd8921cf66 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:24:22 -0500
Subject: [PATCH 067/311] Enter/exit property overhaul
---
scripts/server/misc.js | 129 ++++++++++--------------------------
scripts/server/utilities.js | 115 ++++++++++++++++++++++++++++++--
2 files changed, 144 insertions(+), 100 deletions(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 5d55e552..2b240893 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -31,7 +31,7 @@ const AGRP_BLIP_EXIT = 6;
// ===========================================================================
// Ped States
-const AGRP_PEDSTATE_NONE = 2; // None
+const AGRP_PEDSTATE_NONE = 0; // None
const AGRP_PEDSTATE_READY = 1; // Ready
const AGRP_PEDSTATE_DRIVER = 2; // Driving a vehicle
const AGRP_PEDSTATE_PASSENGER = 3; // In a vehicle as passenger
@@ -47,11 +47,16 @@ const AGRP_PEDSTATE_INITEM = 12; // In item (crate, box, etc)
const AGRP_PEDSTATE_HANDSUP = 13; // Has hands up (surrendering)
const AGRP_PEDSTATE_SPAWNING = 14; // Spawning
+// Property Types
+const AGRP_PROPERTY_TYPE_NONE = 0; // None
+const AGRP_PROPERTY_TYPE_BUSINESS = 1; // Business
+const AGRP_PROPERTY_TYPE_HOUSE = 2; // House
+
// ===========================================================================
function initMiscScript() {
- logToConsole(LOG_DEBUG, "[VRR.Misc]: Initializing misc script ...");
- logToConsole(LOG_INFO, "[VRR.Misc]: Misc script initialized successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.Misc]: Initializing misc script ...");
+ logToConsole(LOG_INFO, "[AGRP.Misc]: Misc script initialized successfully!");
return true;
}
@@ -273,6 +278,7 @@ function enterExitPropertyCommand(command, params, client) {
}
if (closestProperty == null) {
+ logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s closest door is null`);
return false;
}
@@ -296,48 +302,25 @@ function enterExitPropertyCommand(command, params, client) {
clearPlayerStateToEnterExitProperty(client);
getPlayerData(client).pedState = AGRP_PEDSTATE_ENTERINGPROPERTY;
+ getPlayerData(client).enteringExitingProperty = [(isBusiness) ? AGRP_PROPERTY_TYPE_BUSINESS : AGRP_PROPERTY_TYPE_HOUSE, closestProperty.index];
meActionToNearbyPlayers(client, getLanguageLocaleString(englishId, "EntersProperty", typeString, nameString));
+ if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
+ if (isMainWorldScene(closestProperty.exitScene)) {
+ setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
+ } else {
+ setPlayerScene(client, closestProperty.exitScene);
+ }
+ return false;
+ }
+
if (isFadeCameraSupported()) {
fadeCamera(client, false, 1.0);
}
setTimeout(function () {
- if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
- if (isMainWorldScene(closestProperty.exitScene)) {
- setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
- } else {
- setPlayerScene(client, closestProperty.exitScene);
- }
- } else {
- setPlayerDimension(client, closestProperty.exitDimension);
- setPlayerInterior(client, closestProperty.exitInterior);
- setPlayerPosition(client, closestProperty.exitPosition);
- setPlayerHeading(client, closestProperty.exitRotation);
- setTimeout(function () {
- if (isFadeCameraSupported()) {
- fadeCamera(client, true, 1.0);
- }
- updateInteriorLightsForPlayer(client, closestProperty.interiorLights);
- }, 1000);
- //updateAllInteriorVehiclesForPlayer(client, closestProperty.exitInterior, closestProperty.exitDimension);
-
- if (isBusiness) {
- if (closestProperty.type == AGRP_BIZ_TYPE_PAINTBALL) {
- messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
- startPaintBall(client);
- }
- }
-
- let radioStationIndex = closestProperty.streamingRadioStationIndex;
- if (radioStationIndex != -1) {
- if (getRadioStationData(radioStationIndex)) {
- playRadioStreamForPlayer(client, getRadioStationData(radioStationIndex).url);
- getPlayerData(client).streamingRadioStation = radioStationIndex;
- }
- }
- }
+ handlePlayerEnteringExitingProperty(client);
}, 1100);
return true;
}
@@ -347,75 +330,33 @@ function enterExitPropertyCommand(command, params, client) {
meActionToNearbyPlayers(client, getLocaleString(client, "EnterExitPropertyDoorLocked", (isBusiness) ? getLocaleString(client, "Business") : getLocaleString(client, "House")));
return false;
}
- getPlayerData(client).pedState = AGRP_PEDSTATE_EXITINGPROPERTY;
+
clearPlayerStateToEnterExitProperty(client);
+ getPlayerData(client).pedState = AGRP_PEDSTATE_EXITINGPROPERTY;
+ getPlayerData(client).enteringExitingProperty = [(isBusiness) ? AGRP_PROPERTY_TYPE_BIZ : AGRP_PROPERTY_TYPE_HOUSE, closestProperty.index];
meActionToNearbyPlayers(client, getLanguageLocaleString(englishId, "ExitsProperty", typeString, nameString));
+ if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
+ if (isMainWorldScene(closestProperty.exitScene)) {
+ setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
+ } else {
+ setPlayerScene(client, closestProperty.exitScene);
+ }
+
+ return false;
+ }
+
if (isFadeCameraSupported()) {
fadeCamera(client, false, 1.0);
}
- disableCityAmbienceForPlayer(client, true);
setTimeout(function () {
- if (closestProperty.entranceScene != "" && isGameFeatureSupported("interiorScene")) {
- if (isMainWorldScene(closestProperty.entranceScene)) {
- setPlayerScene(client, "agrp.mainWorldScene");
- } else {
- setPlayerScene(client, closestProperty.entranceScene);
- }
- } else {
- setPlayerPosition(client, closestProperty.entrancePosition);
- setPlayerHeading(client, closestProperty.entranceRotation);
- setPlayerDimension(client, closestProperty.entranceDimension);
- setPlayerInterior(client, closestProperty.entranceInterior);
- setTimeout(function () {
- if (isFadeCameraSupported()) {
- fadeCamera(client, true, 1.0);
- }
-
- updateInteriorLightsForPlayer(client, true);
- }, 1000);
-
- if (isBusiness) {
- if (closestProperty.type == AGRP_BIZ_TYPE_PAINTBALL) {
- messagePlayerAlert(client, getLocaleString(client, "LeftPaintBall"));
- stopPaintBall(client);
- }
- }
-
- clearLocalPickupsForPlayer(client);
-
- //setPlayerInCutsceneInterior(client, closestProperty.entranceCutscene);
- stopRadioStreamForPlayer(client);
- getPlayerData(client).streamingRadioStation = -1;
-
- // Check if exiting property was into another house/business and set radio station accordingly
- let inHouse = getPlayerHouse(client);
- let inBusiness = getPlayerBusiness(client);
-
- if (inBusiness != -1) {
- if (getBusinessData(inBusiness).streamingRadioStationIndex != -1) {
- if (getRadioStationData(getBusinessData(inBusiness).streamingRadioStationIndex)) {
- playRadioStreamForPlayer(client, getRadioStationData(getBusinessData(inBusiness).streamingRadioStationIndex).url);
- getPlayerData(client).streamingRadioStation = getBusinessData(inBusiness).streamingRadioStationIndex;
- }
- }
- } else if (inHouse != -1) {
- if (getHouseData(inHouse).streamingRadioStationIndex != -1) {
- if (getRadioStationData(getHouseData(inHouse).streamingRadioStationIndex)) {
- playRadioStreamForPlayer(client, getRadioStationData(getHouseData(inHouse).streamingRadioStationIndex).url);
- getPlayerData(client).streamingRadioStation = getHouseData(inHouse).streamingRadioStationIndex;
- }
- }
- }
- }
+ handlePlayerEnteringExitingProperty(client);
}, 1100);
- //logToConsole(LOG_DEBUG, `[VRR.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
- return true;
}
}
-
+ //logToConsole(LOG_DEBUG, `[AGRP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
return true;
}
diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js
index 84903af2..47e17f5d 100644
--- a/scripts/server/utilities.js
+++ b/scripts/server/utilities.js
@@ -70,13 +70,13 @@ function initAllClients() {
// ===========================================================================
function updateServerRules() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities]: Updating all server rules ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Updating all server rules ...`);
- logToConsole(LOG_DEBUG, `[VRR.Utilities]: Time support: ${isTimeSupported()}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Time support: ${isTimeSupported()}`);
if (isTimeSupported()) {
if (getServerConfig() != false) {
let value = makeReadableTime(getServerConfig().hour, getServerConfig().minute);
- logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Time" as ${value}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Setting server rule "Time" as ${value}`);
server.setRule("Time", value);
}
}
@@ -85,7 +85,7 @@ function updateServerRules() {
if (getServerConfig() != false) {
if (typeof getGameConfig().weatherNames[getGame()] != "undefined") {
let value = getGameConfig().weatherNames[getGame()][getServerConfig().weather];
- logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Weather" as ${value}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Setting server rule "Weather" as ${value}`);
server.setRule("Weather", value);
}
}
@@ -94,11 +94,11 @@ function updateServerRules() {
if (isSnowSupported()) {
if (getServerConfig() != false) {
let value = getYesNoFromBool(getServerConfig().fallingSnow);
- logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Snowing" as ${value}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Setting server rule "Snowing" as ${value}`);
server.setRule("Snowing", value);
}
}
- logToConsole(LOG_DEBUG, `[VRR.Utilities]: All server rules updated successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: All server rules updated successfully!`);
}
// ===========================================================================
@@ -487,4 +487,107 @@ function removeAllPlayersFromProperties() {
return false;
}
+// ===========================================================================
+
+function handlePlayerEnteringExitingProperty(client) {
+ if (getPlayerData(client).enteringExitingProperty == null) {
+ return false;
+ }
+
+ let pedState = getPlayerData(client).pedState;
+ if (pedState != AGRP_PEDSTATE_ENTERINGPROPERTY && pedState != AGRP_PEDSTATE_EXITINGPROPERTY) {
+ return false;
+ }
+
+ let propertyData = null;
+ if (getPlayerData(client).enteringExitingProperty[0] == AGRP_PROPERTY_TYPE_BUSINESS) {
+ propertyData = getBusinessData(getPlayerData(client).enteringExitingProperty[1]);
+ } else if (getPlayerData(client).enteringExitingProperty[0] == AGRP_PROPERTY_TYPE_HOUSE) {
+ propertyData = getHouseData(getPlayerData(client).enteringExitingProperty[1]);
+ }
+
+ if (propertyData == null || propertyData == false) {
+ return false;
+ }
+
+ if (pedState == AGRP_PEDSTATE_ENTERINGPROPERTY) {
+ setPlayerDimension(client, propertyData.exitDimension);
+ setPlayerInterior(client, propertyData.exitInterior);
+ setPlayerPosition(client, propertyData.exitPosition);
+ setPlayerHeading(client, propertyData.exitRotation);
+ setTimeout(function () {
+ if (isFadeCameraSupported()) {
+ fadeCamera(client, true, 1.0);
+ }
+ updateInteriorLightsForPlayer(client, propertyData.interiorLights);
+ }, 1000);
+
+ if (getPlayerData(client).enteringExitingProperty[0] == AGRP_PROPERTY_TYPE_BUSINESS) {
+ if (propertyData.type == AGRP_BIZ_TYPE_PAINTBALL) {
+ startPaintBall(client);
+ }
+ }
+
+ let radioStationIndex = propertyData.streamingRadioStationIndex;
+ if (radioStationIndex != -1) {
+ if (getRadioStationData(radioStationIndex)) {
+ playRadioStreamForPlayer(client, getRadioStationData(radioStationIndex).url);
+ getPlayerData(client).streamingRadioStation = radioStationIndex;
+ }
+ }
+
+ getPlayerData(client).inProperty = [getPlayerData(client).enteringExitingProperty[0], getPlayerData(client).enteringExitingProperty[1]];
+ getPlayerData(client).enteringExitingProperty = null;
+ getPlayerData(client).pedState = AGRP_PEDSTATE_READY;
+ } else if (pedState == AGRP_PEDSTATE_EXITINGPROPERTY) {
+ setPlayerDimension(client, propertyData.entranceDimension);
+ setPlayerInterior(client, propertyData.entranceDimension);
+ setPlayerPosition(client, propertyData.entranceDimension);
+ setPlayerHeading(client, propertyData.entranceDimension);
+
+ // Check if exiting property was into another house/business
+ let inProperty = false;
+ let inPropertyType = AGRP_PROPERTY_TYPE_NONE;
+
+ let inBusiness = getPlayerBusiness(client);
+ if (inBusiness != -1) {
+ inProperty = getBusinessData(inBusiness);
+ inPropertyType = AGRP_PROPERTY_TYPE_BUSINESS;
+ } else {
+ let inHouse = getPlayerHouse(client);
+ if (inHouse != -1) {
+ inProperty = getHouseData(inHouse);
+ inPropertyType = AGRP_PROPERTY_TYPE_HOUSE;
+ }
+ }
+
+ setTimeout(function () {
+ if (getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
+ if (isFadeCameraSupported()) {
+ fadeCamera(client, true, 1.0);
+ }
+ }
+ updateInteriorLightsForPlayer(client, (inProperty != false) ? inProperty.interiorLights : true);
+ }, 1000);
+
+ stopPaintBall(client);
+
+ if (inProperty != false) {
+ if (getBusinessData(inBusiness).streamingRadioStationIndex != -1) {
+ if (getRadioStationData(getBusinessData(inBusiness).streamingRadioStationIndex)) {
+ playRadioStreamForPlayer(client, getRadioStationData(getBusinessData(inBusiness).streamingRadioStationIndex).url);
+ getPlayerData(client).streamingRadioStation = getBusinessData(inBusiness).streamingRadioStationIndex;
+ }
+ }
+ } else {
+ stopRadioStreamForPlayer(client);
+ getPlayerData(client).streamingRadioStation = -1;
+ }
+
+ getPlayerData(client).inProperty = [inPropertyType, inProperty.index];
+ getPlayerData(client).enteringExitingProperty = null;
+ getPlayerData(client).pedState = AGRP_PEDSTATE_READY;
+ }
+}
+
// ===========================================================================
\ No newline at end of file
From 5ce4bd15a33b6f6943d9191559cce75e0dd54657 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:24:48 -0500
Subject: [PATCH 068/311] Map loaded net event
---
scripts/server/netevents.js | 198 +++++++++++++++++++-----------------
1 file changed, 103 insertions(+), 95 deletions(-)
diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js
index e9b25973..dfaa010e 100644
--- a/scripts/server/netevents.js
+++ b/scripts/server/netevents.js
@@ -9,14 +9,14 @@
// ===========================================================================
function initNetworkEventsScript() {
- logToConsole(LOG_DEBUG, "[VRR.NetEvents]: Initializing network events script ...");
- logToConsole(LOG_INFO, "[VRR.NetEvents]: Network events script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.NetEvents]: Initializing network events script ...");
+ logToConsole(LOG_INFO, "[AGRP.NetEvents]: Network events script initialized!");
}
// ===========================================================================
function addAllNetworkEventHandlers() {
- logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Client]: Adding network handlers ...");
// KeyBind
addNetworkEventHandler("agrp.useKeyBind", playerUsedKeyBind);
@@ -74,19 +74,20 @@ function addAllNetworkEventHandlers() {
addNetworkEventHandler("agrp.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
addNetworkEventHandler("agrp.playerPedId", receivePlayerPedNetworkId);
addNetworkEventHandler("agrp.playerCop", setPlayerAsCopState);
+ addNetworkEventHandler("agrp.mapLoaded", playerMapLoaded);
}
// ===========================================================================
function updatePlayerNameTag(client) {
- //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
}
// ===========================================================================
function updateAllPlayerNameTags() {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated nametags to all players`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated nametags to all players`);
let clients = getClients();
for (let i in clients) {
updatePlayerNameTag(clients[i]);
@@ -96,7 +97,7 @@ function updateAllPlayerNameTags() {
// ===========================================================================
function updatePlayerPing(client) {
- //logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
sendNetworkEventToPlayer("agrp.ping", null, getPlayerName(client), getPlayerPing(client));
}
@@ -104,7 +105,7 @@ function updatePlayerPing(client) {
function playerClientReady(client) {
playerResourceReady[client.index] = true;
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
initClient(client);
}
@@ -114,14 +115,14 @@ function playerClientReady(client) {
function playerGUIReady(client) {
playerGUI[client.index] = true;
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
}
// ===========================================================================
function playerClientStarted(client) {
playerResourceStarted[client.index] = true;
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
initClient(client);
}
@@ -130,7 +131,7 @@ function playerClientStarted(client) {
// ===========================================================================
function playerClientStopped(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
getPlayerData(client).customDisconnectReason = `Kicked - Client script verification failed.`;
disconnectPlayer(client);
}
@@ -138,7 +139,7 @@ function playerClientStopped(client) {
// ===========================================================================
function showSmallGameMessage(client, text, colour, duration, fontName = "Pricedown") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
sendNetworkEventToPlayer("agrp.smallGameMessage", client, text, colour, duration, fontName);
}
@@ -149,7 +150,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) {
// return false;
//}
- //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//sendNetworkEventToPlayer("agrp.ambience", client, true);
}
@@ -160,21 +161,21 @@ function disableCityAmbienceForPlayer(client, clearElements = false) {
// return false;
//}
- //logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//sendNetworkEventToPlayer("agrp.ambience", client, false, clearElements);
}
// ===========================================================================
function clearPlayerOwnedPeds(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.clearPeds", client);
}
// ===========================================================================
function updatePlayerSpawnedState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
getPlayerData(client).spawned = true;
sendNetworkEventToPlayer("agrp.spawned", client, state);
}
@@ -182,21 +183,21 @@ function updatePlayerSpawnedState(client, state) {
// ===========================================================================
function setPlayerControlState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
sendNetworkEventToPlayer("agrp.control", client, state, !state);
}
// ===========================================================================
function updatePlayerShowLogoState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
sendNetworkEventToPlayer("agrp.logo", client, state);
}
// ===========================================================================
function restorePlayerCamera(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
sendNetworkEventToPlayer("agrp.restoreCamera", client);
}
@@ -209,7 +210,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
// ===========================================================================
function syncPlayerProperties(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
sendNetworkEventToPlayer("agrp.syncElement", null, getPlayerPed(client).id);
}
@@ -217,7 +218,7 @@ function syncPlayerProperties(client) {
function updatePlayerSnowState(client) {
if (isSnowSupported(getGame())) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
sendNetworkEventToPlayer("agrp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
}
}
@@ -225,7 +226,7 @@ function updatePlayerSnowState(client) {
// ===========================================================================
function updatePlayerHotBar(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
let tempHotBarItems = [];
for (let i in getPlayerData(client).hotBarItems) {
let itemImage = "";
@@ -248,14 +249,14 @@ function updatePlayerHotBar(client) {
// ===========================================================================
function setPlayerWeaponDamageEnabled(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
sendNetworkEventToPlayer("agrp.weaponDamageEnabled", null, getPlayerName(client), state);
}
// ===========================================================================
function setPlayerWeaponDamageEvent(client, eventType) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
sendNetworkEventToPlayer("agrp.weaponDamageEvent", null, getPlayerName(client), eventType);
getPlayerData(client).weaponDamageEvent = eventType;
}
@@ -263,259 +264,259 @@ function setPlayerWeaponDamageEvent(client, eventType) {
// ===========================================================================
function sendJobRouteLocationToPlayer(client, position, colour) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showJobRouteLocation", client, position, colour);
}
// ===========================================================================
function showPlayerLoginSuccessGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.loginSuccess", client);
}
// ===========================================================================
function showPlayerLoginFailedGUI(client, errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.loginFailed", client, errorMessage);
}
// ===========================================================================
function showPlayerRegistrationSuccessGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.registrationSuccess", client);
}
// ===========================================================================
function showPlayerRegistrationFailedGUI(client, errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.registrationFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerGUIColours(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
}
// ===========================================================================
function sendPlayerGUIInit(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.guiInit", client);
}
// ===========================================================================
function showPlayerLoginGUI(client, errorMessage = "") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showLogin", client);
}
// ===========================================================================
function showPlayerRegistrationGUI(client, errorMessage = "") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showRegistration", client);
}
// ===========================================================================
function showPlayerNewCharacterGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showNewCharacter", client);
}
// ===========================================================================
function showPlayerChangePasswordGUI(client, errorMessage = "") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showChangePassword", client, errorMessage);
}
// ===========================================================================
function showPlayerResetPasswordCodeInputGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showResetPasswordCodeInput", client);
}
// ===========================================================================
function showPlayerResetPasswordEmailInputGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showResetPasswordEmailInput", client);
}
// ===========================================================================
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function showPlayerCharacterSelectSuccessGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.characterSelectSuccess", client);
}
// ===========================================================================
function showPlayerCharacterSelectFailedGUI(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.characterSelectFailed", client);
}
// ===========================================================================
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
sendNetworkEventToPlayer("agrp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
}
// ===========================================================================
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
sendNetworkEventToPlayer("agrp.showInfo", client, infoMessage, infoTitle, buttonText);
}
// ===========================================================================
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
sendNetworkEventToPlayer("agrp.showError", client, errorMessage, errorTitle, buttonText);
}
// ===========================================================================
function sendRunCodeToClient(client, code, returnTo) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
sendNetworkEventToPlayer("agrp.runCode", client, code, getPlayerId(returnTo));
}
// ===========================================================================
function sendPlayerWorkingState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.working", client, state);
}
// ===========================================================================
function sendPlayerJobType(client, jobType) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.jobType", client, jobType);
}
// ===========================================================================
function sendPlayerStopJobRoute(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.hideJobRouteLocation", client);
}
// ===========================================================================
function sendPlayerMouseCameraToggle(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.mouseCamera", client);
}
// ===========================================================================
function setPlayerMouseCameraState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.mouseCameraForce", client, state);
}
// ===========================================================================
function sendPlayerMouseCursorToggle(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.mouseCursor", client);
}
// ===========================================================================
function sendAddAccountKeyBindToClient(client, key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
sendNetworkEventToPlayer("agrp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
}
// ===========================================================================
function sendClearKeyBindsToClient(client, key, keyState) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
sendNetworkEventToPlayer("agrp.clearKeyBinds", client);
}
// ===========================================================================
function sendRemoveAccountKeyBindToClient(client, key) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
sendNetworkEventToPlayer("agrp.delKeyBind", client, toInteger(key));
}
// ===========================================================================
function sendPlayerSetPosition(client, position) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
sendNetworkEventToPlayer("agrp.position", client, position);
}
// ===========================================================================
function sendPlayerSetHeading(client, heading) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
sendNetworkEventToPlayer("agrp.heading", client, heading);
}
// ===========================================================================
function sendPlayerSetInterior(client, interior) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
sendNetworkEventToPlayer("agrp.interior", client, interior);
}
// ===========================================================================
function sendPlayerFrozenState(client, state) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
sendNetworkEventToPlayer("agrp.frozen", client, state);
}
// ===========================================================================
function clearPlayerWeapons(client, clearData = true) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
sendNetworkEventToPlayer("agrp.clearWeapons", client, clearData);
}
// ===========================================================================
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.newCharacterFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerRemoveFromVehicle(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.removeFromVehicle", client);
}
@@ -533,10 +534,10 @@ function showPlayerItemTakeDelay(client, itemId) {
if (getItemData(itemId)) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if (delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
}
@@ -548,10 +549,10 @@ function showPlayerItemUseDelay(client, itemSlot) {
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
if (delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
}
@@ -563,10 +564,10 @@ function showPlayerItemDropDelay(client, itemSlot) {
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
if (delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
}
@@ -578,10 +579,10 @@ function showPlayerItemPickupDelay(client, itemId) {
if (getItemData(itemId)) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if (delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
}
@@ -593,10 +594,10 @@ function showPlayerItemPutDelay(client, itemSlot) {
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
if (delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
}
@@ -609,18 +610,18 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
if (delay > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
}
} else {
- logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerSwitchItem(client, itemSlot);
}
}
@@ -628,14 +629,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
// ===========================================================================
function sendPlayerDrunkEffect(client, amount, duration) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
sendNetworkEventToPlayer("agrp.drunkEffect", client, amount, duration);
}
// ===========================================================================
function sendPlayerClearPedState(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("agrp.clearPedState", client);
}
@@ -645,29 +646,29 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
let damagerEntity = getPlayerFromParams(damagerEntityName);
if (isNull(damagerEntity)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
if (isNull(damagerEntity)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
return false;
}
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
switch (getPlayerData(damagerEntity).weaponDamageEvent) {
case AGRP_WEAPON_DAMAGE_EVENT_TAZER:
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
tazePlayer(client);
}
@@ -680,10 +681,10 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
break;
case AGRP_WEAPON_DAMAGE_EVENT_NORMAL:
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
if (getPlayerArmour(client) > 0) {
- //logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
if (getPlayerArmour(client) - remainingDamage < 0) {
setPlayerArmour(client, 0);
remainingDamage = remainingDamage - getPlayerArmour(client);
@@ -695,7 +696,7 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
break;
default:
- logToConsole(LOG_DEBUG, `[VRR.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier));
break;
}
@@ -955,21 +956,21 @@ function sendPlayerChatAutoHideDelay(client, delay) {
// ===========================================================================
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
sendNetworkEventToPlayer("agrp.radioStream", client, streamURL, loop, volume, element);
}
// ===========================================================================
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
sendNetworkEventToPlayer("agrp.audioFileStream", client, audioName, loop, volume);
}
// ===========================================================================
function stopRadioStreamForPlayer(client) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
sendNetworkEventToPlayer("agrp.stopRadioStream", client);
}
@@ -1096,14 +1097,14 @@ function setPlayerInfiniteRun(client, state) {
// ==========================================================================
-function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
+function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) {
+ sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems);
}
// ==========================================================================
-function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) {
- sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
+function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior) {
+ sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior);
}
// ==========================================================================
@@ -1123,7 +1124,7 @@ function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour
function sendAllBusinessesToPlayer(client) {
let businesses = getServerData().businesses;
for (let i in businesses) {
- sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false);
+ sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].buyPrice, businesses[i].rentPrice, businesses[i].hasInterior, doesBusinessHaveAnyItemsToBuy(i));
}
}
@@ -1132,7 +1133,7 @@ function sendAllBusinessesToPlayer(client) {
function sendAllHousesToPlayer(client) {
let houses = getServerData().houses;
for (let i in houses) {
- sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior);
+ sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior);
}
}
@@ -1287,4 +1288,11 @@ function sendMapChangeWarningToPlayer(client, changingToNight) {
sendNetworkEventToPlayer("agrp.mapChangingSoon", client, changingToNight);
}
+// ==========================================================================
+
+function playerMapLoaded(client, mapName) {
+
+ //updateAllInteriorVehiclesForPlayer(client, propertyData.exitInterior, propertyData.exitDimension);
+}
+
// ==========================================================================
\ No newline at end of file
From 410f9f5a53c474908bd52cfea1098b3329c1553a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:25:03 -0500
Subject: [PATCH 069/311] Check if in paintball when start/stop
---
scripts/server/paintball.js | 40 ++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/scripts/server/paintball.js b/scripts/server/paintball.js
index 80e58f8a..41fdf17b 100644
--- a/scripts/server/paintball.js
+++ b/scripts/server/paintball.js
@@ -50,14 +50,18 @@ let paintBallItemNames = {
// ===========================================================================
function initPaintBallScript() {
- logToConsole(LOG_DEBUG, "[VRR.PaintBall]: Initializing paintball script ...");
- logToConsole(LOG_DEBUG, "[VRR.PaintBall]: Paintball script initialized successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.PaintBall]: Initializing paintball script ...");
+ logToConsole(LOG_DEBUG, "[AGRP.PaintBall]: Paintball script initialized successfully!");
}
// ===========================================================================
function startPaintBall(client) {
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
+ if (isPlayerInPaintBall(client)) {
+ return false;
+ }
+
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
if (isPlayerWorking(client)) {
stopWorking(client);
}
@@ -69,23 +73,31 @@ function startPaintBall(client) {
getPlayerData(client).paintBallBusiness = getPlayerBusiness(client);
givePlayerPaintBallItems(client);
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
+
+ messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
}
// ===========================================================================
function stopPaintBall(client) {
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
+ if (!isPlayerInPaintBall(client)) {
+ return false;
+ }
+
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
clearPlayerWeapons(client);
deletePaintBallItems(client);
restorePlayerTempLockerItems(client);
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
+
+ messagePlayerAlert(client, getLocaleString(client, "LeftPaintBall"));
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
}
// ===========================================================================
function givePlayerPaintBallItems(client) {
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
for (let i in paintBallItems) {
let itemId = createItem(paintBallItems[i], 999999, AGRP_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
getItemData(itemId).needsSaved = false;
@@ -95,26 +107,26 @@ function givePlayerPaintBallItems(client) {
getPlayerData(client).paintBallItemCache.push(itemId);
updatePlayerHotBar(client);
}
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
}
// ===========================================================================
function deletePaintBallItems(client) {
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
for (let i in getPlayerData(client).paintBallItemCache) {
deleteItem(getPlayerData(client).paintBallItemCache[i]);
}
cachePlayerHotBarItems(client);
updatePlayerHotBar(client);
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
}
// ===========================================================================
function cacheAllPaintBallItemTypes() {
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Cacheing all paintball item types ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cacheing all paintball item types ...`);
for (let i in paintBallItemNames[getGame()]) {
let itemTypeId = getItemTypeFromParams(paintBallItemNames[getGame()][i]);
if (itemTypeId != -1 && getItemTypeData(itemTypeId) != false) {
@@ -122,13 +134,13 @@ function cacheAllPaintBallItemTypes() {
}
}
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Cached all paintball item types`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cached all paintball item types`);
}
// ===========================================================================
function respawnPlayerForPaintBall(client) {
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
despawnPlayer(client);
let businessId = getPlayerData(client).paintBallBusiness;
@@ -143,7 +155,7 @@ function respawnPlayerForPaintBall(client) {
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
resetPlayerBlip(client);
- logToConsole(LOG_DEBUG, `[VRR.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
}
// ===========================================================================
From dbc84950cb5d76b28f90cac9776d8a4702865467 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:25:27 -0500
Subject: [PATCH 070/311] Send house/biz to client in Mafia 1
---
scripts/server/business.js | 51 +++++++++++++++++++-------------------
scripts/server/house.js | 29 +++++++++++-----------
2 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index cd12571a..3bdfbcd4 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 = [];
@@ -186,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;
}
@@ -212,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();
@@ -228,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);
@@ -236,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();
@@ -259,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);
@@ -267,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;
}
@@ -275,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();
@@ -291,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);
@@ -299,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;
}
*/
@@ -1559,7 +1560,7 @@ function orderItemForBusinessCommand(command, params, client) {
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
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(" ")} (${value})`);
if (!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
@@ -1899,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);
@@ -1955,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;
}
@@ -2033,9 +2034,9 @@ function createBusinessEntrancePickup(businessId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${businessData.name}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
- if (areServerElementsSupported()) {
+ if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
let entrancePickup = null;
if (isGameFeatureSupported("pickup")) {
let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
@@ -2073,7 +2074,7 @@ function createBusinessEntrancePickup(businessId) {
if (businessData.entrancePickupModel != 0) {
pickupModelId = businessData.entrancePickupModel;
}
- sendBusinessToPlayer(null, businessId, businessData.name, businessData.entrancePosition, blipModelId, pickupModelId, businessData.hasInterior, doesBusinessHaveAnyItemsToBuy(businessId));
+ sendBusinessToPlayer(null, businessId, businessData.name, businessData.entrancePosition, blipModelId, pickupModelId, businessData.hasInterior, businessData.buyPrice, businessData.rentPrice, doesBusinessHaveAnyItemsToBuy(businessId));
}
return false;
@@ -2117,7 +2118,7 @@ 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()) {
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
@@ -2169,7 +2170,7 @@ function createBusinessExitPickup(businessId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${businessData.name}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
let exitPickup = null;
if (isGameFeatureSupported("pickup")) {
@@ -2243,7 +2244,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) {
@@ -2849,11 +2850,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!");
}
// ===========================================================================
@@ -2864,11 +2865,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);
@@ -2877,7 +2878,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})!`);
}
// ===========================================================================
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 4c3a2fd7..7686eed3 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -42,6 +42,7 @@ class HouseData {
this.index = -1;
this.needsSaved = false;
this.interiorLights = true;
+ this.propertyType = AGRP_PROPERTY_TYPE_HOUSE;
this.itemCache = [];
this.locations = [];
@@ -167,15 +168,15 @@ class HouseGameScriptData {
// ===========================================================================
function initHouseScript() {
- logToConsole(LOG_INFO, "[VRR.House]: Initializing house script ...");
- logToConsole(LOG_INFO, "[VRR.House]: House script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.House]: Initializing house script ...");
+ logToConsole(LOG_INFO, "[AGRP.House]: House script initialized successfully!");
return true;
}
// ===========================================================================
function loadHousesFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.House]: Loading houses from database ...");
+ logToConsole(LOG_INFO, "[AGRP.House]: Loading houses from database ...");
let tempHouses = [];
let dbConnection = connectToDatabase();
let dbAssoc;
@@ -187,14 +188,14 @@ function loadHousesFromDatabase() {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempHouseData = new HouseData(dbAssoc);
tempHouses.push(tempHouseData);
- logToConsole(LOG_VERBOSE, `[VRR.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
}
}
freeDatabaseQuery(dbQuery);
}
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.House]: ${tempHouses.length} houses loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.House]: ${tempHouses.length} houses loaded from database successfully!`);
return tempHouses;
}
@@ -878,9 +879,9 @@ function getPlayerHouse(client) {
// ===========================================================================
function saveAllHousesToDatabase() {
- logToConsole(LOG_DEBUG, `[VRR.House]: Saving all server houses to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.House]: Saving all server houses to database ...`);
if (getServerConfig().devServer) {
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.House]: Aborting save all houses to database, dev server is enabled.`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.House]: Aborting save all houses to database, dev server is enabled.`);
return false;
}
@@ -889,7 +890,7 @@ function saveAllHousesToDatabase() {
saveHouseToDatabase(i);
}
}
- logToConsole(LOG_INFO, `[VRR.House]: Saved all server houses to database`);
+ logToConsole(LOG_INFO, `[AGRP.House]: Saved all server houses to database`);
}
// ===========================================================================
@@ -901,7 +902,7 @@ function saveHouseToDatabase(houseId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.House]: Saving house '${tempHouseData.description}' to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house '${tempHouseData.description}' to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
@@ -955,7 +956,7 @@ function saveHouseToDatabase(houseId) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_VERBOSE, `[VRR.House]: Saved house '${tempHouseData.description}' to database!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved house '${tempHouseData.description}' to database!`);
return false;
}
@@ -969,7 +970,7 @@ function saveHouseLocationToDatabase(houseId, locationId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let data = [
@@ -1010,7 +1011,7 @@ function saveHouseLocationToDatabase(houseId, locationId) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_VERBOSE, `[VRR.House]: Saved location ${locationId} for house ${houseId} to database`);
+ logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved location ${locationId} for house ${houseId} to database`);
return false;
}
@@ -1054,7 +1055,7 @@ function createHouseEntrancePickup(houseId) {
return false;
}
- if (areServerElementsSupported()) {
+ if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
let entrancePickup = null;
if (isGameFeatureSupported("pickup")) {
let pickupModelId = getGameConfig().pickupModels[getGame()].House;
@@ -1084,7 +1085,7 @@ function createHouseEntrancePickup(houseId) {
if (houseData.entrancePickupModel != 0) {
pickupModelId = houseData.entrancePickupModel;
}
- sendHouseToPlayer(null, houseId, houseId.description, houseId.entrancePosition, blipModelId, pickupModelId, houseId.hasInterior);
+ sendHouseToPlayer(null, houseId, houseId.description, houseId.entrancePosition, blipModelId, pickupModelId, houseData.buyPrice, houseData.rentPrice, houseId.hasInterior);
}
}
From f3b7a29f1013053b438fa8e140d2fd8fc3e22677 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:25:47 -0500
Subject: [PATCH 071/311] Check if GUI ready before some stuff
---
scripts/client/gui.js | 44 +++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 2bbf4dd5..1168c2d5 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();
@@ -66,7 +66,7 @@ function initGUI() {
closeAllWindows();
guiReady = true;
- logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] All GUI created successfully!`);
loadLocaleConfig();
@@ -76,7 +76,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;
@@ -163,7 +163,7 @@ function isAnyGUIActive() {
// ===========================================================================
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 +183,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 +238,10 @@ function processToggleGUIKeyPress(keyCode) {
// ===========================================================================
function resetGUIStrings() {
+ if (!guiReady) {
+ return false;
+ }
+
// Login GUI
login.messageLabel.text = getLocaleString("GUILoginWindowLabelEnterPassword");
login.passwordInput.placeholder = getLocaleString("GUILoginWindowPasswordPlaceholder");
From b81a3db9ffd7f3ed3b4fc8c07853a9059446e410 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:26:12 -0500
Subject: [PATCH 072/311] Fix client house/biz stuff
---
scripts/client/business.js | 36 +++++++++++++++++++++++++-----------
scripts/client/house.js | 36 +++++++++++++++++++++++++-----------
2 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/scripts/client/business.js b/scripts/client/business.js
index 49fb1911..ac882f34 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -17,6 +17,8 @@ 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;
@@ -25,10 +27,10 @@ class BusinessData {
// ===========================================================================
-function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
- logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
+function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) {
+ logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
- if (!areServerElementsSupported()) {
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (getBusinessData(businessId) != false) {
let businessData = getBusinessData(businessId);
businessData.name = name;
@@ -36,12 +38,24 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
businessData.blipModel = blipModel;
businessData.pickupModel = pickupModel;
businessData.hasInterior = hasInterior;
+ businessData.buyPrice = buyPrice;
+ businessData.rentPrice = rentPrice;
businessData.hasItems = hasItems;
- 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 +65,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 +82,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/house.js b/scripts/client/house.js
index 26a7df8c..ef809fdb 100644
--- a/scripts/client/house.js
+++ b/scripts/client/house.js
@@ -17,16 +17,18 @@ class HouseData {
this.blipModel = blipModel;
this.pickupModel = pickupModel;
this.hasInterior = hasInterior;
+ this.rentPrice = 0;
+ this.buyPrice = 0;
this.blipId = -1;
}
}
// ===========================================================================
-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) {
+ 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 +36,23 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
houseData.blipModel = blipModel;
houseData.pickupModel = pickupModel;
houseData.hasInterior = hasInterior;
+ houseData.buyPrice = buyPrice;
+ houseData.rentPrice = rentPrice;
- 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 +60,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 +77,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();
From b9c5e2b949e10ebd50fe2deff259a54d7c921215 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:26:34 -0500
Subject: [PATCH 073/311] Fix label rendering for client house/biz
---
scripts/client/label.js | 89 ++++++++++++++++++++++++-----------------
1 file changed, 52 insertions(+), 37 deletions(-)
diff --git a/scripts/client/label.js b/scripts/client/label.js
index 8c1c8884..df01f09a 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, getCurrencyString(business.buyPrice), getCurrencyString(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, getCurrencyString(house.buyPrice), getCurrencyString(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 = getCurrencyString(pickups[i].getData("agrp.label.price"));
}
if (pickups[i].getData("agrp.label.rentprice") != null) {
- rentPrice = makeLargeNumberReadable(pickups[i].getData("agrp.label.rentprice"));
+ rentPrice = getCurrencyString(pickups[i].getData("agrp.label.rentprice"));
}
if (pickups[i].getData("agrp.label.help") != null) {
From 6ed7cd9bc6623242106a6db1985595b960b2c5f3 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:26:47 -0500
Subject: [PATCH 074/311] Formatting
---
scripts/client/main.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/client/main.js b/scripts/client/main.js
index 382d5208..3d38679f 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -97,4 +97,6 @@ let localPlayerMoneyInterval = null;
let currencyString = "${AMOUNT}";
+
+
// ===========================================================================
From 655a784d272cd4879c82d3359784bfd24ce29861 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:27:25 -0500
Subject: [PATCH 075/311] Use new AGRP prefix on console msg
---
scripts/client/afk.js | 4 +-
scripts/client/animation.js | 2 +-
scripts/client/chat.js | 12 +--
scripts/client/event.js | 25 ++++--
scripts/client/gps.js | 2 +-
scripts/client/gui/2fa.js | 12 +--
scripts/client/gui/changepass.js | 12 +--
scripts/client/gui/charselect.js | 18 ++--
scripts/client/gui/error.js | 8 +-
scripts/client/gui/games/blackjack.js | 4 +-
scripts/client/gui/info.js | 8 +-
scripts/client/gui/list.js | 6 +-
scripts/client/gui/localechooser.js | 14 ++--
scripts/client/gui/login.js | 14 ++--
scripts/client/gui/newchar.js | 10 +--
scripts/client/gui/register.js | 12 +--
scripts/client/gui/resetpass.js | 14 ++--
scripts/client/gui/yesno.js | 10 +--
scripts/client/item.js | 10 +--
scripts/client/job.js | 32 ++++----
scripts/client/keybind.js | 14 ++--
scripts/client/locale.js | 11 +--
scripts/client/logo.js | 6 +-
scripts/client/messaging.js | 10 +--
scripts/client/nametag.js | 4 +-
scripts/client/netevents.js | 16 ++--
scripts/client/scoreboard.js | 4 +-
scripts/client/skin-select.js | 4 +-
scripts/client/utilities.js | 48 +++++------
scripts/client/vehicle.js | 4 +-
scripts/server/account.js | 98 +++++++++++-----------
scripts/server/animation.js | 4 +-
scripts/server/anticheat.js | 4 +-
scripts/server/ban.js | 8 +-
scripts/server/bitflag.js | 4 +-
scripts/server/chat.js | 4 +-
scripts/server/clan.js | 28 +++----
scripts/server/client.js | 32 ++++----
scripts/server/command.js | 20 ++---
scripts/server/config.js | 54 ++++++------
scripts/server/database.js | 4 +-
scripts/server/developer.js | 4 +-
scripts/server/discord.js | 4 +-
scripts/server/economy.js | 4 +-
scripts/server/email.js | 4 +-
scripts/server/event.js | 113 +++++++++++++-------------
scripts/server/fishing.js | 4 +-
scripts/server/gate.js | 14 ++--
scripts/server/gui.js | 12 +--
scripts/server/help.js | 4 +-
scripts/server/item.js | 28 +++----
scripts/server/job.js | 112 ++++++++++++-------------
scripts/server/keybind.js | 10 +--
scripts/server/locale.js | 12 +--
scripts/server/messaging.js | 4 +-
scripts/server/native/connected.js | 30 +++----
scripts/server/native/ragemp.js | 26 +++---
scripts/server/npc.js | 32 ++++----
scripts/server/race.js | 4 +-
scripts/server/radio.js | 8 +-
scripts/server/staff.js | 4 +-
scripts/server/startup.js | 18 ++--
scripts/server/subaccount.js | 38 ++++-----
scripts/server/timers.js | 12 +--
scripts/server/trigger.js | 4 +-
scripts/server/vehicle.js | 28 +++----
66 files changed, 579 insertions(+), 564 deletions(-)
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..0864cfbd 100644
--- a/scripts/client/animation.js
+++ b/scripts/client/animation.js
@@ -16,7 +16,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/chat.js b/scripts/client/chat.js
index c5f107d8..360f26a1 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_DEBUG, "[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);
@@ -78,16 +78,16 @@ function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, se
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);
}
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 455dac4c..6f90bfd8 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,6 +41,10 @@ function addAllEventHandlers() {
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
}
}
+
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ addEventHandler("OnMapLoaded", onMapLoaded);
+ }
}
// ===========================================================================
@@ -79,6 +83,7 @@ function onResourceStop(event, resource) {
function onResourceReady(event, resource) {
if (resource == thisResource) {
+ loadLocaleConfig();
sendResourceReadySignalToServer();
}
}
@@ -141,7 +146,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();
}
@@ -154,7 +159,7 @@ 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);
if (localPlayer != null) {
@@ -175,7 +180,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
// ===========================================================================
function onPedExitingVehicle(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);
if (localPlayer != null) {
@@ -189,7 +194,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
// ===========================================================================
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);
@@ -213,7 +218,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) {
@@ -276,4 +281,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/2fa.js b/scripts/client/gui/2fa.js
index e72d09eb..0f26a31b 100644
--- a/scripts/client/gui/2fa.js
+++ b/scripts/client/gui/2fa.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/gui/changepass.js b/scripts/client/gui/changepass.js
index 23f09d15..2c9bb077 100644
--- a/scripts/client/gui/changepass.js
+++ b/scripts/client/gui/changepass.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/charselect.js b/scripts/client/gui/charselect.js
index 5f83562b..846fb409 100644
--- a/scripts/client/gui/charselect.js
+++ b/scripts/client/gui/charselect.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,14 +151,14 @@ 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}`;
@@ -179,35 +179,35 @@ 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}`;
@@ -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/error.js b/scripts/client/gui/error.js
index 65f67f76..0926736a 100644
--- a/scripts/client/gui/error.js
+++ b/scripts/client/gui/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/games/blackjack.js b/scripts/client/gui/games/blackjack.js
index c4bc9a5b..ee0e7ad3 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/info.js b/scripts/client/gui/info.js
index 3845de36..8be960d4 100644
--- a/scripts/client/gui/info.js
+++ b/scripts/client/gui/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/list.js b/scripts/client/gui/list.js
index bbf5f1b3..3d45d874 100644
--- a/scripts/client/gui/list.js
+++ b/scripts/client/gui/list.js
@@ -17,7 +17,7 @@ let listDialog = {
// ===========================================================================
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 +71,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 login window`);
setChatWindowEnabled(false);
mexui.setInput(true);
listDialog.window.shown = true;
diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js
index b80980b3..73436e86 100644
--- a/scripts/client/gui/localechooser.js
+++ b/scripts/client/gui/localechooser.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),
@@ -42,13 +42,13 @@ function initLocaleChooserGUI() {
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;
@@ -69,7 +69,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;
@@ -91,14 +91,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 +122,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..edc8cc5a 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),
@@ -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/newchar.js b/scripts/client/gui/newchar.js
index 6fbc75ed..c568bc8d 100644
--- a/scripts/client/gui/newchar.js
+++ b/scripts/client/gui/newchar.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/resetpass.js b/scripts/client/gui/resetpass.js
index 148f1b30..1cf9c59c 100644
--- a/scripts/client/gui/resetpass.js
+++ b/scripts/client/gui/resetpass.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/yesno.js b/scripts/client/gui/yesno.js
index 554fb094..26ceb89d 100644
--- a/scripts/client/gui/yesno.js
+++ b/scripts/client/gui/yesno.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/item.js b/scripts/client/item.js
index 750f2fca..30eb6fdb 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -11,14 +11,14 @@
let itemActionDelayDuration = 0;
let itemActionDelayStart = 0;
let itemActionDelayEnabled = false;
-let itemActionDelayPosition = toVector2(game.width / 2 - 100, game.height - 10);
-let itemActionDelaySize = toVector2(200, 5);
+let itemActionDelayPosition = toVector2(0, game.height - 10);
+let itemActionDelaySize = toVector2(game.width, 10);
// ===========================================================================
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/locale.js b/scripts/client/locale.js
index 38d502d9..bdeb29de 100644
--- a/scripts/client/locale.js
+++ b/scripts/client/locale.js
@@ -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 9cc8704e..6b512677 100644
--- a/scripts/client/logo.js
+++ b/scripts/client/logo.js
@@ -15,9 +15,9 @@ 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!");
}
// ===========================================================================
@@ -54,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/messaging.js b/scripts/client/messaging.js
index 4b614cb9..6cec4b3b 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!");
}
// ===========================================================================
@@ -64,10 +64,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 +78,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/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/netevents.js b/scripts/client/netevents.js
index 228606f1..b4baa247 100644
--- a/scripts/client/netevents.js
+++ b/scripts/client/netevents.js
@@ -9,14 +9,14 @@
// ===========================================================================
function initNetworkEventsScript() {
- logToConsole(LOG_DEBUG, "[VRR.NetEvents]: Initializing server script ...");
- logToConsole(LOG_DEBUG, "[VRR.NetEvents]: Server script initialized!");
+ 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
@@ -187,7 +187,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) {
@@ -212,7 +212,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) {
@@ -345,7 +345,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);
@@ -370,7 +370,9 @@ 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));
+ }
}
// ===========================================================================
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 055cb44f..4a14a93c 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -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!");
}
// ===========================================================================
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 3c97f782..3b2ff03a 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -9,14 +9,14 @@
// ===========================================================================
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) {
@@ -31,7 +31,7 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
function fadeLocalCamera(state, time) {
if (isFadeCameraSupported()) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time} seconds`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time} seconds`);
if (isFadeCameraSupported()) {
game.fadeCamera(state, time);
@@ -48,7 +48,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);
}
@@ -57,7 +57,7 @@ function restoreLocalCamera() {
// ===========================================================================
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);
}
@@ -66,15 +66,15 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
// ===========================================================================
function clearLocalPlayerOwnedPeds() {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Clearing all self-owned peds ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing all self-owned peds ...`);
clearSelfOwnedPeds();
- logToConsole(LOG_DEBUG, `[VRR.Utilities] All self-owned peds cleared`);
+ 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) {
@@ -134,7 +134,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);
@@ -155,7 +155,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;
@@ -173,7 +173,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);
}
@@ -186,7 +186,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;
}
@@ -195,7 +195,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;
@@ -224,7 +224,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);
@@ -241,7 +241,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);
}
@@ -250,7 +250,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();
}
@@ -264,7 +264,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;
@@ -314,7 +314,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);
}
@@ -322,28 +322,28 @@ 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;
}
@@ -464,7 +464,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;
@@ -605,7 +605,7 @@ function updateLocalPlayerMoney() {
// ===========================================================================
function setLocalPlayerMoney(amount) {
- logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting local player money`);
localPlayerMoney = amount;
updateLocalPlayerMoney();
}
diff --git a/scripts/client/vehicle.js b/scripts/client/vehicle.js
index 8d89e37d..d4067d2f 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);
diff --git a/scripts/server/account.js b/scripts/server/account.js
index d82661d6..b7d44d0f 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -195,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!");
}
// ===========================================================================
@@ -285,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)`);
}
}
}
@@ -324,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;
@@ -342,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);
}
@@ -378,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;
}
@@ -832,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) {
@@ -843,7 +843,7 @@ 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);
}
@@ -855,11 +855,11 @@ function loginSuccess(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;
}
@@ -870,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);
@@ -1072,7 +1072,7 @@ function checkLogin(client, password) {
}
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 {
@@ -1083,25 +1083,25 @@ function checkLogin(client, password) {
}
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.`);
+ 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.`);
+ 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.
@@ -1112,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.`);
+ 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.`);
+ 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.
@@ -1151,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)) {
@@ -1259,11 +1259,11 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
}, 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;
}
@@ -1394,11 +1394,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!");
}
// ===========================================================================
@@ -1412,7 +1412,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) {
@@ -1434,7 +1434,7 @@ 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;
}
@@ -1463,7 +1463,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();
@@ -1487,7 +1487,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);
@@ -1496,14 +1496,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();
@@ -1517,7 +1517,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);
@@ -1525,14 +1525,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();
@@ -1546,7 +1546,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);
@@ -1554,14 +1554,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();
@@ -1575,7 +1575,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);
@@ -1583,7 +1583,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;
}
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index 9fd6d192..8b704706 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!");
}
// ===========================================================================
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..10b337c8 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,7 +66,7 @@ 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);
@@ -98,7 +98,7 @@ 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);
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index fe81526a..194aa69e 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -270,7 +270,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);
@@ -284,7 +284,7 @@ function initBitFlagScript() {
serverBitFlags.npcTriggerResponseTypes = createBitFlagTable(serverBitFlagKeys.npcTriggerResponseTypeKeys);
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;
}
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index 19220075..d1d187c4 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;
}
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 6966d4b3..2fb309eb 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -155,14 +155,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;
@@ -195,17 +195,17 @@ function kickAllClients() {
// ===========================================================================
function initClient(client) {
- logToConsole(LOG_DEBUG, `[VRR.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
if (isConsole(client)) {
- logToConsole(LOG_DEBUG | LOG_ERROR, `[VRR.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
+ logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.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)`);
+ logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
return false;
}
@@ -213,25 +213,25 @@ function initClient(client) {
//setEntityData(client, "agrp.isInitialized", true, false);
- logToConsole(LOG_DEBUG, `[VRR.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
sendPlayerCurrencyString(client);
sendPlayerGUIColours(client);
sendPlayerGUIInit(client);
updatePlayerSnowState(client);
- //logToConsole(LOG_DEBUG, `[VRR.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
+ //logToConsole(LOG_DEBUG, `[AGRP.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 ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.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)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
- logToConsole(LOG_DEBUG, `[VRR.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
@@ -248,10 +248,10 @@ function initClient(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.`);
+ logToConsole(LOG_DEBUG, `[AGRP.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).`);
+ 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()) {
@@ -266,10 +266,10 @@ function initClient(client) {
} else {
sendPlayerLocaleId(client, 0);
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(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.`);
showPlayerRegistrationGUI(client);
} else {
- 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).`);
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
}
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
diff --git a/scripts/server/command.js b/scripts/server/command.js
index a9d9a784..26a2e50a 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!");
}
// ===========================================================================
@@ -704,7 +704,7 @@ function addAllCommandHandlers() {
let commands = getCommands();
for (let i in commands) {
for (let j in commands[i]) {
- logToConsole(LOG_DEBUG, `[VRR.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
addCommandHandler(commands[i][j].command, processPlayerCommand);
commandCount++;
}
@@ -713,7 +713,7 @@ function addAllCommandHandlers() {
removeCommandHandler("help");
addCommandHandler("help", helpCommand);
- logToConsole(LOG_INFO, `[VRR.Command] ${commandCount} command handlers added!`);
+ logToConsole(LOG_INFO, `[AGRP.Command] ${commandCount} command handlers added!`);
}
// ===========================================================================
@@ -881,7 +881,7 @@ function processPlayerCommand(command, params, client) {
}
if (!doesCommandExist(toLowerCase(command))) {
- logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
+ logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
let possibleCommand = getCommandFromParams(command);
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
@@ -893,7 +893,7 @@ function processPlayerCommand(command, params, client) {
}
if (!commandData.enabled) {
- logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
+ logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} is disabled!`);
messagePlayerError(client, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
return false;
@@ -901,7 +901,7 @@ function processPlayerCommand(command, params, client) {
if (doesCommandRequireLogin(toLowerCase(command))) {
if (!isPlayerLoggedIn(client)) {
- logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
+ logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
return false;
}
@@ -909,7 +909,7 @@ function processPlayerCommand(command, params, client) {
if (isClientFromDiscord(client)) {
if (!isCommandAllowedOnDiscord(command)) {
- logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
+ logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`);
return false;
}
@@ -917,13 +917,13 @@ function processPlayerCommand(command, params, client) {
if (!isConsole(client)) {
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
- logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
+ logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
return false;
}
}
- logToConsole(LOG_DEBUG, `[VRR.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
commandData.handlerFunction(toLowerCase(command), params, client);
}
diff --git a/scripts/server/config.js b/scripts/server/config.js
index d50642f3..beb0feb1 100644
--- a/scripts/server/config.js
+++ b/scripts/server/config.js
@@ -251,64 +251,64 @@ let globalConfig = {
// ===========================================================================
function initConfigScript() {
- logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
- logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
+ logToConsole(LOG_INFO, "[AGRP.Config]: Initializing config script ...");
+ logToConsole(LOG_INFO, "[AGRP.Config]: Config script initialized!");
}
// ===========================================================================
function loadGlobalConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading global configuration ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading global configuration ...");
try {
getGlobalConfig().database = loadDatabaseConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load global configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load global configuration. Error: ${error}`);
thisResource.stop();
}
try {
getGlobalConfig().economy = loadEconomyConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load economy configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load economy configuration. Error: ${error}`);
thisResource.stop();
}
try {
getGlobalConfig().locale = loadLocaleConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load locale configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load locale configuration. Error: ${error}`);
thisResource.stop();
}
try {
getGlobalConfig().accents = loadAccentConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load accent configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load accent configuration. Error: ${error}`);
thisResource.stop();
}
try {
getGlobalConfig().discord = loadDiscordConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load discord configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load discord configuration. Error: ${error}`);
thisResource.stop();
}
try {
getGlobalConfig().keyBind = loadKeyBindConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load keybind configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load keybind configuration. Error: ${error}`);
thisResource.stop();
}
try {
getGlobalConfig().email = loadEmailConfig();
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Failed to load email configuration. Error: ${error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load email configuration. Error: ${error}`);
thisResource.stop();
}
- logToConsole(LOG_DEBUG, "[VRR.Config] Loaded global configuration successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loaded global configuration successfully!");
}
// ===========================================================================
@@ -374,18 +374,18 @@ function loadServerConfigFromId(tempServerId) {
// ===========================================================================
function applyConfigToServer(tempServerConfig) {
- logToConsole(LOG_INFO, "[VRR.Config]: Applying server config ...");
- logToConsole(LOG_DEBUG, "[VRR.Config]: Server config applied successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Config]: Applying server config ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Config]: Server config applied successfully!");
updateServerGameTime();
//if (isTimeSupported()) {
- // logToConsole(LOG_DEBUG, `[VRR.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
+ // logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
// setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
//}
if (isWeatherSupported()) {
- logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting weather to ${tempServerConfig.weather}`);
game.forceWeather(tempServerConfig.weather);
}
@@ -395,7 +395,7 @@ function applyConfigToServer(tempServerConfig) {
// ===========================================================================
function saveServerConfigToDatabase() {
- logToConsole(LOG_DEBUG, `[VRR.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
if (getServerConfig().needsSaved) {
let dbConnection = connectToDatabase();
if (dbConnection) {
@@ -459,7 +459,7 @@ function saveServerConfigToDatabase() {
}
}
- logToConsole(LOG_DEBUG, `[VRR.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
}
// ===========================================================================
@@ -933,7 +933,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
*/
function reloadDatabaseConfigurationCommand(command, params, client) {
if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
- logToConsole(LOG_WARN, `[VRR.Database] Closing persistent database connection`);
+ logToConsole(LOG_WARN, `[AGRP.Database] Closing persistent database connection`);
persistentDatabaseConnection.close();
persistentDatabaseConnection = null;
}
@@ -981,7 +981,7 @@ function getServerIntroMusicURL() {
// ===========================================================================
function loadLocaleConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading locale configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading locale configuration");
let localeConfig = JSON.parse(loadTextFile(`config/locale.json`));
if (localeConfig != null) {
return localeConfig;
@@ -991,7 +991,7 @@ function loadLocaleConfig() {
// ===========================================================================
function loadEconomyConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading economy configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading economy configuration");
let economyConfig = JSON.parse(loadTextFile(`config/economy.json`));
if (economyConfig != null) {
return economyConfig;
@@ -1001,7 +1001,7 @@ function loadEconomyConfig() {
// ===========================================================================
function loadAccentConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading accents configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading accents configuration");
let accentConfig = JSON.parse(loadTextFile(`config/accents.json`));
if (accentConfig != null) {
return accentConfig;
@@ -1011,7 +1011,7 @@ function loadAccentConfig() {
// ===========================================================================
function loadDiscordConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading discord configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading discord configuration");
let discordConfig = JSON.parse(loadTextFile(`config/discord.json`));
if (discordConfig != null) {
return discordConfig;
@@ -1022,7 +1022,7 @@ function loadDiscordConfig() {
// ===========================================================================
function loadDatabaseConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading database configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading database configuration");
let databaseConfig = JSON.parse(loadTextFile("config/database.json"));
if (databaseConfig != null) {
return databaseConfig;
@@ -1033,7 +1033,7 @@ function loadDatabaseConfig() {
// ===========================================================================
function loadKeyBindConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading keybind configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading keybind configuration");
let keyBindConfig = JSON.parse(loadTextFile("config/keybind.json"));
if (keyBindConfig != null) {
return keyBindConfig;
@@ -1044,7 +1044,7 @@ function loadKeyBindConfig() {
// ===========================================================================
function loadEmailConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading email configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading email configuration");
let emailConfig = JSON.parse(loadTextFile("config/email.json"));
if (emailConfig != null) {
return emailConfig;
@@ -1127,7 +1127,7 @@ function getDatabaseConfig() {
// ===========================================================================
function loadServerConfig() {
- logToConsole(LOG_DEBUG, "[VRR.Config] Loading server configuration");
+ logToConsole(LOG_DEBUG, "[AGRP.Config] Loading server configuration");
try {
if (toInteger(server.getCVar("agrp_devserver")) == 1) {
serverConfig = loadServerConfigFromGame(getGame());
@@ -1136,7 +1136,7 @@ function loadServerConfig() {
}
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
+ logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
thisResource.stop();
}
diff --git a/scripts/server/database.js b/scripts/server/database.js
index b3f835f3..9b882077 100644
--- a/scripts/server/database.js
+++ b/scripts/server/database.js
@@ -15,8 +15,8 @@ let persistentDatabaseConnection = null;
// ===========================================================================
function initDatabaseScript() {
- logToConsole(LOG_INFO, "[VRR.Database]: Initializing database script ...");
- logToConsole(LOG_INFO, "[VRR.Database]: Database script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Database]: Initializing database script ...");
+ logToConsole(LOG_INFO, "[AGRP.Database]: Database script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/developer.js b/scripts/server/developer.js
index ff7ef1f6..a9c6c91e 100644
--- a/scripts/server/developer.js
+++ b/scripts/server/developer.js
@@ -9,7 +9,7 @@
// ===========================================================================
function initDeveloperScript() {
- logToConsole(LOG_INFO, "[VRR.Developer]: Initializing developer script ...");
+ logToConsole(LOG_INFO, "[AGRP.Developer]: Initializing developer script ...");
// Use GTAC command handlers for these since they need to be available on console
//addCommandHandler("sc", executeServerCodeCommand);
@@ -18,7 +18,7 @@ function initDeveloperScript() {
//addCommandHandler("allcmd", simulateCommandForAllPlayersCommand);
//addCommandHandler("addloglvl", setServerLogLevelCommand);
- logToConsole(LOG_INFO, "[VRR.Developer]: Developer script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Developer]: Developer script initialized successfully!");
return true;
}
diff --git a/scripts/server/discord.js b/scripts/server/discord.js
index 7e7d6a7f..ea801bd0 100644
--- a/scripts/server/discord.js
+++ b/scripts/server/discord.js
@@ -16,8 +16,8 @@ const AGRP_DISCORD_WEBHOOK_ADMIN = 2;
// ===========================================================================
function initDiscordScript() {
- logToConsole(LOG_INFO, "[VRR.Discord]: Initializing discord script ...");
- logToConsole(LOG_INFO, "[VRR.Discord]: Discord script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Discord]: Initializing discord script ...");
+ logToConsole(LOG_INFO, "[AGRP.Discord]: Discord script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/economy.js b/scripts/server/economy.js
index 13416c87..c7b573a4 100644
--- a/scripts/server/economy.js
+++ b/scripts/server/economy.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initEconomyScript() {
- logToConsole(LOG_INFO, "[VRR.Economy]: Initializing economy script ...");
- logToConsole(LOG_INFO, "[VRR.Economy]: Economy script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Economy]: Initializing economy script ...");
+ logToConsole(LOG_INFO, "[AGRP.Economy]: Economy script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/email.js b/scripts/server/email.js
index 95d8a7c9..776e9d53 100644
--- a/scripts/server/email.js
+++ b/scripts/server/email.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initEmailScript() {
- logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
- logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Email]: Initializing email script ...");
+ logToConsole(LOG_INFO, "[AGRP.Email]: Email script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/event.js b/scripts/server/event.js
index cc4b6f4f..c7602a22 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -9,9 +9,9 @@
// ===========================================================================
function initEventScript() {
- logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
+ logToConsole(LOG_INFO, "[AGRP.Event]: Initializing event script ...");
addAllEventHandlers();
- logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
+ logToConsole(LOG_INFO, "[AGRP.Event]: Event script initialized!");
}
// ===========================================================================
@@ -28,17 +28,17 @@ function addAllEventHandlers() {
addEventHandler("onElementStreamIn", onElementStreamIn);
addEventHandler("onElementStreamOut", onElementStreamOut);
addEventHandler("onPedSpawn", onPedSpawn);
+ addEventHandler("OnPickupPickedUp", onPedPickupPickedUp);
addEventHandler("onPedEnteredVehicleEx", onPedEnteredVehicle);
addEventHandler("onPedExitedVehicleEx", onPedExitedVehicle);
addEventHandler("onPedEnteredSphereEx", onPedEnteredSphere);
addEventHandler("onPedExitedSphereEx", onPedExitedSphere);
- addEventHandler("OnPickupPickedUp", onPedPickupPickedUp);
}
// ===========================================================================
function onPlayerConnect(event, ipAddress, port) {
- logToConsole(LOG_INFO, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
+ logToConsole(LOG_INFO, `[AGRP.Event] Client connecting (IP: ${ipAddress})`);
//if(isIpAddressBanned(ipAddress)) {
// messagePlayerError(client, "You are banned from this server!");
// return false;
@@ -48,7 +48,7 @@ function onPlayerConnect(event, ipAddress, port) {
// ===========================================================================
function onPlayerJoin(event, client) {
- logToConsole(LOG_INFO, `[VRR.Event] Client ${getPlayerName(client)}[${getPlayerId(client)}] joining from ${getPlayerIP(client)}`);
+ logToConsole(LOG_INFO, `[AGRP.Event] Client ${getPlayerName(client)}[${getPlayerId(client)}] joining from ${getPlayerIP(client)}`);
//if (isFadeCameraSupported()) {
// fadeCamera(client, true, 1.0);
@@ -226,7 +226,7 @@ function onPedExitingVehicle(event, ped, vehicle) {
// ===========================================================================
function onResourceStart(event, resource) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Resource ${resource.name} started!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`);
//if(resource != thisResource) {
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
@@ -236,7 +236,7 @@ function onResourceStart(event, resource) {
// ===========================================================================
function onResourceStop(event, resource) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Resource ${resource.name} stopped!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} stopped!`);
//if(resource != thisResource) {
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} stopped!`);
@@ -253,7 +253,7 @@ function onResourceStop(event, resource) {
// ===========================================================================
function onPedEnteredSphere(event, ped, sphere) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
@@ -269,7 +269,7 @@ function onPedEnteredSphere(event, ped, sphere) {
// ===========================================================================
function onPedExitedSphere(event, ped, sphere) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
//if (ped.isType(ELEMENT_PLAYER)) {
// let client = getClientFromPlayerElement(ped);
//}
@@ -278,7 +278,7 @@ function onPedExitedSphere(event, ped, sphere) {
// ===========================================================================
function onPedPickupPickedUp(event, ped, pickup) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
@@ -294,7 +294,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
// ===========================================================================
function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let killerClient = null;
@@ -308,7 +308,7 @@ function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
// ===========================================================================
function onPlayerDeath(client, killer, weapon, pedPiece) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
getPlayerData(client).pedState = AGRP_PEDSTATE_DEAD;
@@ -401,7 +401,7 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
// ===========================================================================
function onPedSpawn(ped) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} spawned!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} spawned!`);
if (ped.type == ELEMENT_PLAYER) {
if (getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
@@ -414,66 +414,66 @@ function onPedSpawn(ped) {
// ===========================================================================
async function onPlayerSpawn(client) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
- //logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
//if(getPlayerPed(client) == null) {
- // logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
+ // logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
// setTimeout(onPlayerSpawn, 500, client);
// return false;
//}
- //logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
if (areServerElementsSupported()) {
await waitUntil(() => client != null && getPlayerPed(client) != null);
}
- //logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
if (!getPlayerData(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
getPlayerData(targetClient).customDisconnectReason = `Kicked - Spawn bug. Data invalid.`;
disconnectPlayer(client);
return false;
}
- //logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
if (!isPlayerLoggedIn(client)) {
- logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
getPlayerData(targetClient).customDisconnectReason = `Kicked - Tried to force spawn without logging in.`;
disconnectPlayer(client);
return false;
}
- //logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
if (getPlayerData(client).currentSubAccount == -1) {
- logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
getPlayerData(targetClient).customDisconnectReason = `Kicked - Tried to force spawn without selecting a character.`;
disconnectPlayer(client);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
if (isGameFeatureSupported("pedScale")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
setEntityData(getPlayerPed(client), "agrp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
}
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
- // logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
+ // logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
// return false;
//}
if (isCustomCameraSupported() && getGame() != AGRP_GAME_GTA_IV && getGame() != AGRP_GAME_GTA_IV_EFLC) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
restorePlayerCamera(client);
}
if (areServerElementsSupported()) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
getPlayerData(client).ped = getPlayerPed(client);
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
@@ -487,65 +487,65 @@ async function onPlayerSpawn(client) {
//}
if (isGameFeatureSupported("interior")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
//}
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
if (isGameFeatureSupported("pedArmour")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
if (isGameFeatureSupported("rendering2D")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
setPlayer2DRendering(client, true, true, true, true, true, true);
}
if (isGameFeatureSupported("snow")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
updatePlayerSnowState(client);
}
if (areServerElementsSupported() && isGameFeatureSupported("walkStyle")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
setEntityData(getPlayerPed(client), "agrp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
}
if (isGameFeatureSupported("fightStyle")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
}
if (isGameFeatureSupported("rendering2D")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
updatePlayerShowLogoState(client, (getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)));
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
cachePlayerHotBarItems(client);
- logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
updatePlayerHotBar(client);
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
getPlayerData(client).switchingCharacter = false;
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
let keyId = getPlayerKeyBindForCommand(client, "enter");
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
sendPlayerEnterPropertyKey(client, keyId.key);
}
@@ -570,7 +570,7 @@ async function onPlayerSpawn(client) {
//sendPlayerPedPartsAndProps(client);
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
getPlayerData(client).pedState = AGRP_PEDSTATE_READY;
if (areServerElementsSupported()) {
@@ -580,15 +580,16 @@ async function onPlayerSpawn(client) {
//}, 1000);
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
updatePlayerCash(client);
if (isGameFeatureSupported("customNametag")) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
}
- if (!areServerElementsSupported()) {
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
sendAllBusinessesToPlayer(client);
sendAllHousesToPlayer(client);
//sendAllJobsToPlayer(client);
@@ -596,7 +597,7 @@ async function onPlayerSpawn(client) {
requestPlayerPedNetworkId(client);
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
updatePlayerSpawnedState(client, true);
getPlayerData(client).payDayTickStart = sdl.ticks;
@@ -604,7 +605,7 @@ async function onPlayerSpawn(client) {
// Locales are handled via resource files now. No need to send anymore, but kept in case revert is needed.
//sendPlayerLocaleStrings(client);
- logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
updateAllPlayerNameTags();
setPlayerWeaponDamageEvent(client, AGRP_WEAPON_DAMAGE_EVENT_NORMAL);
@@ -646,7 +647,7 @@ async function onPlayerSpawn(client) {
// ===========================================================================
function onPlayerCommand(event, client, command, params) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Player used command ${command}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player used command ${command}!`);
if (!doesCommandExist(command)) {
processPlayerCommand(command, params, client);
@@ -656,7 +657,7 @@ function onPlayerCommand(event, client, command, params) {
// ===========================================================================
function onPedExitedVehicle(event, ped, vehicle, seat) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
@@ -679,7 +680,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
- logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
}
}
}
@@ -687,7 +688,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
// ===========================================================================
function onPedEnteredVehicle(event, ped, vehicle, seat) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
@@ -704,7 +705,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
getPlayerData(client).lastVehicle = vehicle;
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
@@ -803,7 +804,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
// ===========================================================================
function onPedEnteringVehicle(event, ped, vehicle, seat) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
@@ -816,7 +817,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
// ===========================================================================
function onPedExitingVehicle(event, ped, vehicle, seat) {
- logToConsole(LOG_WARN | LOG_DEBUG, `[VRR.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
+ logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
diff --git a/scripts/server/fishing.js b/scripts/server/fishing.js
index 9212b4bd..6bafbd6d 100644
--- a/scripts/server/fishing.js
+++ b/scripts/server/fishing.js
@@ -87,8 +87,8 @@ let fishingParticleEffects = {
// ===========================================================================
function initFishingScript() {
- logToConsole(LOG_INFO, "[VRR.Fishing]: Initializing fishing script ...");
- logToConsole(LOG_INFO, "[VRR.Fishing]: Fishing script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Fishing]: Initializing fishing script ...");
+ logToConsole(LOG_INFO, "[AGRP.Fishing]: Fishing script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/gate.js b/scripts/server/gate.js
index 720133ab..38bd6e37 100644
--- a/scripts/server/gate.js
+++ b/scripts/server/gate.js
@@ -46,8 +46,8 @@ class GateData {
// ===========================================================================
function initGateScript() {
- logToConsole(LOG_INFO, `[VRR.Gate]: Initializing gate script ...`);
- logToConsole(LOG_INFO, `[VRR.Gate]: Gate script initialized successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Gate]: Initializing gate script ...`);
+ logToConsole(LOG_INFO, `[AGRP.Gate]: Gate script initialized successfully!`);
}
// ===========================================================================
@@ -194,7 +194,7 @@ function saveGateToDatabase(gateId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeGateName = escapeDatabaseString(tempGateData.name);
@@ -228,7 +228,7 @@ function saveGateToDatabase(gateId) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_VERBOSE, `[VRR.Gate]: Saved gate ${gateDataId} to database!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saved gate ${gateDataId} to database!`);
return true;
}
@@ -236,7 +236,7 @@ function saveGateToDatabase(gateId) {
// ===========================================================================
function loadGatesFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Gate]: Loading gates from database ...");
+ logToConsole(LOG_INFO, "[AGRP.Gate]: Loading gates from database ...");
let tempGates = [];
let dbConnection = connectToDatabase();
@@ -249,7 +249,7 @@ function loadGatesFromDatabase() {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempGateData = new GateData(dbAssoc);
tempGates.push(tempGateData);
- logToConsole(LOG_DEBUG, `[VRR.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -257,7 +257,7 @@ function loadGatesFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Gate]: ${tempGates.length} gates loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
return tempGates;
}
diff --git a/scripts/server/gui.js b/scripts/server/gui.js
index 44fe8283..10e24b3c 100644
--- a/scripts/server/gui.js
+++ b/scripts/server/gui.js
@@ -22,8 +22,8 @@ const AGRP_PROMPT_RESETKEYBINDS = 8;
// ===========================================================================
function initGUIScript() {
- logToConsole(LOG_INFO, "[VRR.GUI]: Initializing GUI script ...");
- logToConsole(LOG_INFO, "[VRR.GUI]: GUI script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.GUI]: Initializing GUI script ...");
+ logToConsole(LOG_INFO, "[AGRP.GUI]: GUI script initialized successfully!");
}
// ===========================================================================
@@ -33,7 +33,7 @@ function playerPromptAnswerNo(client) {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
switch (getPlayerData(client).promptType) {
case AGRP_PROMPT_CREATEFIRSTCHAR:
@@ -70,7 +70,7 @@ function playerPromptAnswerYes(client) {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
switch (getPlayerData(client).promptType) {
case AGRP_PROMPT_CREATEFIRSTCHAR: {
@@ -81,14 +81,14 @@ function playerPromptAnswerYes(client) {
case AGRP_PROMPT_BIZORDER: {
if (getPlayerData(client).businessOrderAmount > 0) {
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
- logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
getPlayerData(client).businessOrderAmount = 0;
getPlayerData(client).businessOrderBusiness = false;
getPlayerData(client).businessOrderItem = -1;
getPlayerData(client).businessOrderValue = -1;
} else {
- logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
+ logToConsole(LOG_DEBUG, `[AGRP.GUI] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
showPlayerInfoGUI(client, `You ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} (${getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue)}) for ${getPlayerData(client).businessOrderCost}!`, "Business Order Successful");
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, AGRP_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
diff --git a/scripts/server/help.js b/scripts/server/help.js
index c7dda1ea..194fc82e 100644
--- a/scripts/server/help.js
+++ b/scripts/server/help.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initHelpScript() {
- logToConsole(LOG_INFO, `[VRR.Help]: Initializing help script ...`);
- logToConsole(LOG_INFO, `[VRR.Help]: Help script initialized successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Help]: Initializing help script ...`);
+ logToConsole(LOG_INFO, `[AGRP.Help]: Help script initialized successfully!`);
}
// ===========================================================================
diff --git a/scripts/server/item.js b/scripts/server/item.js
index 2ef9f135..546f9266 100644
--- a/scripts/server/item.js
+++ b/scripts/server/item.js
@@ -281,15 +281,15 @@ let itemRecipes = [
// ===========================================================================
function initItemScript() {
- logToConsole(LOG_DEBUG, "[VRR.Item]: Initializing item script ...");
- logToConsole(LOG_INFO, "[VRR.Item]: Item script initialized successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.Item]: Initializing item script ...");
+ logToConsole(LOG_INFO, "[AGRP.Item]: Item script initialized successfully!");
return true;
}
// ===========================================================================
function loadItemsFromDatabase() {
- logToConsole(LOG_DEBUG, `[VRR.Item]: Loading items from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading items from database ...`);
let tempItems = [];
let dbConnection = connectToDatabase();
let dbFetchAssoc;
@@ -300,21 +300,21 @@ function loadItemsFromDatabase() {
while (dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
let tempItemData = new ItemData(dbFetchAssoc);
tempItems.push(tempItemData);
- logToConsole(LOG_VERBOSE, `[VRR.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
}
}
freeDatabaseQuery(dbQuery);
}
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Item]: Loaded ${tempItems.length} items from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItems.length} items from database ...`);
return tempItems;
}
// ===========================================================================
function loadItemTypesFromDatabase() {
- logToConsole(LOG_DEBUG, `[VRR.Item]: Loading item types from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading item types from database ...`);
let tempItemTypes = [];
let dbConnection = connectToDatabase();
let dbFetchAssoc;
@@ -325,7 +325,7 @@ function loadItemTypesFromDatabase() {
while (dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
let tempItemTypeData = new ItemTypeData(dbFetchAssoc);
tempItemTypes.push(tempItemTypeData);
- logToConsole(LOG_VERBOSE, `[VRR.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
}
}
freeDatabaseQuery(dbQuery);
@@ -333,7 +333,7 @@ function loadItemTypesFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
return tempItemTypes;
}
@@ -1297,7 +1297,7 @@ function playerUseItem(client, hotBarSlot) {
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
if (itemIndex == -1) {
- logToConsole(LOG_DEBUG | LOG_WARN, `[VRR.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
return false;
}
@@ -1311,7 +1311,7 @@ function playerUseItem(client, hotBarSlot) {
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
let hotBarItems = getPlayerData(client).hotBarItems;
- logToConsole(LOG_DEBUG, `[VRR.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
switch (toInteger(itemTypeData.useType)) {
case AGRP_ITEM_USE_TYPE_SKIN: {
@@ -1846,7 +1846,7 @@ function playerSwitchItem(client, newHotBarSlot) {
}
let currentHotBarSlot = getPlayerData(client).activeHotBarSlot;
- logToConsole(LOG_DEBUG, `[VRR.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
let currentHotBarItem = -1;
let newHotBarItem = -1;
@@ -2477,7 +2477,7 @@ function saveItemToDatabase(itemId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item '${itemData.index}' to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item '${itemData.index}' to database ...`);
let position = getItemPosition(itemId);
@@ -2534,7 +2534,7 @@ function saveItemTypeToDatabase(itemTypeId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item type '${itemTypeData.name}' to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
@@ -2666,7 +2666,7 @@ function getItemTypeIndexFromDatabaseId(databaseId) {
// ===========================================================================
function playerItemActionDelayComplete(client) {
- logToConsole(LOG_VERBOSE, `[VRR.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
switch (getPlayerData(client).itemActionState) {
case AGRP_ITEM_ACTION_USE:
playerUseItem(client, getPlayerData(client).itemActionItem);
diff --git a/scripts/server/job.js b/scripts/server/job.js
index a1d4ef6e..82eadb65 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -472,15 +472,15 @@ let jobRouteLocationTypeNames = {
// ===========================================================================
function initJobScript() {
- logToConsole(LOG_DEBUG, "[VRR.Job]: Initializing job script ...");
- logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.Job]: Initializing job script ...");
+ logToConsole(LOG_INFO, "[AGRP.Job]: Job script initialized successfully!");
return true;
}
// ===========================================================================
function loadJobsFromDatabase() {
- logToConsole(LOG_DEBUG, "[VRR.Job]: Loading jobs from database ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Job]: Loading jobs from database ...");
let tempJobs = [];
let dbConnection = connectToDatabase();
@@ -499,7 +499,7 @@ function loadJobsFromDatabase() {
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
tempJobData.ranks = loadJobRanksFromDatabase(tempJobData.databaseId);
tempJobs.push(tempJobData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -507,7 +507,7 @@ function loadJobsFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
return tempJobs;
}
@@ -546,7 +546,7 @@ function loadAllJobLocationsFromDatabase() {
// ===========================================================================
function loadJobRanksFromDatabase(jobDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
let tempJobRanks = [];
let dbConnection = connectToDatabase();
@@ -560,7 +560,7 @@ function loadJobRanksFromDatabase(jobDatabaseId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempJobRankData = new JobRankData(dbAssoc);
tempJobRanks.push(tempJobRankData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -568,14 +568,14 @@ function loadJobRanksFromDatabase(jobDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
return tempJobRanks;
}
// ===========================================================================
function loadJobRoutesFromDatabase(jobDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
let tempJobRoutes = [];
let dbConnection = connectToDatabase();
@@ -590,7 +590,7 @@ function loadJobRoutesFromDatabase(jobDatabaseId) {
let tempJobRouteData = new JobRouteData(dbAssoc);
tempJobRouteData.locations = loadJobRouteLocationsFromDatabase(tempJobRouteData.databaseId);
tempJobRoutes.push(tempJobRouteData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -598,14 +598,14 @@ function loadJobRoutesFromDatabase(jobDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
return tempJobRoutes;
}
// ===========================================================================
function loadJobRouteLocationsFromDatabase(jobRouteId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading locations for job route ${jobRouteId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
let tempJobRouteLocations = [];
let dbConnection = connectToDatabase();
@@ -619,7 +619,7 @@ function loadJobRouteLocationsFromDatabase(jobRouteId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempJobRouteLocationData = new JobRouteLocationData(dbAssoc);
tempJobRouteLocations.push(tempJobRouteLocationData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -627,14 +627,14 @@ function loadJobRouteLocationsFromDatabase(jobRouteId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
return tempJobRouteLocations;
}
// ===========================================================================
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
let tempJobEquipments = [];
let dbConnection = connectToDatabase();
@@ -649,7 +649,7 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
let tempJobEquipmentData = new JobEquipmentData(dbAssoc);
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
tempJobEquipments.push(tempJobEquipmentData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -657,14 +657,14 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
return tempJobEquipments;
}
// ===========================================================================
function loadJobLocationsFromDatabase(jobDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
let tempJobLocations = [];
let dbConnection = connectToDatabase();
@@ -678,7 +678,7 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempJobLocationData = new JobLocationData(dbAssoc);
tempJobLocations.push(tempJobLocationData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -686,14 +686,14 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
return tempJobLocations;
}
// ===========================================================================
function loadJobUniformsFromDatabase(jobDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
let tempJobUniforms = [];
let dbConnection = connectToDatabase();
@@ -707,7 +707,7 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempJobUniformData = new JobUniformData(dbAssoc);
tempJobUniforms.push(tempJobUniformData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -715,14 +715,14 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
return tempJobUniforms;
}
// ===========================================================================
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
let tempJobEquipmentItems = [];
let dbConnection = connectToDatabase();
@@ -736,7 +736,7 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc);
tempJobEquipmentItems.push(tempJobEquipmentItemData);
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
}
}
freeDatabaseQuery(dbQuery);
@@ -744,7 +744,7 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
return tempJobEquipmentItems;
}
@@ -755,13 +755,13 @@ function createAllJobBlips() {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job] Spawning all job location blips ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location blips ...`);
for (let i in getServerData().jobs) {
for (let j in getServerData().jobs[i].locations) {
createJobLocationBlip(i, j);
}
}
- logToConsole(LOG_DEBUG, `[VRR.Job] All job location blips spawned!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] All job location blips spawned!`);
}
// ===========================================================================
@@ -771,7 +771,7 @@ function createAllJobPickups() {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job] Spawning all job location pickups ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location pickups ...`);
let pickupCount = 0;
for (let i in getServerData().jobs) {
if (getServerData().jobs[i].pickupModel != 0) {
@@ -787,11 +787,11 @@ function createAllJobPickups() {
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
addToWorld(getServerData().jobs[i].locations[j].pickup);
- logToConsole(LOG_VERBOSE, `[VRR.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
}
}
}
- logToConsole(LOG_DEBUG, `[VRR.Job] All job location pickups (${pickupCount}) spawned!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job] All job location pickups (${pickupCount}) spawned!`);
}
// ===========================================================================
@@ -2672,11 +2672,11 @@ function saveJobToDatabase(jobData) {
}
if (jobData.needsSaved == false) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job ${jobData.name} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job ${jobData.name} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, jobData.name);
@@ -2713,7 +2713,7 @@ function saveJobToDatabase(jobData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job ${jobData.name} to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job ${jobData.name} to database!`);
return false;
}
@@ -2727,11 +2727,11 @@ function saveJobRankToDatabase(jobRankData) {
}
if (jobRankData.needsSaved == false) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job route ${jobRankData.name} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRankData.name} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, jobRankData.name);
@@ -2762,7 +2762,7 @@ function saveJobRankToDatabase(jobRankData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job rank ${jobRankData.name} to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job rank ${jobRankData.name} to database!`);
return false;
}
@@ -2776,11 +2776,11 @@ function saveJobRouteToDatabase(jobRouteData) {
}
if (jobRouteData.needsSaved == false) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job route ${jobRouteData.name} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRouteData.name} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, jobRouteData.name);
@@ -2821,7 +2821,7 @@ function saveJobRouteToDatabase(jobRouteData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job route ${jobRouteData.name} to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route ${jobRouteData.name} to database!`);
return false;
}
@@ -2835,11 +2835,11 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
}
if (jobRouteLocationData.needsSaved == false) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, jobRouteLocationData.name);
@@ -2871,7 +2871,7 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
return false;
}
@@ -2885,11 +2885,11 @@ function saveJobLocationToDatabase(jobLocationData) {
}
if (!jobLocationData.needsSaved) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let data = [
@@ -2920,7 +2920,7 @@ function saveJobLocationToDatabase(jobLocationData) {
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job location ${jobLocationData.databaseId} to database`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
return false;
}
@@ -2934,11 +2934,11 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
}
if (!jobEquipmentData.needsSaved) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, jobEquipmentData.name);
@@ -2966,7 +2966,7 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
return false;
}
@@ -2980,11 +2980,11 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
}
if (!jobEquipmentItemData.needsSaved) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let data = [
@@ -3011,7 +3011,7 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
return false;
}
@@ -3025,11 +3025,11 @@ function saveJobUniformToDatabase(jobUniformData) {
}
if (!jobUniformData.needSaved) {
- logToConsole(LOG_DEBUG, `[VRR.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
@@ -3058,7 +3058,7 @@ function saveJobUniformToDatabase(jobUniformData) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[VRR.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
+ logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
return false;
}
@@ -3137,7 +3137,7 @@ function createJobLocationPickup(jobId, locationId) {
pickupModelId = tempJobData.pickupModel;
}
- logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
if (areServerElementsSupported()) {
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getGame()].job);
diff --git a/scripts/server/keybind.js b/scripts/server/keybind.js
index 6b0f6139..afaae507 100644
--- a/scripts/server/keybind.js
+++ b/scripts/server/keybind.js
@@ -36,8 +36,8 @@ class KeyBindData {
// ===========================================================================
function initKeyBindScript() {
- logToConsole(LOG_DEBUG, "[VRR.KeyBind]: Initializing key bind script ...");
- logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.KeyBind]: Initializing key bind script ...");
+ logToConsole(LOG_INFO, "[AGRP.KeyBind]: Key bind script initialized!");
}
// ===========================================================================
@@ -117,7 +117,7 @@ function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
let keyId = getPlayerKeyBindForCommand(client, "enter");
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
sendPlayerEnterPropertyKey(client, keyId.key);
} else {
sendPlayerEnterPropertyKey(client, false);
@@ -141,7 +141,7 @@ function removePlayerKeyBind(client, keyId) {
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
let keyId = getPlayerKeyBindForCommand(client, "enter");
- logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
sendPlayerEnterPropertyKey(client, keyId.key);
} else {
sendPlayerEnterPropertyKey(client, false);
@@ -209,7 +209,7 @@ function playerUsedKeyBind(client, key, duration = 0) {
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
+ logToConsole(LOG_DEBUG, `[AGRP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
let keyBindData = getPlayerKeyBindForKey(client, key);
if (keyBindData.enabled) {
diff --git a/scripts/server/locale.js b/scripts/server/locale.js
index 397f4976..466bea11 100644
--- a/scripts/server/locale.js
+++ b/scripts/server/locale.js
@@ -24,8 +24,8 @@ class LocaleData {
// ===========================================================================
function initLocaleScript() {
- logToConsole(LOG_DEBUG, "[VRR.Locale]: Initializing locale script ...");
- logToConsole(LOG_INFO, "[VRR.Locale]: Locale script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.Locale]: Initializing locale script ...");
+ logToConsole(LOG_INFO, "[AGRP.Locale]: Locale script initialized!");
}
// ===========================================================================
@@ -37,7 +37,7 @@ function getLocaleString(client, stringName, ...args) {
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
- logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
+ logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
return "";
}
@@ -54,7 +54,7 @@ function getLocaleString(client, stringName, ...args) {
function getLanguageLocaleString(localeId, stringName, ...args) {
let tempString = getRawLocaleString(stringName, localeId);
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
- logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
+ logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
return "";
}
@@ -86,7 +86,7 @@ function getGroupedLocaleString(client, stringName, index, ...args) {
function getRawLocaleString(stringName, localeId) {
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
- logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
+ logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
submitBugReport(null, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
return "";
}
@@ -107,7 +107,7 @@ function getRawLocaleString(stringName, localeId) {
function getRawGroupedLocaleString(stringName, localeId, index) {
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
- logToConsole(LOG_WARN, `[VRR.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
+ logToConsole(LOG_WARN, `[AGRP.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
submitBugReport(null, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
return "";
}
diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js
index aa810eea..483fc1fe 100644
--- a/scripts/server/messaging.js
+++ b/scripts/server/messaging.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initMessagingScript() {
- logToConsole(LOG_INFO, "[VRR.Messaging]: Initializing messaging script ...");
- logToConsole(LOG_INFO, "[VRR.Messaging]: Messaging script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Messaging]: Initializing messaging script ...");
+ logToConsole(LOG_INFO, "[AGRP.Messaging]: Messaging script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 241baaa7..96ae58fd 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -819,24 +819,24 @@ function getPlayerWeapon(client) {
function connectToDatabase() {
if (getDatabaseConfig().usePersistentConnection) {
if (persistentDatabaseConnection == null) {
- logToConsole(LOG_DEBUG, `[VRR.Database] Initializing database connection ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
if (persistentDatabaseConnection.error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
persistentDatabaseConnection = null;
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Database] Database connection successful!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
return persistentDatabaseConnection;
} else {
- logToConsole(LOG_DEBUG, `[VRR.Database] Using existing database connection.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
return persistentDatabaseConnection;
}
} else {
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
if (databaseConnection.error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
return false;
} else {
return databaseConnection;
@@ -850,9 +850,9 @@ function disconnectFromDatabase(dbConnection, force = false) {
if (!getDatabaseConfig().usePersistentConnection || force == true) {
try {
dbConnection.close();
- logToConsole(LOG_DEBUG, `[VRR.Database] Database connection closed successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Database connection could not be closed! (Error: ${error})`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
}
}
return true;
@@ -861,7 +861,7 @@ function disconnectFromDatabase(dbConnection, force = false) {
// ===========================================================================
function queryDatabase(dbConnection, queryString, useThread = false) {
- logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
if (useThread == true) {
Promise.resolve().then(() => {
let queryResult = dbConnection.query(queryString);
@@ -924,19 +924,19 @@ function quickDatabaseQuery(queryString) {
let dbConnection = connectToDatabase();
let insertId = 0;
if (dbConnection) {
- //logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
let dbQuery = queryDatabase(dbConnection, queryString);
if (getDatabaseInsertId(dbConnection)) {
insertId = getDatabaseInsertId(dbConnection);
- logToConsole(LOG_DEBUG, `[VRR.Database] Query returned insert id ${insertId}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
}
if (dbQuery) {
try {
freeDatabaseQuery(dbQuery);
- logToConsole(LOG_DEBUG, `[VRR.Database] Query result free'd successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Query result could not be free'd! (Error: ${error})`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
}
}
@@ -988,9 +988,9 @@ function setConstantsAsGlobalVariablesInDatabase() {
let dbConnection = connectToDatabase();
let entries = Object.entries(global);
for (let i in entries) {
- logToConsole(LOG_DEBUG, `[VRR.Database] Checking entry ${i} (${entries[i]})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Checking entry ${i} (${entries[i]})`);
if (toString(i).slice(0, 3).indexOf("AGRP_") != -1) {
- logToConsole(LOG_DEBUG, `[VRR.Database] Adding ${i} (${entries[i]}) to database global variables`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Adding ${i} (${entries[i]}) to database global variables`);
}
}
}
@@ -1175,7 +1175,7 @@ function setVehicleHealth(vehicle, health) {
// ===========================================================================
function givePlayerWeapon(client, weaponId, ammo, active = true) {
- logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
sendNetworkEventToPlayer("agrp.giveWeapon", client, weaponId, ammo, active);
}
diff --git a/scripts/server/native/ragemp.js b/scripts/server/native/ragemp.js
index 521fe492..20bf146a 100644
--- a/scripts/server/native/ragemp.js
+++ b/scripts/server/native/ragemp.js
@@ -760,24 +760,24 @@ function getPlayerWeapon(client) {
function connectToDatabase() {
if (getDatabaseConfig().usePersistentConnection) {
if (persistentDatabaseConnection == null) {
- logToConsole(LOG_DEBUG, `[VRR.Database] Initializing database connection ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
if (persistentDatabaseConnection.error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
persistentDatabaseConnection = null;
return false;
}
- logToConsole(LOG_DEBUG, `[VRR.Database] Database connection successful!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
return persistentDatabaseConnection;
} else {
- logToConsole(LOG_DEBUG, `[VRR.Database] Using existing database connection.`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
return persistentDatabaseConnection;
}
} else {
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
if (databaseConnection.error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
return false;
} else {
return databaseConnection;
@@ -791,9 +791,9 @@ function disconnectFromDatabase(dbConnection) {
if (!getDatabaseConfig().usePersistentConnection) {
try {
dbConnection.close();
- logToConsole(LOG_DEBUG, `[VRR.Database] Database connection closed successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Database connection could not be closed! (Error: ${error})`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
}
}
return true;
@@ -802,7 +802,7 @@ function disconnectFromDatabase(dbConnection) {
// ===========================================================================
function queryDatabase(dbConnection, queryString, useThread = false) {
- logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
if (useThread == true) {
Promise.resolve().then(() => {
let queryResult = dbConnection.query(queryString);
@@ -865,19 +865,19 @@ function quickDatabaseQuery(queryString) {
let dbConnection = connectToDatabase();
let insertId = 0;
if (dbConnection) {
- //logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
let dbQuery = queryDatabase(dbConnection, queryString);
if (getDatabaseInsertId(dbConnection)) {
insertId = getDatabaseInsertId(dbConnection);
- logToConsole(LOG_DEBUG, `[VRR.Database] Query returned insert id ${insertId}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
}
if (dbQuery) {
try {
freeDatabaseQuery(dbQuery);
- logToConsole(LOG_DEBUG, `[VRR.Database] Query result free'd successfully`);
+ logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
} catch (error) {
- logToConsole(LOG_ERROR, `[VRR.Database] Query result could not be free'd! (Error: ${error})`);
+ logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
}
}
@@ -1014,7 +1014,7 @@ function setVehicleHealth(vehicle, health) {
// ===========================================================================
function givePlayerWeapon(client, weaponId, ammo, active = true) {
- //logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
+ //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
//sendNetworkEventToPlayer("agrp.giveWeapon", client, weaponId, ammo, active);
client.giveWeapon(weaponId, ammo);
}
diff --git a/scripts/server/npc.js b/scripts/server/npc.js
index e902dfec..fb9e7cce 100644
--- a/scripts/server/npc.js
+++ b/scripts/server/npc.js
@@ -203,8 +203,8 @@ class NPCTriggerResponseData {
// ===========================================================================
function initNPCScript() {
- logToConsole(LOG_DEBUG, "[VRR.NPC]: Initializing NPC script ...");
- logToConsole(LOG_INFO, "[VRR.NPC]: NPC script initialized successfully!");
+ logToConsole(LOG_DEBUG, "[AGRP.NPC]: Initializing NPC script ...");
+ logToConsole(LOG_INFO, "[AGRP.NPC]: NPC script initialized successfully!");
}
// ===========================================================================
@@ -244,7 +244,7 @@ function createNPCCommand(command, params, client) {
// ===========================================================================
function loadNPCsFromDatabase() {
- logToConsole(LOG_DEBUG, `[VRR.NPC]: Loading NPCs from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPCs from database ...`);
let dbConnection = connectToDatabase();
let tempNPCs = [];
let dbAssoc;
@@ -262,14 +262,14 @@ function loadNPCsFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
return tempNPCs;
}
// ===========================================================================
function loadNPCTriggersFromDatabase(npcDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
let dbConnection = connectToDatabase();
let tempNPCTriggers = [];
let dbAssoc;
@@ -288,14 +288,14 @@ function loadNPCTriggersFromDatabase(npcDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
return tempNPCTriggers;
}
// ===========================================================================
function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
let dbConnection = connectToDatabase();
let tempNPCTriggerConditions = [];
let dbAssoc;
@@ -312,14 +312,14 @@ function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
return tempNPCTriggerConditions;
}
// ===========================================================================
function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
- logToConsole(LOG_DEBUG, `[VRR.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
let dbConnection = connectToDatabase();
let tempNPCTriggerResponses = [];
let dbAssoc;
@@ -336,7 +336,7 @@ function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_DEBUG, `[VRR.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
+ logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
return tempNPCTriggerResponses;
}
@@ -356,28 +356,28 @@ function saveAllNPCsToDatabase() {
function saveNPCToDatabase(npcDataId) {
if (getServerConfig().devServer) {
- logToConsole(LOG_VERBOSE, `[VRR.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
return false;
}
if (getNPCData(npcDataId) == false) {
- logToConsole(LOG_VERBOSE, `[VRR.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
return false;
}
let tempNPCData = getNPCData(npcDataId);
if (tempNPCData.databaseId == -1) {
- logToConsole(LOG_VERBOSE, `[VRR.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
return false;
}
if (!tempNPCData.needsSaved) {
- logToConsole(LOG_VERBOSE, `[VRR.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
if (tempNPCData.ped != false) {
@@ -434,7 +434,7 @@ function saveNPCToDatabase(npcDataId) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_VERBOSE, `[VRR.NPC]: Saved NPC ${npcDataId} to database!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saved NPC ${npcDataId} to database!`);
return false;
}
diff --git a/scripts/server/race.js b/scripts/server/race.js
index aeb3886f..6b3c0415 100644
--- a/scripts/server/race.js
+++ b/scripts/server/race.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initRaceScript() {
- logToConsole(LOG_INFO, "[VRR.Race]: Initializing race script ...");
- logToConsole(LOG_INFO, "[VRR.Race]: Race script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Race]: Initializing race script ...");
+ logToConsole(LOG_INFO, "[AGRP.Race]: Race script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/radio.js b/scripts/server/radio.js
index 29ca0969..356baf3b 100644
--- a/scripts/server/radio.js
+++ b/scripts/server/radio.js
@@ -30,15 +30,15 @@ class RadioStationData {
// ===========================================================================
function initRadioScript() {
- logToConsole(LOG_INFO, "[VRR.Radio]: Initializing radio script ...");
- logToConsole(LOG_INFO, "[VRR.Radio]: Radio script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Radio]: Initializing radio script ...");
+ logToConsole(LOG_INFO, "[AGRP.Radio]: Radio script initialized successfully!");
return true;
}
// ===========================================================================
function loadRadioStationsFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Radio]: Loading radio stations from database ...");
+ logToConsole(LOG_INFO, "[AGRP.Radio]: Loading radio stations from database ...");
let dbConnection = connectToDatabase();
let tempRadioStations = [];
let dbAssoc;
@@ -55,7 +55,7 @@ function loadRadioStationsFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
return tempRadioStations;
}
diff --git a/scripts/server/staff.js b/scripts/server/staff.js
index dd505f8a..32d3cf4d 100644
--- a/scripts/server/staff.js
+++ b/scripts/server/staff.js
@@ -9,8 +9,8 @@
// ===========================================================================
function initStaffScript() {
- logToConsole(LOG_INFO, "[VRR.Staff]: Initializing staff script ...");
- logToConsole(LOG_INFO, "[VRR.Staff]: Staff script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Staff]: Initializing staff script ...");
+ logToConsole(LOG_INFO, "[AGRP.Staff]: Staff script initialized successfully!");
}
// ===========================================================================
diff --git a/scripts/server/startup.js b/scripts/server/startup.js
index 9e92395b..9b227383 100644
--- a/scripts/server/startup.js
+++ b/scripts/server/startup.js
@@ -92,33 +92,33 @@ function checkForSMTPModule() {
// ===========================================================================
function checkForAllRequiredModules() {
- logToConsole(LOG_DEBUG, "[VRR.Startup]: Checking for required modules ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Startup]: Checking for required modules ...");
if (!checkForHashingModule()) {
- logToConsole(LOG_WARN, "[VRR.Startup]: Hashing module is not loaded!");
- logToConsole(LOG_WARN, "[VRR.Startup]: This resource will now shutdown.");
+ logToConsole(LOG_WARN, "[AGRP.Startup]: Hashing module is not loaded!");
+ logToConsole(LOG_WARN, "[AGRP.Startup]: This resource will now shutdown.");
thisResource.stop();
}
if (!checkForMySQLModule()) {
- logToConsole(LOG_WARN, "[VRR.Startup]: MySQL module is not loaded!");
- logToConsole(LOG_WARN, "[VRR.Startup]: This resource will now shutdown.");
+ logToConsole(LOG_WARN, "[AGRP.Startup]: MySQL module is not loaded!");
+ logToConsole(LOG_WARN, "[AGRP.Startup]: This resource will now shutdown.");
thisResource.stop();
}
if (!checkForSMTPModule()) {
- logToConsole(LOG_WARN, "[VRR.Startup]: SMTP Email module is not loaded!");
- logToConsole(LOG_WARN, "[VRR.Startup]: Email features will NOT be available!");
+ logToConsole(LOG_WARN, "[AGRP.Startup]: SMTP Email module is not loaded!");
+ logToConsole(LOG_WARN, "[AGRP.Startup]: Email features will NOT be available!");
}
- logToConsole(LOG_DEBUG, "[VRR.Startup]: All required modules loaded!");
+ logToConsole(LOG_DEBUG, "[AGRP.Startup]: All required modules loaded!");
return true;
}
// ===========================================================================
function loadServerDataFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Config]: Loading server data ...");
+ logToConsole(LOG_INFO, "[AGRP.Config]: Loading server data ...");
// Always load these regardless of "test server" status
getServerData().localeStrings = loadAllLocaleStrings();
diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js
index 50ef6712..82e02619 100644
--- a/scripts/server/subaccount.js
+++ b/scripts/server/subaccount.js
@@ -123,8 +123,8 @@ class SubAccountData {
// ===========================================================================
function initSubAccountScript() {
- logToConsole(LOG_DEBUG, "[VRR.SubAccount]: Initializing subaccount script ...");
- logToConsole(LOG_INFO, "[VRR.SubAccount]: SubAccount script initialized!");
+ logToConsole(LOG_DEBUG, "[AGRP.SubAccount]: Initializing subaccount script ...");
+ logToConsole(LOG_INFO, "[AGRP.SubAccount]: SubAccount script initialized!");
}
// ===========================================================================
@@ -221,7 +221,7 @@ function loadSubAccountsFromAccount(accountId) {
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
if (!getJobRankData(jobIndex, jobRankIndex)) {
let newJobRankIndex = getLowestJobRank(jobIndex);
- console.log(`[VRR.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
+ console.log(`[AGRP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
tempSubAccount.jobRankIndex = newJobRankIndex;
} else {
@@ -341,7 +341,7 @@ function saveSubAccountToDatabase(subAccountData) {
// ===========================================================================
function createSubAccount(accountId, firstName, lastName) {
- logToConsole(LOG_DEBUG, `[VRR.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
+ logToConsole(LOG_DEBUG, `[AGRP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
let dbConnection = connectToDatabase();
let dbQuery = false;
@@ -375,7 +375,7 @@ function showCharacterSelectToClient(client) {
if (doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
if (getPlayerData(client).subAccounts.length > 0) {
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
selectCharacter(client, getPlayerLastUsedSubAccount(client));
return true;
}
@@ -383,7 +383,7 @@ function showCharacterSelectToClient(client) {
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).currentSubAccount = 0;
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
let tempSubAccount = getPlayerData(client).subAccounts[0];
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIndexFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
@@ -393,7 +393,7 @@ function showCharacterSelectToClient(client) {
//setTimeout(function() {
// showCharacterSelectCameraToPlayer(client);
//}, 500);
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
} else {
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{teal}${index + 1}: {ALTCOLOUR}${sacct.firstName} ${sacct.lastName}`);
let chunkedList = splitArrayIntoChunks(charactersList, 5);
@@ -402,7 +402,7 @@ function showCharacterSelectToClient(client) {
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR} • "));
}
messagePlayerInfo(client, getLocaleString(client, "CharacterSelectHelpText", `{ALTCOLOUR}/usechar{MAINCOLOUR}`, `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
}
}
@@ -422,7 +422,7 @@ function checkNewCharacter(client, firstName, lastName) {
lastName = lastName.trim();
if (doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
- logToConsole(LOG_INFO | LOG_WARN, `[VRR.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
+ logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
return false;
}
@@ -469,7 +469,7 @@ function checkPreviousCharacter(client) {
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
}
}
@@ -490,16 +490,16 @@ function checkNextCharacter(client) {
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
}
}
// ===========================================================================
function selectCharacter(client, characterId = -1) {
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
if (characterId != -1) {
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
getPlayerData(client).currentSubAccount = characterId;
}
@@ -513,7 +513,7 @@ function selectCharacter(client, characterId = -1) {
getPlayerData(client).switchingCharacter = false;
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
getPlayerData(client).pedState = AGRP_PEDSTATE_SPAWNING;
@@ -534,7 +534,7 @@ function selectCharacter(client, characterId = -1) {
}, 500);
} else if (getGame() == AGRP_GAME_MAFIA_ONE) {
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
- //logToConsole(LOG_DEBUG, `[VRR.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
+ //logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
setTimeout(function () {
onPlayerSpawn(client);
@@ -544,7 +544,7 @@ function selectCharacter(client, characterId = -1) {
removePlayerKeyBind(client, getKeyIdFromParams("insert"));
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
getPlayerCurrentSubAccount(client).lastLogin = getCurrentUnixTimestamp();
}
@@ -552,14 +552,14 @@ function selectCharacter(client, characterId = -1) {
// ===========================================================================
function switchCharacterCommand(command, params, client) {
- logToConsole(LOG_DEBUG, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
+ logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
if (!isPlayerSpawned(client)) {
- logToConsole(LOG_WARN, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
+ logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
return false;
}
if (isPlayerSwitchingCharacter(client)) {
- logToConsole(LOG_WARN, `[VRR.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
+ logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
messagePlayerError(client, "You are already selecting/switching characters!");
return false;
}
diff --git a/scripts/server/timers.js b/scripts/server/timers.js
index f61c93df..574062ba 100644
--- a/scripts/server/timers.js
+++ b/scripts/server/timers.js
@@ -17,7 +17,7 @@ function saveServerDataToDatabase() {
return false;
}
- logToConsole(LOG_DEBUG, "[VRR.Utilities]: Saving all server data to database ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Utilities]: Saving all server data to database ...");
try {
saveAllPlayersToDatabase();
@@ -85,7 +85,7 @@ function saveServerDataToDatabase() {
logToConsole(LOG_ERROR, `Could not save server config to database: ${error}`);
}
- logToConsole(LOG_DEBUG, "[VRR.Utilities]: Saved all server data to database!");
+ logToConsole(LOG_DEBUG, "[AGRP.Utilities]: Saved all server data to database!");
}
// ===========================================================================
@@ -104,18 +104,18 @@ function initTimers() {
// ===========================================================================
function oneMinuteTimerFunction() {
- logToConsole(LOG_DEBUG, `[VRR.Event] Checking server game time`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Checking server game time`);
checkServerGameTime();
if (getClients().length > 0) {
- logToConsole(LOG_DEBUG, `[VRR.Event] Checking rentable vehicles`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Checking rentable vehicles`);
checkVehicleRenting();
- logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
updateAllPlayerNameTags();
}
- logToConsole(LOG_DEBUG, `[VRR.Event] Collecting all garbage`);
+ logToConsole(LOG_DEBUG, `[AGRP.Event] Collecting all garbage`);
collectAllGarbage();
}
diff --git a/scripts/server/trigger.js b/scripts/server/trigger.js
index b62c949b..a5191a44 100644
--- a/scripts/server/trigger.js
+++ b/scripts/server/trigger.js
@@ -218,8 +218,8 @@ class TriggerResponseData {
// ===========================================================================
function initTriggerScript() {
- logToConsole(LOG_INFO, "[VRR.Trigger]: Initializing trigger script ...");
- logToConsole(LOG_INFO, "[VRR.Trigger]: Trigger script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Trigger]: Initializing trigger script ...");
+ logToConsole(LOG_INFO, "[AGRP.Trigger]: Trigger script initialized successfully!");
return true;
}
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index 38b72941..4f50ad5d 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -170,15 +170,15 @@ class VehicleData {
// ===========================================================================
function initVehicleScript() {
- logToConsole(LOG_INFO, "[VRR.Vehicle]: Initializing vehicle script ...");
- logToConsole(LOG_INFO, "[VRR.Vehicle]: Vehicle script initialized successfully!");
+ logToConsole(LOG_INFO, "[AGRP.Vehicle]: Initializing vehicle script ...");
+ logToConsole(LOG_INFO, "[AGRP.Vehicle]: Vehicle script initialized successfully!");
return true;
}
// ===========================================================================
function loadVehiclesFromDatabase() {
- logToConsole(LOG_INFO, "[VRR.Vehicle]: Loading vehicles from database ...");
+ logToConsole(LOG_INFO, "[AGRP.Vehicle]: Loading vehicles from database ...");
let dbConnection = connectToDatabase();
let tempVehicles = [];
let dbAssoc;
@@ -195,7 +195,7 @@ function loadVehiclesFromDatabase() {
disconnectFromDatabase(dbConnection);
}
- logToConsole(LOG_INFO, `[VRR.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
+ logToConsole(LOG_INFO, `[AGRP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
return tempVehicles;
}
@@ -206,14 +206,14 @@ function saveAllVehiclesToDatabase() {
return false;
}
- logToConsole(LOG_DEBUG, "[VRR.Vehicle]: Saving all server vehicles to database ...");
+ logToConsole(LOG_DEBUG, "[AGRP.Vehicle]: Saving all server vehicles to database ...");
let vehicles = getServerData().vehicles;
for (let i in vehicles) {
if (vehicles[i].needsSaved) {
saveVehicleToDatabase(i);
}
}
- logToConsole(LOG_INFO, "[VRR.Vehicle]: Saved all server vehicles to database!");
+ logToConsole(LOG_INFO, "[AGRP.Vehicle]: Saved all server vehicles to database!");
return true;
}
@@ -238,7 +238,7 @@ function saveVehicleToDatabase(vehicleDataId) {
return false;
}
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
if (tempVehicleData.vehicle != false) {
@@ -315,7 +315,7 @@ function saveVehicleToDatabase(vehicleDataId) {
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
return false;
}
@@ -1466,7 +1466,7 @@ function respawnVehicle(vehicle) {
// ===========================================================================
function spawnVehicle(vehicleData) {
- logToConsole(LOG_DEBUG, `[VRR.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
+ logToConsole(LOG_DEBUG, `[AGRP.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
if (!vehicle) {
@@ -1483,25 +1483,25 @@ function spawnVehicle(vehicleData) {
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
} else {
setVehicleColours(vehicle, vehicleData.colour1, vehicleData.colour2, vehicleData.colour3, vehicleData.colour4);
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
}
}
if (vehicleData.spawnLocked == true) {
setVehicleEngine(vehicle, false);
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
} else {
setVehicleEngine(vehicle, intToBool(vehicleData.engine));
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
}
if (typeof vehicle.locked != "undefined") {
setVehicleLocked(vehicle, intToBool(vehicleData.locked));
- logToConsole(LOG_VERBOSE, `[VRR.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
}
//setVehicleHealth(vehicle, 1000);
From 926dc7bfcd0c6b85b41a68703e72df187c66189e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:39:57 -0500
Subject: [PATCH 076/311] Update locale.json
---
config/locale.json | 42 ++++++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/config/locale.json b/config/locale.json
index 3ab7e59e..02309d40 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,8 @@
"flagImageFile": "fi.png",
"countries": ["fi"],
"requiresUnicode": false,
- "contributor": "SIMBA_MEOW"
+ "contributor": "SIMBA_MEOW",
+ "enabled": true
},
{
"id": 11,
@@ -121,7 +132,8 @@
"flagImageFile": "lt.png",
"countries": ["lt"],
"requiresUnicode": false,
- "contributor": "dovis"
+ "contributor": "dovis",
+ "enabled": false
},
{
"id": 12,
@@ -131,7 +143,8 @@
"flagImageFile": "lv.png",
"countries": ["lv"],
"requiresUnicode": false,
- "contributor": "YuOn"
+ "contributor": "YuOn",
+ "enabled": false
},
{
"id": 13,
@@ -141,7 +154,8 @@
"flagImageFile": "ir.png",
"countries": ["ir"],
"requiresUnicode": true,
- "contributor": "bigmohammad"
+ "contributor": "bigmohammad",
+ "enabled": false
}
]
}
\ No newline at end of file
From b01baa7302ca8785910bef3492512ad3bfaa29b8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:40:05 -0500
Subject: [PATCH 077/311] Fix money bug
---
scripts/client/utilities.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 3b2ff03a..232d6281 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -594,7 +594,7 @@ function updateLocalPlayerMoney() {
}
if (typeof localPlayer.money != "undefined") {
- localPlayer.money = toInteger(amount);
+ localPlayer.money = toInteger(localPlayerMoney);
}
if (getGame() == AGRP_GAME_GTA_IV) {
From 26f3ad8cef2040c3f4b0e033161d06ef067ec1f6 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 02:40:15 -0500
Subject: [PATCH 078/311] Fix squirrel thread
---
scripts/server/thread.nut | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/server/thread.nut b/scripts/server/thread.nut
index 1fe092a6..0fe5afb0 100644
--- a/scripts/server/thread.nut
+++ b/scripts/server/thread.nut
@@ -9,16 +9,16 @@
// ===========================================================================
bindEventHandler("OnResourceStart", thisResource, function(event, resource) {
- emailThread <- newthread("sendEmail");
+ emailThread <- newthread(sendEmail);
- exportFunction("sendEmailSquirrel", function(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
+ exportFunction("sendEmail", function(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
emailThread.call(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName);
});
});
// ===========================================================================
-function sendEmailSquirrel(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
+function sendEmail(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
module.smtp.send(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName);
}
From 9377ec11297ae820c332c16aabb27403c2ac06fe Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:29:53 -0500
Subject: [PATCH 079/311] Update locale.json
---
config/client/locale.json | 49 +++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 23 deletions(-)
diff --git a/config/client/locale.json b/config/client/locale.json
index d9c883c3..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,7 +117,8 @@
"flagImageFile": "fi.png",
"countries": ["fi"],
"requiresUnicode": false,
- "contributor": "SIMBA_MEOW"
+ "contributor": "SIMBA_MEOW",
+ "enabled": true
},
{
"id": 11,
@@ -117,7 +128,8 @@
"flagImageFile": "lt.png",
"countries": ["lt"],
"requiresUnicode": false,
- "contributor": "dovis"
+ "contributor": "dovis",
+ "enabled": false
},
{
"id": 12,
@@ -127,16 +139,7 @@
"flagImageFile": "lv.png",
"countries": ["lv"],
"requiresUnicode": false,
- "contributor": "YuOn"
- },
- {
- "id": 13,
- "englishName": "Persian",
- "stringsFile": "persian.json",
- "isoCode": "fa",
- "flagImageFile": "ir.png",
- "countries": ["ir"],
- "requiresUnicode": true,
- "contributor": "bigmohammad"
+ "contributor": "YuOn",
+ "enabled": false
}
]
\ No newline at end of file
From b84fb4ee9afb1911b996be55522290caa3c24e74 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:29:58 -0500
Subject: [PATCH 080/311] Update locale.json
---
config/locale.json | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/config/locale.json b/config/locale.json
index 02309d40..11c90448 100644
--- a/config/locale.json
+++ b/config/locale.json
@@ -145,17 +145,6 @@
"requiresUnicode": false,
"contributor": "YuOn",
"enabled": false
- },
- {
- "id": 13,
- "englishName": "Persian",
- "stringsFile": "persian.json",
- "isoCode": "fa",
- "flagImageFile": "ir.png",
- "countries": ["ir"],
- "requiresUnicode": true,
- "contributor": "bigmohammad",
- "enabled": false
}
]
}
\ No newline at end of file
From 0acdf692db6b3f56f6a27cfe7c315f4694fdcc6e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:30:10 -0500
Subject: [PATCH 081/311] Fix client resource start
---
scripts/client/event.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 6f90bfd8..43feb33a 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -50,10 +50,6 @@ function addAllEventHandlers() {
// ===========================================================================
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");
@@ -69,6 +65,10 @@ function onResourceStart(event, resource) {
garbageCollectorInterval = setInterval(collectAllGarbage, 1000 * 60);
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
+
+ if (resource == thisResource) {
+ sendResourceStartedSignalToServer();
+ }
}
// ===========================================================================
@@ -82,8 +82,9 @@ function onResourceStop(event, resource) {
// ===========================================================================
function onResourceReady(event, resource) {
+ loadLocaleConfig();
+
if (resource == thisResource) {
- loadLocaleConfig();
sendResourceReadySignalToServer();
}
}
From 10b856541f0a886384df1b21e6e64f2d616e2083 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:30:25 -0500
Subject: [PATCH 082/311] Init locale chooser
---
scripts/client/gui.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 1168c2d5..959b1f01 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -61,15 +61,13 @@ function initGUI() {
initListGUI();
initResetPasswordGUI();
initChangePasswordGUI();
- //initLocaleChooserGUI();
+ initLocaleChooserGUI();
closeAllWindows();
guiReady = true;
logToConsole(LOG_DEBUG, `[AGRP.GUI] All GUI created successfully!`);
- loadLocaleConfig();
-
sendNetworkEventToServer("agrp.guiReady", true);
};
From e72b54c3d418ba7a9681c21ad5341c0760339b4e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:30:39 -0500
Subject: [PATCH 083/311] Don't load locale config on locale chooser init
---
scripts/client/gui/localechooser.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js
index 73436e86..a5402319 100644
--- a/scripts/client/gui/localechooser.js
+++ b/scripts/client/gui/localechooser.js
@@ -40,8 +40,6 @@ function initLocaleChooserGUI() {
localeChooser.window.shown = false;
- loadLocaleConfig();
-
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created locale chooser GUI`);
}
From b8d19d013a60a268b99edcdf352114db021bcd77 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:30:58 -0500
Subject: [PATCH 084/311] Add info log level CS
---
scripts/client/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/client/main.js b/scripts/client/main.js
index 3d38679f..7acf8a4a 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -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 = {};
From d0a544522f05cdaa5fe67edd9c5eaa7600bdd264 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:31:06 -0500
Subject: [PATCH 085/311] Woops wrong game feature name
---
scripts/server/business.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index 3bdfbcd4..d7062f73 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -321,7 +321,7 @@ function createBusinessCommand(command, params, client) {
params,
getPlayerPosition(client),
toVector3(0.0, 0.0, 0.0),
- (isGameFeatureSupported("pickups")) ? getGameConfig().pickupModels[getGame()].Business : -1,
+ (isGameFeatureSupported("pickup")) ? getGameConfig().pickupModels[getGame()].Business : -1,
-1,
getPlayerInterior(client),
getPlayerDimension(client),
From 61c656864171e7a4d6648338f4d225a29a4adb29 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:31:18 -0500
Subject: [PATCH 086/311] Only check dimension when spawning
---
scripts/server/event.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index c7602a22..0f156803 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -427,6 +427,8 @@ async function onPlayerSpawn(client) {
await waitUntil(() => client != null && getPlayerPed(client) != null);
}
+ stopRadioStreamForPlayer(client);
+
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
if (!getPlayerData(client)) {
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
@@ -623,7 +625,7 @@ async function onPlayerSpawn(client) {
// Radio stuff must be last thing sent to client because it hangs the client for a second, which blocks processing of other incoming packets
// Start playing business/house radio if in one
- if (getPlayerCurrentSubAccount(client).interior != getGameConfig().mainWorldInterior[getGame()] || getPlayerCurrentSubAccount(client).dimension != getGameConfig().mainWorldDimension[getGame()]) {
+ if (getPlayerDimension(client) != getGameConfig().mainWorldDimension[getGame()]) {
let businessId = getPlayerBusiness(client);
let houseId = getPlayerHouse(client);
if (businessId != -1) {
@@ -637,8 +639,6 @@ async function onPlayerSpawn(client) {
} else {
stopRadioStreamForPlayer(client);
}
- } else {
- stopRadioStreamForPlayer(client);
}
messageDiscordEventChannel(`🧍 ${getPlayerName(client)} spawned as ${getCharacterFullName(client)}`);
From 67b57399f30488aa00392d7e86618cc89296c07f Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:31:40 -0500
Subject: [PATCH 087/311] Wrong const name
---
scripts/server/misc.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 2b240893..1149de83 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -333,7 +333,7 @@ function enterExitPropertyCommand(command, params, client) {
clearPlayerStateToEnterExitProperty(client);
getPlayerData(client).pedState = AGRP_PEDSTATE_EXITINGPROPERTY;
- getPlayerData(client).enteringExitingProperty = [(isBusiness) ? AGRP_PROPERTY_TYPE_BIZ : AGRP_PROPERTY_TYPE_HOUSE, closestProperty.index];
+ getPlayerData(client).enteringExitingProperty = [(isBusiness) ? AGRP_PROPERTY_TYPE_BUSINESS : AGRP_PROPERTY_TYPE_HOUSE, closestProperty.index];
meActionToNearbyPlayers(client, getLanguageLocaleString(englishId, "ExitsProperty", typeString, nameString));
From b7de1e054a6c6021a878b5f010bc9e688d4962e8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:31:49 -0500
Subject: [PATCH 088/311] Immediately call spawn event
---
scripts/server/subaccount.js | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js
index 82e02619..b5298bdb 100644
--- a/scripts/server/subaccount.js
+++ b/scripts/server/subaccount.js
@@ -519,6 +519,7 @@ function selectCharacter(client, characterId = -1) {
if (getGame() <= AGRP_GAME_GTA_SA) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
+ onPlayerSpawn(client);
} else if (getGame() == AGRP_GAME_GTA_IV) {
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
clearPlayerWeapons(client);
@@ -536,10 +537,7 @@ function selectCharacter(client, characterId = -1) {
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
//logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
- setTimeout(function () {
- onPlayerSpawn(client);
- //stopRadioStreamForPlayer(client);
- }, 250);
+ onPlayerSpawn(client);
}
removePlayerKeyBind(client, getKeyIdFromParams("insert"));
From 1fd99729da285f59cdb3af1f085b2c14d5780cea Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 20 Sep 2022 03:31:53 -0500
Subject: [PATCH 089/311] Woops wrong game feature name
---
scripts/server/property.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/property.js b/scripts/server/property.js
index cd551974..be92ba21 100644
--- a/scripts/server/property.js
+++ b/scripts/server/property.js
@@ -243,7 +243,7 @@ function createPropertyCommand(command, params, client) {
params,
getPlayerPosition(client),
toVector3(0.0, 0.0, 0.0),
- (isGameFeatureSupported("pickups")) ? getGameConfig().pickupModels[getGame()].Business : -1,
+ (isGameFeatureSupported("pickup")) ? getGameConfig().pickupModels[getGame()].Business : -1,
-1,
getPlayerInterior(client),
getPlayerDimension(client),
From 45c5372499ac53fa8a0e0c4131e86d4167a0e219 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:16:47 -0500
Subject: [PATCH 090/311] Custom cursor
---
files/images/cursor.png | Bin 0 -> 476 bytes
meta.xml | 3 ++-
scripts/client/cursor.js | 40 +++++++++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 files/images/cursor.png
create mode 100644 scripts/client/cursor.js
diff --git a/files/images/cursor.png b/files/images/cursor.png
new file mode 100644
index 0000000000000000000000000000000000000000..2f19d2d6d4bd8da75f83c1d35316a79978353ed0
GIT binary patch
literal 476
zcmV<20VDp2P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0dYx0K~y+Tos>Oq
zf>0EO(Ka2L7$z}kNSe467q|WZHrD=xj>gfYpJNlZc4Mvm2`(nqv^$&N=41z0=t9z=
zv8U&~w^&g?;YnV&+;h$Y2?2$<$Du3-oHw~t-v7>pp<1m*d@lVYG#ZVl(P%(&C%1}0
zi^YOG&nqnv0^quCEV-4X{a6VAB$}obk|YG6sANk3)+9HwEt^yU*jJJ%0MqGorzBSZ
z)+E<*B*{(z$dl|P0Fcz{bx5w{s3cPmh9Lz(kjQvEj=!CiBva7q_0X6XAxQ{)-=|Ke
zBi8fzoT}C8H}{-!jxzEuz_4K$RH;;GHk*k(%d&8%+z(6$Fx+aj(EQ99bh}+47!HTn
z``{dMQX$82;^6@Yf2ng-RVj)hS}vE=Y&KE5;G{yjuCEWrIJRwzr|9?lsK3hXZPJFp
zWxL%Lg2`lpo*&McsBG}U*&GJPoKMp<@g}}_{m9W!*d%Q@=7ICXIT2S|D9SG_pYAMZ
SFf5b+0000
-
@@ -90,6 +89,7 @@
+
@@ -113,6 +113,7 @@
+
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
From 8326561a5864c71b4b05c8f8f01f88e51371d50f Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:17:05 -0500
Subject: [PATCH 091/311] Add script init functions
---
scripts/client/animation.js | 7 +++++++
scripts/client/business.js | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/scripts/client/animation.js b/scripts/client/animation.js
index 0864cfbd..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);
diff --git a/scripts/client/business.js b/scripts/client/business.js
index ac882f34..fec93641 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -27,6 +27,13 @@ class BusinessData {
// ===========================================================================
+function initBusinessScript() {
+ logToConsole(LOG_DEBUG, "[AGRP.Business]: Initializing business script ...");
+ logToConsole(LOG_INFO, "[AGRP.Business]: Business script initialized!");
+}
+
+// ===========================================================================
+
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) {
logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
From a7fed8751a0144523614f726f041f8e84fd56f33 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:17:29 -0500
Subject: [PATCH 092/311] Use info log level for script initialized message
---
scripts/client/chat.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/client/chat.js b/scripts/client/chat.js
index 360f26a1..c85140ce 100644
--- a/scripts/client/chat.js
+++ b/scripts/client/chat.js
@@ -33,7 +33,7 @@ function initChatBoxScript() {
scrollUpKey = getKeyIdFromParams("pageup");
scrollDownKey = getKeyIdFromParams("pagedown");
bindChatBoxKeys();
- logToConsole(LOG_DEBUG, "[AGRP.Chat]: Chat script initialized!");
+ logToConsole(LOG_INFO, "[AGRP.Chat]: Chat script initialized!");
}
// ===========================================================================
From 05ca5485f94299965da9401df2f0a50d5c58673d Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:17:41 -0500
Subject: [PATCH 093/311] Wait 500ms before init
---
scripts/client/event.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 43feb33a..c16408be 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -67,7 +67,9 @@ function onResourceStart(event, resource) {
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
if (resource == thisResource) {
- sendResourceStartedSignalToServer();
+ setTimeout(function () {
+ sendResourceStartedSignalToServer();
+ }, 500);
}
}
@@ -84,9 +86,9 @@ function onResourceStop(event, resource) {
function onResourceReady(event, resource) {
loadLocaleConfig();
- if (resource == thisResource) {
+ setTimeout(function () {
sendResourceReadySignalToServer();
- }
+ }, 500);
}
// ===========================================================================
@@ -126,6 +128,8 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
// ===========================================================================
function onDrawnHUD(event) {
+ processMouseCursorRendering();
+
if (!renderHUD) {
return false;
}
From 853e5e6b3d690b6c94e8c7384c493fc148c2a129 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:18:01 -0500
Subject: [PATCH 094/311] New util to hide all background GUI (for dialog)
---
scripts/client/gui.js | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 959b1f01..2093a6d6 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -283,4 +283,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
From a8a173e406c37568d53cb46474915a3f68013a18 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:18:15 -0500
Subject: [PATCH 095/311] Don't disable locale chooser
---
scripts/client/gui/localechooser.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js
index a5402319..dc7dcdb5 100644
--- a/scripts/client/gui/localechooser.js
+++ b/scripts/client/gui/localechooser.js
@@ -58,7 +58,7 @@ function closeLocaleChooserGUI() {
function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
// Disabled for now until image loading crash can be fixed
- return false;
+ //return false;
if (position.x != 0.0 && position.y != 0.0) {
localeChooser.window.position = position;
From 024051b9f89dddd9993c6ef825401540a795ec8d Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:18:24 -0500
Subject: [PATCH 096/311] Use primary text colour on buttons
---
scripts/client/gui/login.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/client/gui/login.js b/scripts/client/gui/login.js
index edc8cc5a..15e06828 100644
--- a/scripts/client/gui/login.js
+++ b/scripts/client/gui/login.js
@@ -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,
From be476f5d9c580af09169e8ab05bc53ea7c5aaddd Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:19:13 -0500
Subject: [PATCH 097/311] Render logo on MafiaC
---
scripts/client/logo.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/client/logo.js b/scripts/client/logo.js
index 6b512677..8f51c260 100644
--- a/scripts/client/logo.js
+++ b/scripts/client/logo.js
@@ -23,9 +23,9 @@ function initLogoScript() {
// ===========================================================================
function loadLogoImage() {
- if (getGame() == AGRP_GAME_MAFIA_ONE) {
- return false;
- }
+ //if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ // return false;
+ //}
let logoStream = openFile(mainLogoPath);
let tempLogoImage = null;
From ba900addc5e18fd5943df0c05a3ec30cf89570d1 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:19:27 -0500
Subject: [PATCH 098/311] Add map change warning state
---
scripts/client/main.js | 3 ++-
scripts/client/netevents.js | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/client/main.js b/scripts/client/main.js
index 7acf8a4a..d6c0da81 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -61,6 +61,7 @@ let interiorLightsEnabled = true;
let interiorLightsColour = toColour(0, 0, 0, 150);
let mouseCameraEnabled = false;
+let mouseCursorEnabled = false;
let currentPickup = false;
@@ -97,6 +98,6 @@ let localPlayerMoneyInterval = null;
let currencyString = "${AMOUNT}";
-
+let mapChangeWarning = false;
// ===========================================================================
diff --git a/scripts/client/netevents.js b/scripts/client/netevents.js
index b4baa247..ff59f073 100644
--- a/scripts/client/netevents.js
+++ b/scripts/client/netevents.js
@@ -108,6 +108,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.changePassword", showChangePasswordGUI);
addNetworkEventHandler("agrp.showLocaleChooser", showLocaleChooserGUI);
addNetworkEventHandler("agrp.guiColour", setGUIColours);
+ addNetworkEventHandler("agrp.mapChangeWarning", setMapChangeWarningState);
// 2D Rendering
addNetworkEventHandler("agrp.set2DRendering", set2DRendering);
@@ -449,4 +450,10 @@ function receiveCurrencyStringFromServer(newCurrencyString) {
currencyString = newCurrencyString;
}
+// ===========================================================================
+
+function setMapChangeWarningState(state) {
+ mapChangeWarning = state;
+}
+
// ===========================================================================
\ No newline at end of file
From 47aa32d66ff56b4b9060e8ff91d294ca241422bf Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:19:42 -0500
Subject: [PATCH 099/311] Add utils to remove all players from biz/house/vehs
---
scripts/server/utilities.js | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js
index 47e17f5d..a3a9abcb 100644
--- a/scripts/server/utilities.js
+++ b/scripts/server/utilities.js
@@ -483,7 +483,28 @@ function updateAllPlayerWeaponDamageStates() {
// ===========================================================================
function removeAllPlayersFromProperties() {
+ let clients = getClients();
+ for (let i in clients) {
+ if (isPlayerInAnyBusiness(clients[i])) {
+ removePlayerFromBusiness(clients[i]);
+ }
+ if (isPlayerInAnyHouse(clients[i])) {
+ removePlayerFromHouse(clients[i]);
+ }
+ }
+ return false;
+}
+
+// ===========================================================================
+
+function removeAllPlayersFromVehicles() {
+ let clients = getClients();
+ for (let i in clients) {
+ if (isPlayerInAnyVehicle(clients[i])) {
+ removePlayerFromVehicle(clients[i]);
+ }
+ }
return false;
}
From 40b63b3403778c139d26ad2e2a7ddd7d33d0d165 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:20:02 -0500
Subject: [PATCH 100/311] Add Mafia font for big/small game messages
---
scripts/client/messaging.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/client/messaging.js b/scripts/client/messaging.js
index 6cec4b3b..4a0f2415 100644
--- a/scripts/client/messaging.js
+++ b/scripts/client/messaging.js
@@ -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");
From d80f04637c59886cb59577912b500fd84cce651c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:20:11 -0500
Subject: [PATCH 101/311] Init cursor script
---
scripts/client/startup.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/client/startup.js b/scripts/client/startup.js
index 2ee5b7d7..c8ce9e8f 100644
--- a/scripts/client/startup.js
+++ b/scripts/client/startup.js
@@ -21,6 +21,7 @@ function initClientScripts() {
initKeyBindScript();
initEventScript();
initSkinSelectScript();
+ initCursorScript();
addAllNetworkHandlers();
}
From 582fce87575fc89e2fcd0e5b0fb258bc63320da0 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:20:22 -0500
Subject: [PATCH 102/311] Use more locale strings
---
scripts/server/account.js | 77 +++++++++++++++++++++++----------------
1 file changed, 45 insertions(+), 32 deletions(-)
diff --git a/scripts/server/account.js b/scripts/server/account.js
index b7d44d0f..b3271070 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -497,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"));
}
// ===========================================================================
@@ -593,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;
}
@@ -646,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)) {
@@ -850,7 +850,7 @@ function loginSuccess(client) {
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);
@@ -1067,7 +1067,7 @@ 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);
}
@@ -1076,7 +1076,7 @@ function checkLogin(client, password) {
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
} else {
- messagePlayerError(client, "You are already logged in!");
+ messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
}
return false;
@@ -1097,10 +1097,10 @@ function checkLogin(client, password) {
if (areParamsEmpty(password)) {
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.`);
+ 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.`);
+ 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.`);
}
@@ -1114,10 +1114,10 @@ function checkLogin(client, password) {
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
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.`);
+ 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.`);
+ 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.`);
}
@@ -1178,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;
@@ -1214,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;
}
@@ -1234,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;
}
@@ -1254,7 +1267,7 @@ 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);
@@ -1316,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;
}
@@ -1355,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));
@@ -1662,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);
@@ -1697,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);
@@ -1709,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);
@@ -1727,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;
}
@@ -1760,7 +1773,7 @@ function checkPlayerTwoFactorAuthentication(client, authCode) {
}
}
- getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
+ getPlayerData(client).customDisconnectReason = "FailedToLogin";
disconnectPlayer(client);
return false;
}
@@ -1773,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;
}
@@ -1788,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);
From 4464b3f49a7d06cb4ab247907c84e38c07098da0 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:20:45 -0500
Subject: [PATCH 103/311] Use disconnect names
---
scripts/server/ban.js | 8 +++---
scripts/server/event.js | 57 ++++++++++++++++++++++-------------------
2 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/scripts/server/ban.js b/scripts/server/ban.js
index 10b337c8..74ba35f3 100644
--- a/scripts/server/ban.js
+++ b/scripts/server/ban.js
@@ -71,7 +71,7 @@ function accountBanCommand(command, params, client) {
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);
}
@@ -103,7 +103,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
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/event.js b/scripts/server/event.js
index 0f156803..62a92281 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -99,35 +99,42 @@ function onElementStreamOut(event, element, client) {
// ===========================================================================
function onPlayerQuit(event, client, quitReasonId) {
- logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
+ let disconnectName = disconnectReasons[quitReasonId];
+
+ let reasonTextEnglish = getLanguageGroupedLocaleString(englishLocale, "DisconnectReasons", disconnectName);
+
updateConnectionLogOnQuit(client, quitReasonId);
- let reasonText = disconnectReasons[quitReasonId];
if (getPlayerData(client) != false) {
if (getPlayerData(client).customDisconnectReason != "") {
- reasonText = getPlayerData(client).customDisconnectReason;
+ disconnectName = getPlayerData(client).customDisconnectReason;
}
}
- //messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${reasonText})`, getColourByName("softYellow"));
+ logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`);
+ messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${getLanguageGroupedLocaleString(englishLocale, "DisconnectReasons", reasonTextEnglish)})`);
- //if (isPlayerFishing(client)) {
- // stopFishing(client);
- //}
-
- if (isPlayerInPaintBall(client)) {
- stopPaintBall(client);
- }
-
- if (isPlayerOnJobRoute(client)) {
- stopJobRoute(client, false, false);
- }
-
- if (isPlayerWorking(client)) {
- stopWorking(client);
- }
+ getClients().forEach(forClient => {
+ messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", getPlayerName(client), getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName)));
+ });
if (isPlayerLoggedIn(client)) {
+ if (isPlayerInPaintBall(client)) {
+ stopPaintBall(client);
+ }
+
+ if (isPlayerOnJobRoute(client)) {
+ stopJobRoute(client, false, false);
+ }
+
+ if (isPlayerWorking(client)) {
+ stopWorking(client);
+ }
+
+ //if (isPlayerFishing(client)) {
+ // stopFishing(client);
+ //}
+
savePlayerToDatabase(client);
resetClientStuff(client);
}
@@ -136,11 +143,7 @@ function onPlayerQuit(event, client, quitReasonId) {
clearTimeout(getPlayerData(client).loginTimeout);
}
- messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${reasonText})`);
- getClients().forEach(forClient => {
- let reasonText = getGroupedLocaleString(forClient, "DisconnectReasons", quitReasonId);
- messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", getPlayerName(client), reasonText));
- });
+
playerResourceReady[client.index] = false;
playerResourceStarted[client.index] = false;
@@ -432,7 +435,7 @@ async function onPlayerSpawn(client) {
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
if (!getPlayerData(client)) {
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
- getPlayerData(targetClient).customDisconnectReason = `Kicked - Spawn bug. Data invalid.`;
+ getPlayerData(targetClient).customDisconnectReason = "Desync";
disconnectPlayer(client);
return false;
}
@@ -440,7 +443,7 @@ async function onPlayerSpawn(client) {
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
if (!isPlayerLoggedIn(client)) {
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
- getPlayerData(targetClient).customDisconnectReason = `Kicked - Tried to force spawn without logging in.`;
+ getPlayerData(targetClient).customDisconnectReason = "Desync";
disconnectPlayer(client);
return false;
}
@@ -448,7 +451,7 @@ async function onPlayerSpawn(client) {
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
if (getPlayerData(client).currentSubAccount == -1) {
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
- getPlayerData(targetClient).customDisconnectReason = `Kicked - Tried to force spawn without selecting a character.`;
+ getPlayerData(targetClient).customDisconnectReason = "Desync";
disconnectPlayer(client);
return false;
}
From eab0d96e5d6becb437eab193db2650f23429527e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:20:53 -0500
Subject: [PATCH 104/311] Add new action tips flag names
---
scripts/server/bitflag.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index 194aa69e..d175fc56 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -251,6 +251,15 @@ let serverBitFlagKeys = {
"RadioCommandAfterEnablingWalkieTalkie",
"ReplyToDirectMessage",
"UseItemKeyAmmoAfterEquippingWeapon",
+ "AnimationStop",
+ "JobEquipmentInventory",
+ "ViewInventory",
+ "VehicleRepairItemUsage",
+ "VehicleColourItemUsage",
+ "VehiclePartItemUsage",
+ "AmmoClipItemUsage",
+ "GenericItemUsage",
+ "EnterJobVehicleForRoute",
],
jobRankKeys: [
"None",
From 0542a3da5a9f4176f58551e9ac600d8fc73d1e43 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:21:02 -0500
Subject: [PATCH 105/311] Use disconnect name
---
scripts/server/client.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 2fb309eb..587dcf6c 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -187,7 +187,7 @@ function resetClientStuff(client) {
function kickAllClients() {
getClients().forEach((client) => {
- getPlayerData(client).customDisconnectReason = `Kicked - All clients are being disconnected`;
+ getPlayerData(client).customDisconnectReason = "ServerRestarting";
disconnectPlayer(client);
})
}
From 07af18c64eef726522d640cc948f36cca11b4a60 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:21:23 -0500
Subject: [PATCH 106/311] Use verbose log level for each add command handler
---
scripts/server/command.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/command.js b/scripts/server/command.js
index 26a2e50a..6b45fe5a 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -704,7 +704,7 @@ function addAllCommandHandlers() {
let commands = getCommands();
for (let i in commands) {
for (let j in commands[i]) {
- logToConsole(LOG_DEBUG, `[AGRP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
addCommandHandler(commands[i][j].command, processPlayerCommand);
commandCount++;
}
From 5c5b255196fcbde237f2fcb3874ebb25a0368feb Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:21:37 -0500
Subject: [PATCH 107/311] Use async/await for email
---
scripts/server/developer.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/developer.js b/scripts/server/developer.js
index a9c6c91e..3a87fc1f 100644
--- a/scripts/server/developer.js
+++ b/scripts/server/developer.js
@@ -449,10 +449,10 @@ function saveServerDataCommand(command, params, client) {
// ===========================================================================
-function testEmailCommand(command, params, client) {
+async function testEmailCommand(command, params, client) {
try {
messagePlayerAlert(client, `Sending test email to ${params}`);
- sendEmail(params, "Player", "Test email", "Just testing the SMTP module for the server!");
+ await sendEmail(params, "Player", "Test email", "Just testing the SMTP module for the server!");
} catch (error) {
messagePlayerError(client, "The email could not be sent! Error: ${error}");
return false;
From a17923450a23e1d1a4e5668b76a6f07cb1b1b166 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:21:47 -0500
Subject: [PATCH 108/311] Add HTTP request support for email
---
scripts/server/email.js | 69 +++++++++++++++++++++++++++++++----------
1 file changed, 52 insertions(+), 17 deletions(-)
diff --git a/scripts/server/email.js b/scripts/server/email.js
index 776e9d53..319ac181 100644
--- a/scripts/server/email.js
+++ b/scripts/server/email.js
@@ -8,6 +8,13 @@
// TYPE: Server (JavaScript)
// ===========================================================================
+// Email Methods
+const AGRP_EMAIL_METHOD_NONE = 0; // None
+const AGRP_EMAIL_METHOD_SMTP_MODULE = "smtp"; // Use SMTP module
+const AGRP_EMAIL_METHOD_GET_REQUEST = "http"; // Use HTTP request (httpGet to custom PHP page)
+
+// ===========================================================================
+
function initEmailScript() {
logToConsole(LOG_INFO, "[AGRP.Email]: Initializing email script ...");
logToConsole(LOG_INFO, "[AGRP.Email]: Email script initialized successfully!");
@@ -16,25 +23,53 @@ function initEmailScript() {
// ===========================================================================
async function sendEmail(toEmail, toName, subject, body) {
- if (!checkForSMTPModule()) {
- return false;
+ switch (getEmailConfig().method) {
+ case AGRP_EMAIL_METHOD_SMTP_MODULE:
+ if (!checkForSMTPModule()) {
+ return false;
+ }
+
+ Promise.resolve().then(() => {
+ module.smtp.send(
+ getEmailConfig().smtp.host,
+ getEmailConfig().smtp.port,
+ intToBool(getEmailConfig().smtp.useTLS),
+ getEmailConfig().smtp.username,
+ getEmailConfig().smtp.password,
+ toEmail,
+ toName,
+ subject,
+ body,
+ getEmailConfig().smtp.from,
+ getEmailConfig().smtp.fromName
+ );
+ });
+ break;
+
+ case AGRP_EMAIL_METHOD_GET_REQUEST:
+ let tempURL = getEmailConfig().http.baseUrl;
+ tempURL = tempURL.replace("{0}", encodeURI(password));
+ tempURL = tempURL.replace("{1}", encodeURI(toEmail));
+ tempURL = tempURL.replace("{2}", encodeURI(toName));
+ tempURL = tempURL.replace("{3}", encodeURI(subject));
+ tempURL = tempURL.replace("{4}", encodeURI(body));
+
+ httpGet(
+ tempURL,
+ "",
+ function (data) {
+
+ },
+ function (data) {
+ }
+ );
+ break;
+
+ default:
+ return false;
}
- Promise.resolve().then(() => {
- module.smtp.send(
- getEmailConfig().smtp.host,
- getEmailConfig().smtp.port,
- intToBool(getEmailConfig().smtp.useTLS),
- getEmailConfig().smtp.username,
- getEmailConfig().smtp.password,
- toEmail,
- toName,
- subject,
- body,
- getEmailConfig().smtp.from,
- getEmailConfig().smtp.fromName
- );
- });
+ return true;
}
// ===========================================================================
From e7655f1e7056ab31665d20b3d7f1a544bb79cba7 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:21:54 -0500
Subject: [PATCH 109/311] Use disconnect name
---
scripts/server/gui.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/gui.js b/scripts/server/gui.js
index 10e24b3c..10d28116 100644
--- a/scripts/server/gui.js
+++ b/scripts/server/gui.js
@@ -39,7 +39,7 @@ function playerPromptAnswerNo(client) {
case AGRP_PROMPT_CREATEFIRSTCHAR:
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} chose not to create a first character. Kicking them from the server ...`);
showPlayerErrorGUI(client, "You don't have a character to play. Goodbye!", "No Characters");
- getPlayerData(targetClient).customDisconnectReason = `Kicked - Didn't create a character`;
+ getPlayerData(targetClient).customDisconnectReason = "FailedToCreateCharacter";
setTimeout(function () { disconnectPlayer(client); }, 5000);
break;
From b0652947ccc054f77ad2a3c294b43160ef88d8d4 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:22:03 -0500
Subject: [PATCH 110/311] Use more locale strings
---
scripts/server/job.js | 83 +++++++++++++++++++++++++++----------------
1 file changed, 52 insertions(+), 31 deletions(-)
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 82eadb65..7a912110 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -904,7 +904,7 @@ function jobListCommand(command, params, client) {
function takeJobCommand(command, params, client) {
if (!canPlayerUseJobs(client)) {
- messagePlayerError(client, "You are not allowed to use any jobs!");
+ messagePlayerError(client, getLocaleString(client, "NotAllowedToUseJobs"));
return false;
}
@@ -912,7 +912,7 @@ function takeJobCommand(command, params, client) {
let jobData = getJobData(closestJobLocation.jobIndex);
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().takeJobDistance) {
- messagePlayerError(client, "There are no job points close enough!");
+ messagePlayerError(client, getLocaleString(client, "NoJobLocationCloseEnough"));
return false;
}
@@ -922,12 +922,12 @@ function takeJobCommand(command, params, client) {
}
if (!canPlayerUseJob(client, closestJobLocation.jobIndex)) {
- messagePlayerError(client, "You can't use this job!");
+ messagePlayerError(client, getLocaleString(client, "CantUseThisJob"));
return false;
}
takeJob(client, closestJobLocation.jobIndex);
- messagePlayerSuccess(client, `{MAINCOLOUR}You now have the {jobYellow}${jobData.name} {MAINCOLOUR}job`);
+ messagePlayerSuccess(client, getLocaleString(client, "JobChanged", `{jobYellow}${jobData.name}{MAINCOLOUR}`));
return true;
}
@@ -944,7 +944,7 @@ function startWorkingCommand(command, params, client) {
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
let closestVehicle = getClosestVehicle(getPlayerPosition(client));
if (getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
- messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeNearJob"));
return false;
}
@@ -961,13 +961,13 @@ function startWorkingCommand(command, params, client) {
jobData = getJobData(getJobIdFromDatabaseId(getVehicleData(closestVehicle).ownerId));
} else {
if (getPlayerCurrentSubAccount(client).job == AGRP_JOB_NONE) {
- messagePlayerError(client, "You don't have a job!");
+ messagePlayerError(client, getLocaleString(client, "DontHaveAJob"));
messagePlayerInfo(client, "You can get a job by going the yellow points on the map.");
return false;
}
if (getPlayerCurrentSubAccount(client).job != closestJobLocation.jobId) {
- messagePlayerError(client, "This is not your job!");
+ messagePlayerError(client, getLocaleString(client, "NotYourJob"));
messagePlayerInfo(client, getLocaleString(client, "QuitJobToTakeAnother", "{ALTCOLOUR}/quitjob{MAINCOLOUR}"));
return false;
}
@@ -980,11 +980,16 @@ function startWorkingCommand(command, params, client) {
return false;
}
- messagePlayerSuccess(client, `💼 You are now working for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
+ messagePlayerSuccess(client, getLocaleString(client, "StartedWorking", jobData.name));
messageDiscordEventChannel(`💼 ${getCharacterFullName(client)} started working for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
startWorking(client);
- //messagePlayerNewbieTip(client, `Enter a job vehicle to get started!`);
+
+ if (doesJobLocationHaveAnyRoutes(closestJobLocation)) {
+ if (hasPlayerSeenActionTip(client, "EnterJobVehicleForRoute")) {
+ messagePlayerTip(client, getIndexedLocaleString(client, "ActionTips", "EnterJobVehicleForRoute"));
+ }
+ }
return true;
}
@@ -996,13 +1001,13 @@ function stopWorkingCommand(command, params, client) {
}
if (!isPlayerWorking(client)) {
- messagePlayerError(client, "You are not working!");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeWorking", "{ALTCOLOUR}/startwork{MAINCOLOUR}"));
return false;
}
deleteJobItems(client);
stopWorking(client);
- messagePlayerSuccess(client, "You have stopped working!");
+ messagePlayerSuccess(client, getLocaleString(client, "StoppedWorking"));
return true;
}
@@ -1017,7 +1022,7 @@ function startWorking(client) {
getPlayerCurrentSubAccount(client).skin = getPlayerSkin(client);
storePlayerItemsInTempLocker(client);
getPlayerData(client).tempLockerType = AGRP_TEMP_LOCKER_TYPE_JOB;
- messagePlayerInfo(client, "Your personal items have been stored in your locker while you work");
+ messagePlayerInfo(client, getLocaleString(client, "ItemsStoredForJob"));
getPlayerCurrentSubAccount(client).isWorking = true;
@@ -1067,7 +1072,7 @@ function startWorking(client) {
function getJobInfoCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client), getPlayerDimension(client));
- messagePlayerInfo(client, `{jobYellow}[Job Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getJobData(closestJobLocation.jobIndex).name}, {MAINCOLOUR}Enabled: {ALTCOLOUR}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.jobIndex).enabled))}, {MAINCOLOUR}Whitelisted: {ALTCOLOUR}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.jobIndex).whiteListEnabled))}, {MAINCOLOUR}Blacklisted: {ALTCOLOUR}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.jobIndex).blackListEnabled))}, {MAINCOLOUR}ID: {ALTCOLOUR}${getJobData(closestJobLocation.jobIndex).databaseId}/${closestJobLocation.jobIndex}`);
+ messagePlayerInfo(client, `{jobYellow}[Job Info] {MAINCOLOUR}Name:{ALTCOLOUR} ${getJobData(closestJobLocation.jobIndex).name}, {MAINCOLOUR}Enabled:{ALTCOLOUR} ${getYesNoFromBool(intToBool(getJobData(closestJobLocation.jobIndex).enabled))}, {MAINCOLOUR}Whitelisted:{ALTCOLOUR} ${getYesNoFromBool(intToBool(getJobData(closestJobLocation.jobIndex).whiteListEnabled))}, {MAINCOLOUR}Blacklisted:{ALTCOLOUR} ${getYesNoFromBool(intToBool(getJobData(closestJobLocation.jobIndex).blackListEnabled))}, {MAINCOLOUR}ID:{ALTCOLOUR} ${getJobData(closestJobLocation.jobIndex).databaseId}/${closestJobLocation.jobIndex}`);
}
// ===========================================================================
@@ -1075,7 +1080,7 @@ function getJobInfoCommand(command, params, client) {
function getJobLocationInfoCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client), getPlayerDimension(client));
- messagePlayerInfo(client, `{jobYellow}[Job Location Info] {MAINCOLOUR}Job: {ALTCOLOUR}${getJobData(closestJobLocation.jobIndex).name} (${getJobData(closestJobLocation.jobIndex).databaseId}/${closestJobLocation.jobIndex}), {MAINCOLOUR}Enabled: {ALTCOLOUR}${getYesNoFromBool(closestJobLocation.enabled)}, {MAINCOLOUR}Database ID: {ALTCOLOUR}${closestJobLocation.databaseId}`);
+ messagePlayerInfo(client, `{jobYellow}[Job Location Info] {MAINCOLOUR}Job:{ALTCOLOUR} ${getJobData(closestJobLocation.jobIndex).name} (${getJobData(closestJobLocation.jobIndex).databaseId}/${closestJobLocation.jobIndex}), {MAINCOLOUR}Enabled:{ALTCOLOUR} ${getYesNoFromBool(closestJobLocation.enabled)}, {MAINCOLOUR}Database ID:{ALTCOLOUR} ${closestJobLocation.databaseId}`);
}
// ===========================================================================
@@ -1148,6 +1153,7 @@ function stopWorking(client) {
let jobId = getPlayerJob(client);
messageDiscordEventChannel(`💼 ${getCharacterFullName(client)} has stopped working as a ${getJobData(jobId).name}`);
+ /*
switch (getJobType(jobId)) {
case AGRP_JOB_POLICE:
messagePlayerInfo(client, "Your uniform, equipment, and vehicle have been returned to the police station");
@@ -1186,6 +1192,7 @@ function stopWorking(client) {
default:
break;
}
+ */
updatePlayerNameTag(client);
sendPlayerWorkingState(client, false);
@@ -1200,12 +1207,12 @@ function jobUniformCommand(command, params, client) {
}
if (!doesPlayerHaveAnyJob(client)) {
- messagePlayerError(client, "You don't have a job!");
+ messagePlayerError(client, getLocaleString(client, "DontHaveAJob"));
return false;
}
if (!isPlayerWorking(client)) {
- messagePlayerError(client, "You are not working! Use /startwork at your job location or a job vehicle.");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeWorking", `{ALTCOLOUR}/startwork{MAINCOLOUR}`));
return false;
}
@@ -1215,7 +1222,7 @@ function jobUniformCommand(command, params, client) {
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
let closestVehicle = getClosestVehicle(getPlayerPosition(client));
if (getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
- messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeNearJob"));
return false;
}
@@ -1303,12 +1310,12 @@ function jobEquipmentCommand(command, params, client) {
}
if (!doesPlayerHaveAnyJob(client)) {
- messagePlayerError(client, "You don't have a job!");
+ messagePlayerError(client, getLocaleString(client, "DontHaveAJob"));
return false;
}
if (!isPlayerWorking(client)) {
- messagePlayerError(client, "You are not working! Use /startwork at your job location.");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeWorking", `{ALTCOLOUR}/startwork{MAINCOLOUR}`));
return false;
}
@@ -1318,7 +1325,7 @@ function jobEquipmentCommand(command, params, client) {
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
let closestVehicle = getClosestVehicle(getPlayerPosition(client));
if (getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
- messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeNearJob"));
return false;
}
@@ -1336,12 +1343,15 @@ function jobEquipmentCommand(command, params, client) {
} else {
if (getPlayerCurrentSubAccount(client).job == AGRP_JOB_NONE) {
messagePlayerError(client, getLocaleString(client, "NotYourJob"));
- messagePlayerInfo(client, getLocaleString(client, "JobPoints"));
+
+ if (hasPlayerSeenActionTip(client, "JobLocations")) {
+ messagePlayerInfo(client, getGroupedLocaleString(client, "ActionTips", "JobPoints", "{ALTCOLOUR}/gps{MAINCOLOUR}"));
+ }
return false;
}
if (getPlayerCurrentSubAccount(client).job != closestJobLocation.jobId) {
- messagePlayerError(client, "This is not your job!");
+ messagePlayerError(client, getLocaleString(client, "NotYourJob"));
messagePlayerInfo(client, getLocaleString(client, "QuitJobToTakeAnother", "{ALTCOLOUR}/quitjob{MAINCOLOUR}"));
return false;
}
@@ -1377,7 +1387,7 @@ function jobEquipmentCommand(command, params, client) {
}
if (equipmentId < 1 || equipmentId > equipments.length) {
- messagePlayerError(client, "That equipment ID is invalid!");
+ messagePlayerError(client, getLocaleString(client, "InvalidJobEquipment"));
return false;
}
@@ -1552,7 +1562,7 @@ function createJobLocationCommand(command, params, client) {
let jobId = getJobFromParams(params);
if (!getJobData(jobId)) {
- messagePlayerError(client, "That job was not found!");
+ messagePlayerError(client, getLocaleString(client, "InvalidJob"));
return false;
}
@@ -1747,7 +1757,7 @@ function toggleJobRouteEnabledCommand(command, params, client) {
if (isPlayerOnJobRoute(clients[i])) {
if (getPlayerJob(clients[i]) == jobId && getPlayerJobRoute(clients[i]) == jobRoute) {
stopJobRoute(clients[i], true, false);
- messagePlayerAlert(clients[i], "The job route you were on has been disabled by an admin");
+ messagePlayerAlert(clients[i], getLocaleString(clients[i], "CurrentJobRouteDeleted"));
}
}
}
@@ -2308,27 +2318,32 @@ function forceAllPlayersToStopWorking() {
function jobStartRouteCommand(command, params, client) {
if (!canPlayerUseJobs(client)) {
- messagePlayerError(client, "You are not allowed to use jobs.");
+ messagePlayerError(client, getLocaleString(client, "NotAllowedToUseJobs"));
return false;
}
if (!isPlayerWorking(client)) {
- messagePlayerError(client, "You aren't working yet! Use /startwork first.");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeWorking", "{ALTCOLOUR}/startwork{MAINCOLOUR}"));
return false;
}
if (getJobData(getPlayerJob(client)).routes.length == 0) {
- messagePlayerError(client, "Your job doesn't have any routes for this location!");
+ messagePlayerError(client, getLocaleString(client, "NoRoutesForJobLocation"));
+ return false;
+ }
+
+ if (!isPlayerInAnyVehicle(client)) {
+ messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle"));
return false;
}
if (!isPlayerInJobVehicle(client)) {
- messagePlayerError(client, "You need to be in a vehicle that belongs to your job!");
+ messagePlayerError(client, getLocaleString(client, "NeedToBeInJobVehicle"));
return false;
}
if (isPlayerOnJobRoute(client)) {
- messagePlayerError(client, "You're already on a job route! Finish the route or use /stoproute");
+ messagePlayerError(client, getLocaleString(client, "AlreadyOnJobRoute", "{ALTCOLOUR}/stoproute{MAINCOLOUR}"));
return false;
}
@@ -3428,7 +3443,7 @@ function createJobRouteCommand(command, params, client) {
}
if (isPlayerOnJobRoute(client)) {
- messagePlayerError(client, getLocaleString(client, "AlreadyOnJobRoute", "{ALTCOLOUR}/startroute{MAINCOLOUR}"));
+ messagePlayerError(client, getLocaleString(client, "AlreadyOnJobRoute", "{ALTCOLOUR}/stoproute{MAINCOLOUR}"));
return false;
}
@@ -4084,4 +4099,10 @@ function createAllJobRouteLocationMarkers() {
}
}
+// ===========================================================================
+
+function doesJobLocationHaveAnyRoutes(jobLocationData) {
+ return (getRandomJobRouteForLocation(jobLocationData) != -1);
+}
+
// ===========================================================================
\ No newline at end of file
From 51d5aba2a1b0a9a7611a9d601204e07e6facd793 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:22:16 -0500
Subject: [PATCH 111/311] Woops wrong locale key name
---
scripts/server/keybind.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/keybind.js b/scripts/server/keybind.js
index afaae507..0e1617a2 100644
--- a/scripts/server/keybind.js
+++ b/scripts/server/keybind.js
@@ -78,7 +78,7 @@ function removeKeyBindCommand(command, params, client) {
if (!keyId) {
messagePlayerError(client, getLocaleString(client, "InvalidKeyBindName"));
messagePlayerTip(client, getLocaleString(client, "KeyBindNameTip"));
- messagePlayerInfo(client, getLocaleString(client, "UniversalInlineExampleList", `{ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl{MAINCOLOR}`));
+ messagePlayerInfo(client, getLocaleString(client, "UniversalInlineExamplesList", `{ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl{MAINCOLOR}`));
return false;
}
From beb9f6cafe7c076b4d3a15b9bfd188f16868f1d8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:22:31 -0500
Subject: [PATCH 112/311] Add grouped locale string util for locale ID
---
scripts/server/locale.js | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/scripts/server/locale.js b/scripts/server/locale.js
index 466bea11..53435db2 100644
--- a/scripts/server/locale.js
+++ b/scripts/server/locale.js
@@ -23,6 +23,10 @@ class LocaleData {
// ===========================================================================
+let englishLocale = 0;
+
+// ===========================================================================
+
function initLocaleScript() {
logToConsole(LOG_DEBUG, "[AGRP.Locale]: Initializing locale script ...");
logToConsole(LOG_INFO, "[AGRP.Locale]: Locale script initialized!");
@@ -68,6 +72,23 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
// ===========================================================================
+function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
+ let tempString = getRawGroupedLocaleString(stringName, index, localeId);
+ if (tempString == "" || tempString == null || typeof tempString == "undefined") {
+ logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
+ submitBugReport(null, `(AUTOMATED REPORT) Locale string index ${index} of "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
+ return "";
+ }
+
+ for (let i = 1; i <= args.length; i++) {
+ tempString = tempString.replace(`{${i}}`, args[i - 1]);
+ }
+
+ return tempString;
+}
+
+// ===========================================================================
+
function getGroupedLocaleString(client, stringName, index, ...args) {
if (client == null) {
return "";
From 604f9e7cd9dda157eca4954de6dad216964bd37e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:22:42 -0500
Subject: [PATCH 113/311] Cleanup
---
scripts/server/native/connected.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 96ae58fd..98b92217 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -24,18 +24,18 @@ let builtInCommands = [
// ===========================================================================
let disconnectReasons = [
- "Lost Connection",
+ "LostConnection",
"Disconnected",
- "Unsupported Client",
- "Wrong Game",
- "Incorrect Password",
- "Unsupported Executable",
+ "UnsupportedClient",
+ "WrongGame",
+ "IncorrectPassword",
+ "UnsupportedExecutable",
"Disconnected",
"Banned",
"Failed",
- "Invalid Name",
+ "InvalidName",
"Crashed",
- "Modified Game"
+ "ModifiedGame"
];
// ===========================================================================
From 056d35456c3dc13a5b9df56cc451e16e491b2b1a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:23:01 -0500
Subject: [PATCH 114/311] Use font based on game + map change warning netevent
---
scripts/server/netevents.js | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js
index dfaa010e..12869e6a 100644
--- a/scripts/server/netevents.js
+++ b/scripts/server/netevents.js
@@ -132,14 +132,20 @@ function playerClientStarted(client) {
function playerClientStopped(client) {
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
- getPlayerData(client).customDisconnectReason = `Kicked - Client script verification failed.`;
+ getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
disconnectPlayer(client);
}
// ===========================================================================
-function showSmallGameMessage(client, text, colour, duration, fontName = "Pricedown") {
+function showSmallGameMessage(client, text, colour, duration, fontName = "Roboto") {
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
+
+ if (getGame() <= AGRP_GAME_GTA_IV_EFLC) {
+ fontName = "Pricedown";
+ } else {
+ fontName = "AuroraBdCnBT";
+ }
sendNetworkEventToPlayer("agrp.smallGameMessage", client, text, colour, duration, fontName);
}
@@ -1291,8 +1297,13 @@ function sendMapChangeWarningToPlayer(client, changingToNight) {
// ==========================================================================
function playerMapLoaded(client, mapName) {
-
//updateAllInteriorVehiclesForPlayer(client, propertyData.exitInterior, propertyData.exitDimension);
}
+// ==========================================================================
+
+function setMapChangeWarningForPlayer(client, isChanging) {
+ sendNetworkEventToPlayer("agrp.mapChangeWarning", client, isChanging);
+}
+
// ==========================================================================
\ No newline at end of file
From 338cfb7d38fa208f933215ea6c4b14c9b6b87bbc Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:23:17 -0500
Subject: [PATCH 115/311] Add staff note commands
---
scripts/server/staff.js | 81 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 80 insertions(+), 1 deletion(-)
diff --git a/scripts/server/staff.js b/scripts/server/staff.js
index 32d3cf4d..f0a09f28 100644
--- a/scripts/server/staff.js
+++ b/scripts/server/staff.js
@@ -46,7 +46,7 @@ function kickClientCommand(command, params, client) {
//getPlayerData(targetClient).customDisconnectReason = reason;
announceAdminAction(`PlayerKicked`, getPlayerName(targetClient));
- getPlayerData(targetClient).customDisconnectReason = `Kicked - ${reason}`;
+ getPlayerData(targetClient).customDisconnectReason = "Kicked";
disconnectPlayer(targetClient);
}
@@ -1813,4 +1813,83 @@ function getPlayerCurrentBusinessCommand(command, params, client) {
return true;
}
+// ===========================================================================
+
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function addAccountStaffNoteCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let noteMessage = params.split(" ").slice(1).join(" ");
+
+ if (!getPlayerData(targetClient)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
+ return false;
+ }
+ //let dbConnection = connectToDatabase();
+ //let safeNoteMessage = escapeDatabaseString(dbConnection, noteMessage);
+ //queryDatabase(dbConnection, `INSERT INTO acct_note (acct_note_acct, acct_note_server, acct_note_message, acct_note_who_added, acct_note_when_added) VALUES (${getPlayerData(targetClient).accountData.databaseId}, ${getServerId()}, ${safeNoteMessage}, ${}, UNIX_TIMESTAMP())`);
+
+ let tempNoteData = new AccountStaffNoteData();
+ tempNoteData.whoAdded = getPlayerData(client).accountData.databaseId;
+ tempNoteData.whenAdded = getCurrentUnixTimestamp();
+ tempNoteData.note = noteMessage;
+ tempNoteData.account = getPlayerData(targetClient).databaseId;
+ tempNoteData.serverId = getServerId();
+ tempNoteData.deleted = false;
+ tempNoteData.needsSaved = true;
+ getPlayerData(targetClient).accountData.staffNotes.push(tempNoteData);
+
+ messageAdmins(`{adminOrange}${client.name}{MAINCOLOUR} added a staff note for {ALTCOLOUR}${targetClient.name}{MAINCOLOUR}: ${noteMessage}`);
+ return true;
+}
+
+// ===========================================================================
+
+/**
+ * This is a command handler function.
+ *
+ * @param {string} command - The command name used by the player
+ * @param {string} params - The parameters/args string used with the command by the player
+ * @param {Client} client - The client/player that used the command
+ * @return {bool} Whether or not the command was successful
+ *
+ */
+function showAccountStaffNotesCommand(command, params, client) {
+ if (areParamsEmpty(params)) {
+ messagePlayerSyntax(client, getCommandSyntaxText(command));
+ return false;
+ }
+
+ let targetClient = getPlayerFromParams(getParam(params, " ", 1));
+ let noteMessage = params.split(" ").slice(1).join(" ");
+
+ if (!getPlayerData(targetClient)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
+ return false;
+ }
+
+ let staffNoteList = getPlayerData(targetClient).accountData.staffNotes.map(function (x, i, a) { return `{ALTCOLOUR}${toInteger(i) + 1}. (Added by ${loadAccountFromId(x.whoAdded).name} on ${new Date(x.whenAdded).toLocaleString()}: ${x.note}` });
+
+ //let chunkedList = splitArrayIntoChunks(staffNoteList, 1);
+
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountStaffNotesList")));
+
+ for (let i in staffNoteList) {
+ messagePlayerInfo(client, staffNoteList[i]);
+ }
+ return true;
+}
+
// ===========================================================================
\ No newline at end of file
From 962281f5f4881b6798cb281e4b5732d51079961b Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:23:30 -0500
Subject: [PATCH 116/311] Don't check for SMTP module on start
---
scripts/server/startup.js | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/scripts/server/startup.js b/scripts/server/startup.js
index 9b227383..3e945cd3 100644
--- a/scripts/server/startup.js
+++ b/scripts/server/startup.js
@@ -48,12 +48,10 @@ function initServerScripts() {
// Load all the server data
loadServerDataFromDatabase();
setAllServerDataIndexes();
- createAllServerElements();
-
- addAllNetworkEventHandlers();
checkServerGameTime();
-
+ createAllServerElements();
+ addAllNetworkEventHandlers();
initAllClients();
initTimers();
@@ -82,9 +80,9 @@ function checkForMySQLModule() {
// ===========================================================================
function checkForSMTPModule() {
- if (typeof module.smtp == "undefined") {
- return false;
- }
+ //if (typeof module.smtp == "undefined") {
+ // return false;
+ //}
return true;
}
@@ -106,10 +104,10 @@ function checkForAllRequiredModules() {
thisResource.stop();
}
- if (!checkForSMTPModule()) {
- logToConsole(LOG_WARN, "[AGRP.Startup]: SMTP Email module is not loaded!");
- logToConsole(LOG_WARN, "[AGRP.Startup]: Email features will NOT be available!");
- }
+ //if (!checkForSMTPModule()) {
+ // logToConsole(LOG_WARN, "[AGRP.Startup]: SMTP Email module is not loaded!");
+ // logToConsole(LOG_WARN, "[AGRP.Startup]: Email features will NOT be available!");
+ //}
logToConsole(LOG_DEBUG, "[AGRP.Startup]: All required modules loaded!");
return true;
From 22f6ba32afac26014dba6a670850e7639e87c5f6 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:23:45 -0500
Subject: [PATCH 117/311] Add map cycle for MafiaC, based on hour
---
scripts/server/timers.js | 68 +++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 36 deletions(-)
diff --git a/scripts/server/timers.js b/scripts/server/timers.js
index 574062ba..25d5b248 100644
--- a/scripts/server/timers.js
+++ b/scripts/server/timers.js
@@ -125,34 +125,6 @@ function tenMinuteTimerFunction() {
//showRandomTipToAllPlayers();
//saveServerDataToDatabase();
//checkInactiveVehicleRespawns();
-
- if (getGame() == AGRP_GAME_MAFIA_ONE) {
- if (server.mapName == "FREERIDE") {
- if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
- sendMapChangeWarningToPlayer(null, true);
- }
-
- if (!isNightTime(getServerConfig().hour)) {
- getGameConfig().mainWorldScene[getGame()] = "FREERIDENOC";
- removeAllPlayersFromProperties();
- saveServerDataToDatabase();
- game.changeMap(getGameConfig().mainWorldScene[getGame()]);
- updateTimeRule();
- }
- } else {
- if (isServerGoingToChangeMapsSoon()) {
- sendMapChangeWarningToPlayer(null, true);
- }
-
- if (!isNightTime(getServerConfig().hour)) {
- getGameConfig().mainWorldScene[getGame()] = "FREERIDE";
- removeAllPlayersFromProperties();
- saveServerDataToDatabase();
- game.changeMap(getGameConfig().mainWorldScene[getGame()]);
- updateTimeRule();
- }
- }
- }
}
// ===========================================================================
@@ -253,17 +225,41 @@ function checkServerGameTime() {
getServerConfig().minute = dateTime.getMinutes();
}
- /*
if (getGame() == AGRP_GAME_MAFIA_ONE) {
- if (isNightTime(getServerConfig().hour) && getGameConfig().mainWorldScene[getGame()] == "FREERIDE") {
- getGameConfig().mainWorldScene[getGame()] = "FREERIDENOC";
- game.changeMap(getGameConfig().mainWorldScene[getGame()]);
- } else if (!isNightTime(getServerConfig().hour) && getGameConfig().mainWorldScene[getGame()] == "FREERIDENOC") {
- getGameConfig().mainWorldScene[getGame()] = "FREERIDE";
- game.changeMap(getGameConfig().mainWorldScene[getGame()]);
+ if (server.mapName == "FREERIDE") {
+ if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
+ sendMapChangeWarningToPlayer(null, true);
+ }
+
+ if (isNightTime(getServerConfig().hour)) {
+ getGameConfig().mainWorldScene[getGame()] = "FREERIDENOC";
+ removeAllPlayersFromProperties();
+ removeAllPlayersFromVehicles();
+ saveServerDataToDatabase();
+ game.changeMap(getGameConfig().mainWorldScene[getGame()]);
+ logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to night`);
+ messageDiscordEventChannel("🌙 Changing server map to night");
+ updateTimeRule();
+ } else {
+ getGameConfig().mainWorldScene[getGame()] = "FREERIDE";
+ removeAllPlayersFromProperties();
+ removeAllPlayersFromVehicles();
+ saveServerDataToDatabase();
+ game.changeMap(getGameConfig().mainWorldScene[getGame()]);
+ logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to day`);
+ messageDiscordEventChannel("🌞 Changing server map to day");
+ updateTimeRule();
+ }
+ } else {
+ if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
+ sendMapChangeWarningToPlayer(null, true);
+ }
+
+ if (!isNightTime(getServerConfig().hour)) {
+
+ }
}
}
- */
if (isGameFeatureSupported("time")) {
game.time.hour = getServerConfig().hour;
From 38cccf88a6a2a4b1722398d870a438da4d6b6e12 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:23:57 -0500
Subject: [PATCH 118/311] Add mouseCursor to supported features table
---
scripts/shared/gamedata.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index fe3db0d0..35987a6d 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -271,6 +271,16 @@ let supportedFeatures = {
[AGRP_GAME_MAFIA_TWO]: true,
[AGRP_GAME_MAFIA_THREE]: true,
},
+ mouseCursor: {
+ [AGRP_GAME_GTA_III]: true,
+ [AGRP_GAME_GTA_VC]: true,
+ [AGRP_GAME_GTA_SA]: true,
+ [AGRP_GAME_GTA_IV]: true,
+ [AGRP_GAME_GTA_IV_EFLC]: true,
+ [AGRP_GAME_MAFIA_ONE]: false,
+ [AGRP_GAME_MAFIA_TWO]: false,
+ [AGRP_GAME_MAFIA_THREE]: false,
+ }
};
// ===========================================================================
From a2999a6c3f890827c747934de58b15fbf4106f02 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 22 Sep 2022 05:24:17 -0500
Subject: [PATCH 119/311] Remove unneeded JSDoc info
---
scripts/shared/utilities.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/scripts/shared/utilities.js b/scripts/shared/utilities.js
index 5d31cde5..3424bf22 100644
--- a/scripts/shared/utilities.js
+++ b/scripts/shared/utilities.js
@@ -1385,9 +1385,6 @@ let placesOfOrigin = [
// ===========================================================================
-/**
- * @return {GameConfig} The game data
- */
function getGameConfig() {
return gameData;
}
From 5942cdf5f2cce631f9cff3c443a5dfb137e148d3 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:11:45 -0500
Subject: [PATCH 120/311] Update meta.xml
---
meta.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta.xml b/meta.xml
index c3a1fd5f..087714c1 100644
--- a/meta.xml
+++ b/meta.xml
@@ -1,5 +1,5 @@
-
+
From 7349ab041d90437df70f15e27feef287cbaef133 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:12:30 -0500
Subject: [PATCH 121/311] Setup cruise control stuff (unfinished)
---
scripts/client/event.js | 10 ++++++++--
scripts/client/main.js | 3 +++
scripts/client/vehicle.js | 2 +-
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index c16408be..c96197af 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -167,6 +167,9 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
//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()) {
@@ -190,7 +193,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
if (localPlayer != null) {
if (ped == localPlayer) {
- cruiseControl = false;
+ cruiseControlEnabled = false;
cruiseControlSpeed = 0.0;
}
}
@@ -202,12 +205,15 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
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);
+ setVehicleEngine(vehicle.id, false);
+ //setLocalPlayerControlState(false, false);
if (!inVehicle.engine) {
parkedVehiclePosition = inVehicle.position;
parkedVehicleHeading = inVehicle.heading;
diff --git a/scripts/client/main.js b/scripts/client/main.js
index d6c0da81..7e81b061 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -100,4 +100,7 @@ let currencyString = "${AMOUNT}";
let mapChangeWarning = false;
+let cruiseControlEnabled = false;
+let cruiseControlSpeed = 0.0;
+
// ===========================================================================
diff --git a/scripts/client/vehicle.js b/scripts/client/vehicle.js
index d4067d2f..a9268d6c 100644
--- a/scripts/client/vehicle.js
+++ b/scripts/client/vehicle.js
@@ -136,7 +136,7 @@ function toggleLocalVehicleCruiseControl() {
return false;
}
- cruiseControl = !cruiseControl;
+ cruiseControlEnabled = !cruiseControlEnabled;
cruiseControlSpeed = getVehicleSpeed(vehicle);
}
From fb038b955bb2e17b08ea1efcec98c5790a589a2a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:12:49 -0500
Subject: [PATCH 122/311] Set veh send sync based on engine state
---
scripts/client/native/connected.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js
index aa352e94..6bbe7780 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;
}
From 8e2e5090c5651dc2174ef2d63033568fd1446a23 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:13:00 -0500
Subject: [PATCH 123/311] Add streaming volume for position util
---
scripts/client/radio.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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
From 962334e1b736f7a477fc3ea32edda9cf9f5bdfca Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:13:10 -0500
Subject: [PATCH 124/311] Fix veh lights on GTA
---
scripts/client/sync.js | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index c8b841cc..d66f1cba 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;
}
}
From 5b6c909b0bfea18a9b352d8ef8a8b685d89944e1 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:13:23 -0500
Subject: [PATCH 125/311] Fix parked vehicles being driveable
---
scripts/client/utilities.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 232d6281..cd9f2d4d 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -395,21 +395,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) {
- // localPlayer.vehicle.position = parkedVehiclePosition;
- // localPlayer.vehicle.heading = parkedVehicleHeading;
- //}
+ if (parkedVehiclePosition) {
+ localPlayer.vehicle.position = parkedVehiclePosition;
+ localPlayer.vehicle.heading = parkedVehicleHeading;
+ }
}
+ } else {
+ localPlayer.vehicle.netFlags.sendSync = true;
}
}
}
@@ -573,7 +576,7 @@ function processVehicleCruiseControl() {
return false;
}
- if (cruiseControl) {
+ if (cruiseControlEnabled) {
setVehicleSpeed(cruiseControlSpeed);
}
}
From 0d9de6ec303205988c5595c1e6bef506f701ee69 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:13:45 -0500
Subject: [PATCH 126/311] Add missing action tips in bitflag table
---
scripts/server/bitflag.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/server/bitflag.js b/scripts/server/bitflag.js
index d175fc56..8aa99b08 100644
--- a/scripts/server/bitflag.js
+++ b/scripts/server/bitflag.js
@@ -260,6 +260,8 @@ let serverBitFlagKeys = {
"AmmoClipItemUsage",
"GenericItemUsage",
"EnterJobVehicleForRoute",
+ "JobLocations",
+ "JobRouteStart",
],
jobRankKeys: [
"None",
From b24b5d726b152cb75987eb1fc3f127afb91147bd Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:14:13 -0500
Subject: [PATCH 127/311] Reset paintball & working states
---
scripts/server/client.js | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 587dcf6c..e7088b4f 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -172,15 +172,27 @@ 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;
}
// ===========================================================================
From c9cf80e34c87dbfba8ac045eabf80b25428bbbaf Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:14:30 -0500
Subject: [PATCH 128/311] Remove testing try/catch on email
---
scripts/server/developer.js | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/scripts/server/developer.js b/scripts/server/developer.js
index 3a87fc1f..72734180 100644
--- a/scripts/server/developer.js
+++ b/scripts/server/developer.js
@@ -450,13 +450,7 @@ function saveServerDataCommand(command, params, client) {
// ===========================================================================
async function testEmailCommand(command, params, client) {
- try {
- messagePlayerAlert(client, `Sending test email to ${params}`);
- await sendEmail(params, "Player", "Test email", "Just testing the SMTP module for the server!");
- } catch (error) {
- messagePlayerError(client, "The email could not be sent! Error: ${error}");
- return false;
- }
+ sendEmail(params, "Player", "Test email", "Just testing the email system for the server!");
return true;
}
From 64a08ccd3740f5c15479fb90afcfec54e6f22038 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:14:45 -0500
Subject: [PATCH 129/311] Use encode URI component for webhook
---
scripts/server/discord.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/discord.js b/scripts/server/discord.js
index ea801bd0..9cf67cc5 100644
--- a/scripts/server/discord.js
+++ b/scripts/server/discord.js
@@ -184,7 +184,7 @@ function triggerDiscordWebHook(messageString, serverId = getServerId(), type = A
}
let tempURL = getGlobalConfig().discord.webhook.webhookBaseURL;
- tempURL = tempURL.replace("{0}", encodeURI(messageString));
+ tempURL = tempURL.replace("{0}", encodeURIComponent(messageString));
tempURL = tempURL.replace("{1}", serverId);
tempURL = tempURL.replace("{2}", type);
tempURL = tempURL.replace("{3}", getGlobalConfig().discord.webhook.pass);
@@ -211,7 +211,7 @@ function triggerClanDiscordWebHook(clanIndex, messageString) {
let webhookURL = getClanData(clanIndex).discordWebhookURL;
let tempURL = getGlobalConfig().discord.webhook.webhookBaseURL;
- tempURL = tempURL.replace("{0}", encodeURI(messageString));
+ tempURL = tempURL.replace("{0}", encodeURIComponent(messageString));
tempURL = tempURL.replace("{1}", serverId);
tempURL = tempURL.replace("{2}", type);
tempURL = tempURL.replace("{3}", getGlobalConfig().discord.webhook.pass);
From 5d61b45ed6f6441eb57a2e51a02bc3a259f2dc4a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:16:09 -0500
Subject: [PATCH 130/311] Use locale strings for wealth/tax cmds
---
scripts/server/economy.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/economy.js b/scripts/server/economy.js
index c7b573a4..c971d4b3 100644
--- a/scripts/server/economy.js
+++ b/scripts/server/economy.js
@@ -141,14 +141,14 @@ function setPayDayBonusMultiplier(command, params, client) {
function taxInfoCommand(command, params, client) {
let wealth = calculateWealth(client);
let tax = calculateIncomeTax(wealth);
- messagePlayerInfo(client, `Your tax on payday is: ${getCurrencyString(tax)}. Use {ALTCOLOUR}/help tax {MAINCOLOUR}for more information.`);
+ messagePlayerInfo(client, getLocaleString(client, "YourTax", `{ALTCOLOUR}${getCurrencyString(tax)}{MAINCOLOUR}`, `{ALTCOLOUR}/help tax{MAINCOLOUR}`));
}
// ===========================================================================
function wealthInfoCommand(command, params, client) {
let wealth = calculateWealth(client);
- messagePlayerInfo(client, `Your wealth is: {ALTCOLOUR}${getCurrencyString(wealth)}{MAINCOLOUR}. Use {ALTCOLOUR}/help wealth {MAINCOLOUR}for more information.`);
+ messagePlayerInfo(client, getLocaleString(client, "YourWealth", `{ALTCOLOUR}${getCurrencyString(wealth)}{MAINCOLOUR}`, `{ALTCOLOUR}/help wealth{MAINCOLOUR}`));
}
// ===========================================================================
From 460d9381d37258d1d0732a424ab6b8e5e11fac3a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:16:21 -0500
Subject: [PATCH 131/311] Use encode URI component for email
---
scripts/server/email.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/server/email.js b/scripts/server/email.js
index 319ac181..7593ad97 100644
--- a/scripts/server/email.js
+++ b/scripts/server/email.js
@@ -47,12 +47,12 @@ async function sendEmail(toEmail, toName, subject, body) {
break;
case AGRP_EMAIL_METHOD_GET_REQUEST:
- let tempURL = getEmailConfig().http.baseUrl;
- tempURL = tempURL.replace("{0}", encodeURI(password));
- tempURL = tempURL.replace("{1}", encodeURI(toEmail));
- tempURL = tempURL.replace("{2}", encodeURI(toName));
- tempURL = tempURL.replace("{3}", encodeURI(subject));
- tempURL = tempURL.replace("{4}", encodeURI(body));
+ let tempURL = getEmailConfig().http.baseURL;
+ tempURL = tempURL.replace("{0}", encodeURIComponent(getEmailConfig().http.password));
+ tempURL = tempURL.replace("{1}", encodeURIComponent(toEmail));
+ tempURL = tempURL.replace("{2}", encodeURIComponent(toName));
+ tempURL = tempURL.replace("{3}", encodeURIComponent(subject));
+ tempURL = tempURL.replace("{4}", encodeURIComponent(body));
httpGet(
tempURL,
From 67043af1a77b8908c667da806ed37dc6237287d2 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:16:33 -0500
Subject: [PATCH 132/311] Fix disconnect event processing
---
scripts/server/event.js | 54 ++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index 62a92281..e41cbd7d 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -102,8 +102,7 @@ function onPlayerQuit(event, client, quitReasonId) {
let disconnectName = disconnectReasons[quitReasonId];
let reasonTextEnglish = getLanguageGroupedLocaleString(englishLocale, "DisconnectReasons", disconnectName);
-
- updateConnectionLogOnQuit(client, quitReasonId);
+ let clientName = getPlayerName(client);
if (getPlayerData(client) != false) {
if (getPlayerData(client).customDisconnectReason != "") {
@@ -111,46 +110,31 @@ function onPlayerQuit(event, client, quitReasonId) {
}
}
- logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`);
- messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${getLanguageGroupedLocaleString(englishLocale, "DisconnectReasons", reasonTextEnglish)})`);
+ updateConnectionLogOnQuit(client, disconnectName);
- getClients().forEach(forClient => {
- messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", getPlayerName(client), getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName)));
- });
+ resetClientStuff(client);
if (isPlayerLoggedIn(client)) {
- if (isPlayerInPaintBall(client)) {
- stopPaintBall(client);
- }
-
- if (isPlayerOnJobRoute(client)) {
- stopJobRoute(client, false, false);
- }
-
- if (isPlayerWorking(client)) {
- stopWorking(client);
- }
-
- //if (isPlayerFishing(client)) {
- // stopFishing(client);
- //}
-
savePlayerToDatabase(client);
- resetClientStuff(client);
}
if (getPlayerData(client).loginTimeout != null) {
clearTimeout(getPlayerData(client).loginTimeout);
}
-
-
playerResourceReady[client.index] = false;
playerResourceStarted[client.index] = false;
playerInitialized[client.index] = false;
playerGUIReady[client.index] = false;
getServerData().clients[getPlayerId(client)] = null;
+
+ logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`);
+ messageDiscordEventChannel(`👋 ${clientName} has left the server (${reasonTextEnglish})`);
+
+ getClients().filter(c => c != client).forEach(forClient => {
+ messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", clientName, getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName)));
+ });
}
// ===========================================================================
@@ -665,6 +649,10 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
+ //if (seat == AGRP_VEHSEAT_DRIVER) {
+ // vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
+ //}
+
getPlayerData(client).pedState = AGRP_PEDSTATE_READY;
stopRadioStreamForPlayer(client);
@@ -715,8 +703,10 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
if (seat == AGRP_VEHSEAT_DRIVER) {
vehicle.engine = getVehicleData(vehicle).engine;
+ setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
+ vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
- if (getVehicleData(vehicle).buyPrice > 0) {
+ if (getVehicleData(vehicle).buyPrice > 0 && !doesPlayerHaveVehicleKeys(client, vehicle)) {
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}${getCurrencyString(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
resetVehiclePosition(vehicle);
} else if (getVehicleData(vehicle).rentPrice > 0) {
@@ -780,7 +770,9 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_JOB) {
if (getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
- messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
+ if (!hasPlayerSeenActionTip(client, "JobRouteStart")) {
+ messagePlayerInfo(client, getGroupedLocaleString(client, "ActionTips", "JobRouteStart", `{ALTCOLOUR}/startroute{MAINCOLOUR}`));
+ }
}
}
}
@@ -812,6 +804,9 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
+ if (seat == AGRP_VEHSEAT_DRIVER) {
+ vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
+ }
onPlayerEnteringVehicle(client, vehicle, seat);
}
}
@@ -825,6 +820,9 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
+ if (seat == AGRP_VEHSEAT_DRIVER) {
+ vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
+ }
onPlayerExitingVehicle(client, vehicle, seat);
}
}
From ad8f12b6e38a0f114808ad8606d2f519acf8a8c1 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:16:49 -0500
Subject: [PATCH 133/311] Mark action tip seen on job route start
---
scripts/server/job.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 7a912110..2b448231 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -2357,6 +2357,8 @@ function jobStartRouteCommand(command, params, client) {
}
}
+ markPlayerActionTipSeen(client, "JobRouteStart");
+
startJobRoute(client, forceRoute);
return true;
}
From c7d8c3734b5f1f1d45f0f2f8172e162112ba798d Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:17:11 -0500
Subject: [PATCH 134/311] Align locale utils arg order
---
scripts/server/locale.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/server/locale.js b/scripts/server/locale.js
index 53435db2..7d067795 100644
--- a/scripts/server/locale.js
+++ b/scripts/server/locale.js
@@ -39,7 +39,7 @@ function getLocaleString(client, stringName, ...args) {
return "";
}
- let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
+ let tempString = getRawLocaleString(getPlayerData(client).locale, stringName);
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
@@ -56,7 +56,7 @@ function getLocaleString(client, stringName, ...args) {
// ===========================================================================
function getLanguageLocaleString(localeId, stringName, ...args) {
- let tempString = getRawLocaleString(stringName, localeId);
+ let tempString = getRawLocaleString(localeId, stringName);
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
@@ -73,7 +73,7 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
// ===========================================================================
function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
- let tempString = getRawGroupedLocaleString(stringName, index, localeId);
+ let tempString = getRawGroupedLocaleString(localeId, stringName, index);
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
submitBugReport(null, `(AUTOMATED REPORT) Locale string index ${index} of "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
@@ -94,7 +94,7 @@ function getGroupedLocaleString(client, stringName, index, ...args) {
return "";
}
- let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
+ let tempString = getRawGroupedLocaleString(getPlayerData(client).locale, stringName, index);
for (let i = 1; i <= args.length; i++) {
tempString = tempString.replace(`{${i}}`, args[i - 1]);
@@ -105,7 +105,7 @@ function getGroupedLocaleString(client, stringName, index, ...args) {
// ===========================================================================
-function getRawLocaleString(stringName, localeId) {
+function getRawLocaleString(localeId, stringName) {
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
submitBugReport(null, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
@@ -126,7 +126,7 @@ function getRawLocaleString(stringName, localeId) {
// ===========================================================================
-function getRawGroupedLocaleString(stringName, localeId, index) {
+function getRawGroupedLocaleString(localeId, stringName, index) {
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
logToConsole(LOG_WARN, `[AGRP.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
submitBugReport(null, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
@@ -279,7 +279,7 @@ async function translateMessage(messageText, translateFrom = getGlobalConfig().l
}
}
- let thisTranslationURL = getGlobalConfig().locale.translateURL.format(encodeURI(messageText), toUpperCase(getGlobalConfig().locale.locales[translateFrom].isoCode), toUpperCase(getGlobalConfig().locale.locales[translateTo].isoCode), getGlobalConfig().locale.apiEmail);
+ let thisTranslationURL = getGlobalConfig().locale.translateURL.format(encodeURIComponent(messageText), toUpperCase(getGlobalConfig().locale.locales[translateFrom].isoCode), toUpperCase(getGlobalConfig().locale.locales[translateTo].isoCode), getGlobalConfig().locale.apiEmail);
httpGet(
thisTranslationURL,
"",
From 132cb2254ed7a05678299baf5bc591c2cc4040b0 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:17:24 -0500
Subject: [PATCH 135/311] Remove disconnect names from ragemp native
---
scripts/server/native/ragemp.js | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/scripts/server/native/ragemp.js b/scripts/server/native/ragemp.js
index 20bf146a..0bcd8a0d 100644
--- a/scripts/server/native/ragemp.js
+++ b/scripts/server/native/ragemp.js
@@ -23,23 +23,6 @@ let builtInCommands = [
// ===========================================================================
-let disconnectReasons = [
- "Lost Connection",
- "Disconnected",
- "Unsupported Client",
- "Wrong Game",
- "Incorrect Password",
- "Unsupported Executable",
- "Disconnected",
- "Banned",
- "Failed",
- "Invalid Name",
- "Crashed",
- "Modified Game"
-];
-
-// ===========================================================================
-
function getPlayerPosition(client) {
if (!areServerElementsSupported()) {
return getPlayerData(client).syncPosition;
From eb8debe48e4ca6a74831419fb21e293434d06629 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:17:38 -0500
Subject: [PATCH 136/311] Remove squirrel thread testing script file
---
scripts/server/thread.nut | 25 -------------------------
1 file changed, 25 deletions(-)
delete mode 100644 scripts/server/thread.nut
diff --git a/scripts/server/thread.nut b/scripts/server/thread.nut
deleted file mode 100644
index 0fe5afb0..00000000
--- a/scripts/server/thread.nut
+++ /dev/null
@@ -1,25 +0,0 @@
-// ===========================================================================
-// Asshat Gaming Roleplay
-// https://github.com/VortrexFTW/agrp_main
-// (c) 2022 Asshat Gaming
-// ===========================================================================
-// FILE: thread.nut
-// DESC: Provides threaded functions (used in Squirrel since JavaScript thread hacks don't work)
-// TYPE: Server (Squirrel)
-// ===========================================================================
-
-bindEventHandler("OnResourceStart", thisResource, function(event, resource) {
- emailThread <- newthread(sendEmail);
-
- exportFunction("sendEmail", function(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
- emailThread.call(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName);
- });
-});
-
-// ===========================================================================
-
-function sendEmail(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName) {
- module.smtp.send(smtpHost, smtpPort, useTLS, smtpUser, smtpPassword, toEmail, toName, subject, body, fromEmail, fromName);
-}
-
-// ===========================================================================
\ No newline at end of file
From 7ff030727a709d5739c5b0102d89851766bbcb30 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 24 Sep 2022 06:18:06 -0500
Subject: [PATCH 137/311] Fix nearvehs cmd, set indexes on addveh/tempveh
---
scripts/server/vehicle.js | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index 4f50ad5d..d8159595 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -427,10 +427,12 @@ function getNearbyVehiclesCommand(command, params, client) {
return false;
}
- let vehiclesList = nearbyVehicles.map(function (x) { return `{ALTCOLOUR}${getVehicleData(x).index}: {MAINCOLOUR}${getVehicleName(x)} {darkGrey}(${getDistance(getPlayerPosition(client), getVehiclePosition(x))} ${getLocaleString(client, "Meters")} ${getGroupedLocaleString(client, "CardinalDirections")[getCardinalDirection(getPlayerPosition(client), getVehiclePosition(x))]}})`; });
+ let vehiclesList = nearbyVehicles.map(function (x) {
+ return `{ALTCOLOUR}${getVehicleData(x).index}: {MAINCOLOUR}${getVehicleName(x)} {mediumGrey}(${toFloat(getDistance(getPlayerPosition(client), getVehiclePosition(x)), 2)} ${getLocaleString(client, "Meters")} ${getGroupedLocaleString(client, "CardinalDirections", getCardinalDirectionName(getCardinalDirection(getPlayerPosition(client), getVehiclePosition(x))))}`;
+ });
let chunkedList = splitArrayIntoChunks(vehiclesList, 4);
- messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehiclesInRangeList", `${distance} ${getLocaleString(client, "Meters")}`)));
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehiclesInRangeList", `${distance} ${getLocaleString(client, "Meters")} `)));
for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
@@ -461,7 +463,7 @@ function vehicleTrunkCommand(command, params, client) {
getVehicleData(vehicle).needsSaved = true;
setVehicleTrunkState(vehicle, getVehicleData(vehicle).trunk);
- meActionToNearbyPlayers(client, `${toLowerCase(getOpenedClosedFromBool(getVehicleData(vehicle).trunk))} the ${getVehicleName(vehicle)}'s trunk.`);
+ meActionToNearbyPlayers(client, `${toLowerCase(getOpenedClosedFromBool(getVehicleData(vehicle).trunk))} the ${getVehicleName(vehicle)} 's trunk.`);
}
// ===========================================================================
@@ -761,7 +763,7 @@ function rentVehicleCommand(command, params, client) {
getVehicleData(vehicle).needsSaved = true;
meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`);
- messagePlayerAlert(client, getLocaleString(client, "StartedRentingVehicle", `{ALTCOLOUR}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
+ messagePlayerAlert(client, getLocaleString(client, "StartedRentingVehicle", `{ALTCOLOUR}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}${getCurrencyString(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehstoprent{MAINCOLOUR}`));
if (!getVehicleData(vehicle).engine) {
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
@@ -1622,7 +1624,11 @@ function createTemporaryVehicle(modelIndex, position, heading, interior = 0, dim
}
let slot = getServerData().vehicles.push(tempVehicleData);
- setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
+ setAllVehicleIndexes();
+
+ if (areServerElementsSupported()) {
+ setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
+ }
return vehicle;
}
@@ -1648,6 +1654,7 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
}
let slot = getServerData().vehicles.push(tempVehicleData);
+ setAllVehicleIndexes();
if (areServerElementsSupported()) {
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
From cf5fb4d8f90f589f4fd6a6cb348f3f24004e8387 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:08:15 -0500
Subject: [PATCH 138/311] Fix clientside biz stuff
---
scripts/client/business.js | 4 ++-
scripts/server/business.js | 70 +++++++++++++++++++++++---------------
2 files changed, 45 insertions(+), 29 deletions(-)
diff --git a/scripts/client/business.js b/scripts/client/business.js
index fec93641..50eed775 100644
--- a/scripts/client/business.js
+++ b/scripts/client/business.js
@@ -22,6 +22,7 @@ class BusinessData {
this.hasItems = hasItems;
this.blipId = -1;
this.labelInfoType = 0;
+ this.locked = false;
}
}
@@ -34,7 +35,7 @@ function initBusinessScript() {
// ===========================================================================
-function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) {
+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) {
@@ -48,6 +49,7 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
businessData.buyPrice = buyPrice;
businessData.rentPrice = rentPrice;
businessData.hasItems = hasItems;
+ businessData.locked = locked;
if (hasInterior && !hasItems) {
businessData.labelInfoType = AGRP_PROPLABEL_INFO_ENTER;
diff --git a/scripts/server/business.js b/scripts/server/business.js
index d7062f73..75b7a0e1 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -1132,7 +1132,7 @@ 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];
@@ -2016,10 +2016,6 @@ function createAllBusinessBlips() {
*
*/
function createBusinessEntrancePickup(businessId) {
- if (!areServerElementsSupported()) {
- return false;
- }
-
if (!getServerConfig().createBusinessPickups) {
return false;
}
@@ -2030,10 +2026,6 @@ function createBusinessEntrancePickup(businessId) {
// return false;
//}
- if (businessData.entrancePickupModel == -1) {
- return false;
- }
-
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
@@ -2041,13 +2033,15 @@ function createBusinessEntrancePickup(businessId) {
if (isGameFeatureSupported("pickup")) {
let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+ if (businessData.entrancePickupModel == -1) {
+ return false;
+ }
+
if (businessData.entrancePickupModel != 0) {
pickupModelId = businessData.entrancePickupModel;
}
entrancePickup = createGamePickup(pickupModelId, businessData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
- } else if (isGameFeatureSupported("dummyElement")) {
- entrancePickup = createGameDummyElement(businessData.entrancePosition);
}
if (entrancePickup != null) {
@@ -2068,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, businessData.buyPrice, businessData.rentPrice, doesBusinessHaveAnyItemsToBuy(businessId));
}
+ updateBusinessPickupLabelData(businessId);
+
return false;
}
@@ -2090,10 +2079,6 @@ function createBusinessEntrancePickup(businessId) {
*
*/
function createBusinessEntranceBlip(businessId) {
- if (!areServerElementsSupported()) {
- return false;
- }
-
if (!getServerConfig().createBusinessBlips) {
return false;
}
@@ -2120,7 +2105,7 @@ function createBusinessEntranceBlip(businessId) {
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) {
@@ -2181,8 +2166,6 @@ function createBusinessExitPickup(businessId) {
}
exitPickup = createGamePickup(pickupModelId, businessData.exitPosition, getGameConfig().pickupTypes[getGame()].business);
- } else if (isGameFeatureSupported("dummyElement")) {
- //exitPickup = createGameDummyElement(businessData.exitPosition);
}
if (exitPickup != null) {
@@ -2692,9 +2675,9 @@ function buyFromBusinessCommand(command, params, client) {
if (!hasPlayerSeenActionTip(client, "ViewInventory")) {
if (doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
let keyData = getPlayerKeyBindForCommand("inv");
- messagePlayerActionTip(client, getIndexedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
+ messagePlayerActionTip(client, getGroupedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
} else {
- messagePlayerActionTip(client, getIndexedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
+ messagePlayerActionTip(client, getGroupedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
}
}
@@ -2892,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;
}
@@ -3225,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
From 7e7983b74aa1842ab29f62f01290f27f743fde40 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:08:28 -0500
Subject: [PATCH 139/311] Add custom camera fade (unfinished)
---
scripts/client/camera.js | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 scripts/client/camera.js
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
From 2d8895b8d776c13c2ae8b694a9b65381aab7a525 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:08:44 -0500
Subject: [PATCH 140/311] Don't delay resource start/ready signals
---
scripts/client/event.js | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index c96197af..983cf904 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -63,13 +63,10 @@ function onResourceStart(event, resource) {
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
}
- garbageCollectorInterval = setInterval(collectAllGarbage, 1000 * 60);
- localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
-
if (resource == thisResource) {
- setTimeout(function () {
- sendResourceStartedSignalToServer();
- }, 500);
+ garbageCollectorInterval = setInterval(collectAllGarbage, 1000 * 60);
+ localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
+ sendResourceStartedSignalToServer();
}
}
@@ -84,11 +81,10 @@ function onResourceStop(event, resource) {
// ===========================================================================
function onResourceReady(event, resource) {
- loadLocaleConfig();
-
- setTimeout(function () {
+ if (resource == thisResource) {
+ loadLocaleConfig();
sendResourceReadySignalToServer();
- }, 500);
+ }
}
// ===========================================================================
From 01670a29fc0e4ad90a8c1e530a5e5966e051086f Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:08:57 -0500
Subject: [PATCH 141/311] Start working on business manager GUI
---
scripts/client/gui/bizmgr.js | 76 ++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/scripts/client/gui/bizmgr.js b/scripts/client/gui/bizmgr.js
index 717eda31..27c80221 100644
--- a/scripts/client/gui/bizmgr.js
+++ b/scripts/client/gui/bizmgr.js
@@ -6,4 +6,80 @@
// FILE: bizmgr.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
From 1ad22b48d438fc21dbcf6eb02179a5994f19f933 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:09:11 -0500
Subject: [PATCH 142/311] Name clan manager buttons
---
scripts/client/gui/clanmgr.js | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/scripts/client/gui/clanmgr.js b/scripts/client/gui/clanmgr.js
index 7928a7be..05111540 100644
--- a/scripts/client/gui/clanmgr.js
+++ b/scripts/client/gui/clanmgr.js
@@ -10,12 +10,16 @@
let clanManager = {
window: null,
- generalTab: null,
- ranksTab: null,
- membersTab: null,
- vehiclesTab: null,
- businessesTab: null,
- housesTab: null,
+ generalTabButton: null,
+ ranksTabButton: null,
+ membersTabButton: null,
+ vehiclesTabButton: null,
+ businessesTabButton: null,
+ housesTabButton: null,
};
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
+
+function initClanManagerGUI() {
+
+}
\ No newline at end of file
From fd5efa45bd17b88cdcaf8430fd34349caa26de50 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:09:21 -0500
Subject: [PATCH 143/311] Add utils for GUI list
---
scripts/client/gui/list.js | 41 +++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/scripts/client/gui/list.js b/scripts/client/gui/list.js
index 3d45d874..4aef6fdd 100644
--- a/scripts/client/gui/list.js
+++ b/scripts/client/gui/list.js
@@ -12,6 +12,8 @@ let listDialog = {
window: null,
messageLabel: null,
listGrid: null,
+
+ listRows: [],
};
// ===========================================================================
@@ -78,7 +80,7 @@ function initListGUI() {
function showListGUI() {
closeAllWindows();
- logToConsole(LOG_DEBUG, `[AGRP.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
From 3679d688968320673be4ca5718ea3e5f07e48c17 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:09:29 -0500
Subject: [PATCH 144/311] Fix clientside houses
---
scripts/client/house.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/client/house.js b/scripts/client/house.js
index ef809fdb..d84dff36 100644
--- a/scripts/client/house.js
+++ b/scripts/client/house.js
@@ -20,12 +20,13 @@ class HouseData {
this.rentPrice = 0;
this.buyPrice = 0;
this.blipId = -1;
+ this.locked = false;
}
}
// ===========================================================================
-function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior) {
+function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
logToConsole(LOG_DEBUG, `[AGRP.House] Received house ${houseId} (${name}) from server`);
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
@@ -38,6 +39,7 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
houseData.hasInterior = hasInterior;
houseData.buyPrice = buyPrice;
houseData.rentPrice = rentPrice;
+ houseData.locked = locked;
if (houseData.buyPrice > 0) {
houseData.labelInfoType = AGRP_PROPLABEL_INFO_BUYHOUSE;
From c1dedd3620a4e84c392d5349fc1fb33a5b224037 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:09:46 -0500
Subject: [PATCH 145/311] Add support for scene changing
---
scripts/client/netevents.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/scripts/client/netevents.js b/scripts/client/netevents.js
index ff59f073..2bdbf954 100644
--- a/scripts/client/netevents.js
+++ b/scripts/client/netevents.js
@@ -155,7 +155,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("agrp.ping", updatePlayerPing);
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);
@@ -378,7 +378,7 @@ function sendLocalPlayerNetworkIdToServer() {
// ===========================================================================
-function setCutsceneInterior(cutsceneName) {
+function changeScene(sceneName) {
if (getGame() == AGRP_GAME_GTA_IV) {
if (cutsceneName == "") {
natives.clearCutscene();
@@ -388,6 +388,8 @@ function setCutsceneInterior(cutsceneName) {
}
natives.initCutscene(cutsceneName);
}
+ } else if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ game.changeMap(sceneName);
}
}
@@ -456,4 +458,10 @@ function setMapChangeWarningState(state) {
mapChangeWarning = state;
}
+// ===========================================================================
+
+function updatePlayerPing(playerName, ping) {
+ playerPing[playerName] = ping;
+}
+
// ===========================================================================
\ No newline at end of file
From 1e4cf380ffaa8bed5cc053c7dc29be10fa041fa7 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:09:55 -0500
Subject: [PATCH 146/311] Fade camera net event
---
scripts/client/utilities.js | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index cd9f2d4d..7a24a8b0 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -29,14 +29,15 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
// ===========================================================================
-function fadeLocalCamera(state, time) {
- if (isFadeCameraSupported()) {
- logToConsole(LOG_DEBUG, `[AGRP.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;
}
// ===========================================================================
From 4f6dac29cfc76b1029f9e3d343a668ea3f350ae8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:10:22 -0500
Subject: [PATCH 147/311] Fix wrong util name being used in stopanim action tip
---
scripts/server/animation.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index 8b704706..f809e948 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -45,7 +45,7 @@ function playPlayerAnimationCommand(command, params, client) {
}
if (hasPlayerSeenActionTip(client, "AnimationStop")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "ActionTips", "AnimationStopTip", "{ALTCOLOUR}/stopanim{MAINCOLOUR}"));
+ messagePlayerTip(client, getGroupedLocaleString(client, "ActionTips", "AnimationStop", "{ALTCOLOUR}/stopanim{MAINCOLOUR}"));
}
makePlayerPlayAnimation(client, animationSlot, animationPositionOffset);
}
From a59b4104f1f20bc3f14762e34f88fc78f199614b Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:11:14 -0500
Subject: [PATCH 148/311] Wrong locale util name
---
scripts/server/chat.js | 2 +-
scripts/server/item.js | 8 ++++----
scripts/server/job.js | 36 +++++++++++++++++++++---------------
scripts/server/property.js | 4 ++--
4 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index d1d187c4..152c9328 100644
--- a/scripts/server/chat.js
+++ b/scripts/server/chat.js
@@ -219,7 +219,7 @@ function privateMessageCommand(command, params, client) {
messagePlayerPrivateMessage(targetClient, client, messageText);
if (hasPlayerSeenActionTip(targetClient, "ReplyToDirectMessage")) {
- messagePlayerTip(targetClient, getIndexedLocaleString(targetClient, "ActionTips", "ReplyToDirectMessage", "{ALTCOLOUR}/reply{MAINCOLOUR}"));
+ messagePlayerTip(targetClient, getGroupedLocaleString(targetClient, "ActionTips", "ReplyToDirectMessage", "{ALTCOLOUR}/reply{MAINCOLOUR}"));
}
}
diff --git a/scripts/server/item.js b/scripts/server/item.js
index 546f9266..33d054f4 100644
--- a/scripts/server/item.js
+++ b/scripts/server/item.js
@@ -1925,25 +1925,25 @@ function playerSwitchItem(client, newHotBarSlot) {
switch (getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useType) {
case AGRP_ITEM_USE_TYPE_AMMO_CLIP:
if (!hasPlayerSeenActionTip(client, "AmmoClipItemUsage")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "AmmoClipItemUsage", getKeyOrCommandForPlayerMessage(client, "use")));
+ messagePlayerTip(client, getGroupedLocaleString(client, "AmmoClipItemUsage", getKeyOrCommandForPlayerMessage(client, "use")));
}
break;
case AGRP_ITEM_USE_TYPE_VEHREPAIR:
if (!hasPlayerSeenActionTip(client, "VehicleRepairKitItemUsage")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "VehicleRepairKitItemUsage", getKeyOrCommandForPlayerMessage(client, "use")));
+ messagePlayerTip(client, getGroupedLocaleString(client, "VehicleRepairKitItemUsage", getKeyOrCommandForPlayerMessage(client, "use")));
}
break;
case AGRP_ITEM_USE_TYPE_VEHCOLOUR:
if (!hasPlayerSeenActionTip(client, "VehicleColourKitItemUsage")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "VehicleColourKitItemUsage", getKeyOrCommandForPlayerMessage(client, "use")));
+ messagePlayerTip(client, getGroupedLocaleString(client, "VehicleColourKitItemUsage", getKeyOrCommandForPlayerMessage(client, "use")));
}
break;
case AGRP_ITEM_USE_TYPE_VEHUPGRADE_PART:
if (!hasPlayerSeenActionTip(client, "VehiclePartItemUsage")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "VehiclePartItemUsage", getKeyOrCommandForPlayerMessage(client, "use"), getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).name));
+ messagePlayerTip(client, getGroupedLocaleString(client, "VehiclePartItemUsage", getKeyOrCommandForPlayerMessage(client, "use"), getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).name));
}
break;
}
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 2b448231..28984962 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -987,7 +987,7 @@ function startWorkingCommand(command, params, client) {
if (doesJobLocationHaveAnyRoutes(closestJobLocation)) {
if (hasPlayerSeenActionTip(client, "EnterJobVehicleForRoute")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "ActionTips", "EnterJobVehicleForRoute"));
+ messagePlayerTip(client, getGroupedLocaleString(client, "ActionTips", "EnterJobVehicleForRoute"));
}
}
return true;
@@ -1406,9 +1406,9 @@ function jobEquipmentCommand(command, params, client) {
meActionToNearbyPlayers(client, `grabs the ${jobEquipmentData.name} equipment from the locker`);
if (!hasPlayerSeenActionTip(client, "JobEquipmentInventory")) {
if (doesPlayerHaveKeyBindForCommand(client, "inv")) {
- messagePlayerTip(client, getIndexedLocaleString(client, "ActionTips", "JobEquipmentInventory", toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "inv").key))));
+ messagePlayerTip(client, getGroupedLocaleString(client, "ActionTips", "JobEquipmentInventory", toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "inv").key))));
} else {
- messagePlayerTip(client, getIndexedLocaleString(client, "ActionTips", "JobEquipmentInventory", "/inv"));
+ messagePlayerTip(client, getGroupedLocaleString(client, "ActionTips", "JobEquipmentInventory", "/inv"));
}
markPlayerActionTipSeen(client, "JobEquipmentInventory");
}
@@ -3141,21 +3141,20 @@ function createJobLocationPickup(jobId, locationId) {
return false;
}
- if (!isGameFeatureSupported("pickup")) {
- return false;
- }
-
let tempJobData = getJobData(jobId);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
+
if (tempJobData.pickupModel != -1) {
- let pickupModelId = getGameConfig().pickupModels[getGame()].Job;
+ let pickupModelId = -1;
+ if (isGameFeatureSupported("pickup")) {
+ pickupModelId = getGameConfig().pickupModels[getGame()].Job;
- if (tempJobData.pickupModel != 0) {
- pickupModelId = tempJobData.pickupModel;
+ if (tempJobData.pickupModel != 0) {
+ pickupModelId = tempJobData.pickupModel;
+ }
}
- logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
-
if (areServerElementsSupported()) {
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getGame()].job);
if (pickup != false) {
@@ -3170,7 +3169,16 @@ function createJobLocationPickup(jobId, locationId) {
addToWorld(pickup);
}
} else {
- // sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, pickupModel);
+ let blipModelId = -1;
+ if (isGameFeatureSupported("blip")) {
+ blipModelId = getGameConfig().blipSprites[getGame()].Job;
+
+ if (getJobData(jobId).blipModel != 0) {
+ blipModelId = getJobData(jobId).blipModel;
+ }
+ }
+
+ sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId, pickupModelId);
}
}
}
@@ -3218,8 +3226,6 @@ function createJobLocationBlip(jobId, locationId) {
updateJobBlipsForPlayer(clients[i]);
}
}
- } else {
- sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
}
}
diff --git a/scripts/server/property.js b/scripts/server/property.js
index be92ba21..c377b1dd 100644
--- a/scripts/server/property.js
+++ b/scripts/server/property.js
@@ -2130,9 +2130,9 @@ function buyFromBusinessCommand(command, params, client) {
if (!hasPlayerSeenActionTip(client, "ViewInventory")) {
if (doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) {
let keyData = getPlayerKeyBindForCommand("inv");
- messagePlayerActionTip(client, getIndexedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
+ messagePlayerActionTip(client, getGroupedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}${getKeyNameFromId(keyData.key)}{MAINCOLOUR}`));
} else {
- messagePlayerActionTip(client, getIndexedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
+ messagePlayerActionTip(client, getGroupedLocaleString(client, "ActionTips", "ViewInventory", `{ALTCOLOUR}/inv{MAINCOLOUR}`));
}
}
From d73246dd2b9ad7920ba6c57d8a8f96804ddd96fb Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:11:23 -0500
Subject: [PATCH 149/311] Add SalieriBar interior type
---
scripts/shared/gamedata.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index 35987a6d..a55aee1c 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -6069,7 +6069,7 @@ let gameData = {
[AGRP_GAME_GTA_IV_EFLC]: { // GTA IV EFLC
},
[AGRP_GAME_MAFIA_ONE]: { // Mafia 1
- SalieriBar: [toVector3(-336.53, -1494.56, 9.945), 0, false, ""],
+ SalieriBar: [toVector3(-336.53, -1494.56, 9.945), 0, false, "MISE02-SALIERY"],
},
[AGRP_GAME_MAFIA_TWO]: { // Mafia 2
},
@@ -6401,7 +6401,7 @@ let gameData = {
[AGRP_GAME_MAFIA_ONE]: [
// Mafia 1
{
- position: toVector3(-759.00, 11.40, 747.31),
+ position: toVector3(-763.32, 13.25, 761.18),
heading: 0.0,
blip: false,
name: "New Ark Hospital",
From 8ba392e8349238080cc41395b0563085bd65302b Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:11:39 -0500
Subject: [PATCH 150/311] Debug logging + fix disconnect reason for query
---
scripts/server/utilities.js | 43 ++++++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js
index a3a9abcb..e6fe4354 100644
--- a/scripts/server/utilities.js
+++ b/scripts/server/utilities.js
@@ -317,9 +317,9 @@ function getPlayerFromParams(params) {
// ===========================================================================
-function updateConnectionLogOnQuit(client, quitReasonId) {
+function updateConnectionLogOnQuit(client) {
if (getPlayerData(client) != false) {
- quickDatabaseQuery(`UPDATE conn_main SET conn_when_disconnect=NOW(), conn_how_disconnect=${quitReasonId} WHERE conn_id = ${getPlayerData(client).sessionId}`);
+ quickDatabaseQuery(`UPDATE conn_main SET conn_when_disconnect=NOW() WHERE conn_id = ${getPlayerData(client).sessionId}`);
}
}
@@ -510,13 +510,16 @@ function removeAllPlayersFromVehicles() {
// ===========================================================================
-function handlePlayerEnteringExitingProperty(client) {
+function processPlayerEnteringExitingProperty(client) {
+ logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
if (getPlayerData(client).enteringExitingProperty == null) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
return false;
}
let pedState = getPlayerData(client).pedState;
if (pedState != AGRP_PEDSTATE_ENTERINGPROPERTY && pedState != AGRP_PEDSTATE_EXITINGPROPERTY) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
return false;
}
@@ -528,14 +531,24 @@ function handlePlayerEnteringExitingProperty(client) {
}
if (propertyData == null || propertyData == false) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
return false;
}
if (pedState == AGRP_PEDSTATE_ENTERINGPROPERTY) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
+ if (isGameFeatureSupported("interiorScene") && propertyData.exitScene != "") {
+ logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is entering a property with interior scene (${propertyData.exitScene})`);
+ spawnPlayer(client, propertyData.exitPosition, propertyData.exitRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
+ onPlayerSpawn(client);
+ } else {
+ setPlayerPosition(client, propertyData.exitPosition);
+ setPlayerHeading(client, propertyData.exitRotation);
+ }
+
setPlayerDimension(client, propertyData.exitDimension);
setPlayerInterior(client, propertyData.exitInterior);
- setPlayerPosition(client, propertyData.exitPosition);
- setPlayerHeading(client, propertyData.exitRotation);
+
setTimeout(function () {
if (isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
@@ -561,10 +574,18 @@ function handlePlayerEnteringExitingProperty(client) {
getPlayerData(client).enteringExitingProperty = null;
getPlayerData(client).pedState = AGRP_PEDSTATE_READY;
} else if (pedState == AGRP_PEDSTATE_EXITINGPROPERTY) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
+ if (isGameFeatureSupported("interiorScene") && propertyData.entranceScene != "") {
+ logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is exiting a property with external interior scene (${propertyData.entranceScene})`);
+ spawnPlayer(client, propertyData.entrancePosition, propertyData.entranceRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
+ onPlayerSpawn(client);
+ } else {
+ setPlayerPosition(client, propertyData.entrancePosition);
+ setPlayerHeading(client, propertyData.entranceRotation);
+ }
+
setPlayerDimension(client, propertyData.entranceDimension);
- setPlayerInterior(client, propertyData.entranceDimension);
- setPlayerPosition(client, propertyData.entranceDimension);
- setPlayerHeading(client, propertyData.entranceDimension);
+ setPlayerInterior(client, propertyData.entranceInterior);
// Check if exiting property was into another house/business
let inProperty = false;
@@ -611,4 +632,10 @@ function handlePlayerEnteringExitingProperty(client) {
}
}
+// ===========================================================================
+
+function getPlayerCountryISOCode(client) {
+ return module.geoip.getCountryISO(getGlobalConfig().geoIPCountryDatabaseFilePath, getPlayerIP(client));
+}
+
// ===========================================================================
\ No newline at end of file
From 472e6c7177e6bcb7022b08c09294c0a6ac62d018 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:11:55 -0500
Subject: [PATCH 151/311] Fix Mafia 1 map day/night cycle
---
scripts/server/timers.js | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/scripts/server/timers.js b/scripts/server/timers.js
index 25d5b248..904f0a23 100644
--- a/scripts/server/timers.js
+++ b/scripts/server/timers.js
@@ -226,7 +226,7 @@ function checkServerGameTime() {
}
if (getGame() == AGRP_GAME_MAFIA_ONE) {
- if (server.mapName == "FREERIDE") {
+ if (getGameConfig().mainWorldScene[getGame()] == "FREERIDE") {
if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
sendMapChangeWarningToPlayer(null, true);
}
@@ -236,27 +236,23 @@ function checkServerGameTime() {
removeAllPlayersFromProperties();
removeAllPlayersFromVehicles();
saveServerDataToDatabase();
- game.changeMap(getGameConfig().mainWorldScene[getGame()]);
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to night`);
messageDiscordEventChannel("🌙 Changing server map to night");
- updateTimeRule();
- } else {
- getGameConfig().mainWorldScene[getGame()] = "FREERIDE";
- removeAllPlayersFromProperties();
- removeAllPlayersFromVehicles();
- saveServerDataToDatabase();
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
- logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to day`);
- messageDiscordEventChannel("🌞 Changing server map to day");
- updateTimeRule();
}
- } else {
+ } else if (getGameConfig().mainWorldScene[getGame()] == "FREERIDENOC") {
if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
sendMapChangeWarningToPlayer(null, true);
}
if (!isNightTime(getServerConfig().hour)) {
-
+ getGameConfig().mainWorldScene[getGame()] = "FREERIDE";
+ removeAllPlayersFromProperties();
+ removeAllPlayersFromVehicles();
+ saveServerDataToDatabase();
+ logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to day`);
+ messageDiscordEventChannel("🌞 Changing server map to day");
+ game.changeMap(getGameConfig().mainWorldScene[getGame()]);
}
}
}
From f9e7597c4cc847457b089b019cb9973fbf384da8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:12:54 -0500
Subject: [PATCH 152/311] Tell player about available language for region
---
scripts/server/client.js | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/scripts/server/client.js b/scripts/server/client.js
index e7088b4f..6b08c18a 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -132,6 +132,8 @@ class ClientData {
this.pedState = AGRP_PEDSTATE_NONE;
this.promptType = AGRP_PROMPT_NONE;
this.privateMessageReplyTo = null;
+ this.enteringExitingProperty = null;
+ this.inProperty = null;
// Paintball
this.inPaintBall = false;
@@ -266,11 +268,16 @@ function initClient(client) {
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(getPlayerIP(client));
- // let localeId = getLocaleFromCountryISO(iso);
- //}
- //showSmallGameMessage(client, getLocaleString(client, "LocaleOffer", `/lang ${getLocaleData(localeId)[2]}`), getColourByName("white"), 10000, "Roboto");
+ if (checkForGeoIPModule()) {
+ let iso = module.geoip.getCountryISO(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));
From bc548cfae00fa0dc1a15acfecf04c6a0cd774ee0 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:13:18 -0500
Subject: [PATCH 153/311] Update GeoIP database + move to folder
---
scripts/server/config.js | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/scripts/server/config.js b/scripts/server/config.js
index beb0feb1..c3a1ed8e 100644
--- a/scripts/server/config.js
+++ b/scripts/server/config.js
@@ -194,8 +194,8 @@ let globalConfig = {
subAccountNameAllowedCharacters: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
emailValidationRegex: /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
itemActionDelayExtraTimeout: 1000,
- geoIPCountryDatabaseFilePath: "geoip-country.mmdb",
- geoIPCityDatabaseFilePath: "geoip-city.mmdb",
+ geoIPCountryDatabaseFilePath: "modules/geoip/geoip-country.mmdb",
+ geoIPCityDatabaseFilePath: "modules/geoip/geoip-city.mmdb",
randomTipInterval: 600000,
weaponEquippableTypes: [
AGRP_ITEM_USE_TYPE_WEAPON,
@@ -1128,19 +1128,24 @@ function getDatabaseConfig() {
function loadServerConfig() {
logToConsole(LOG_DEBUG, "[AGRP.Config] Loading server configuration");
- try {
- if (toInteger(server.getCVar("agrp_devserver")) == 1) {
- serverConfig = loadServerConfigFromGame(getGame());
- } else {
- serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
- }
- } catch (error) {
- logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
- thisResource.stop();
+ if (toInteger(server.getCVar("agrp_devserver")) == 1) {
+ serverConfig = loadServerConfigFromGame(getGame());
+
+ if (serverConfig == false) {
+ logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()}`);
+ server.shutdown();
+ }
+ } else {
+ serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
+
+ if (serverConfig == false) {
+ logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
+ server.shutdown();
+ }
}
- logToConsole(LOG_DEBUG | LOG_WARN, `Server ID: ${serverConfig.databaseId}`);
+ //logToConsole(LOG_DEBUG | LOG_WARN, `Server ID: ${serverConfig.databaseId}`);
}
// ===========================================================================
\ No newline at end of file
From f0410ca5b8c44d1cb4727d9247d99d80edaa825c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:13:37 -0500
Subject: [PATCH 154/311] Woops typo in locale string name
---
scripts/server/staff.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/staff.js b/scripts/server/staff.js
index f0a09f28..0c96796c 100644
--- a/scripts/server/staff.js
+++ b/scripts/server/staff.js
@@ -419,7 +419,7 @@ function warpIntoVehicleCommand(command, params, client) {
} else {
let vehicleIndex = getParam(params, " ", 1);
if (typeof getServerData().vehicles[vehicleIndex] == "undefined") {
- messagePlayerError(client, getLocaleString(client, "InvaliVehicle"));
+ messagePlayerError(client, getLocaleString(client, "InvalidVehicle"));
return false;
}
From e18b7c9b318a8644ca357bd2ad96987a5dffc552 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:13:53 -0500
Subject: [PATCH 155/311] Fix NPCs
---
scripts/server/npc.js | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/scripts/server/npc.js b/scripts/server/npc.js
index fb9e7cce..d0f46f79 100644
--- a/scripts/server/npc.js
+++ b/scripts/server/npc.js
@@ -65,6 +65,7 @@ class NPCData {
this.animationName = "";
this.ownerType = AGRP_NPC_OWNER_NONE;
this.ownerId = 0;
+ this.enabled = false;
this.bodyParts = {
hair: [0, 0],
@@ -98,7 +99,6 @@ class NPCData {
this.rotation = toVector3(toFloat(dbAssoc["npc_rot_x"]), toFloat(dbAssoc["npc_rot_y"]), toFloat(dbAssoc["npc_rot_z"]));
this.scale = toVector3(toFloat(dbAssoc["npc_scale_x"]), toFloat(dbAssoc["npc_scale_y"]), toFloat(dbAssoc["npc_scale_z"]));
this.heading = toFloat(dbAssoc["npc_rot_z"]);
- this.lastLogin = toInteger(dbAssoc["npc_when_lastlogin"]);
this.rank = toInteger(dbAssoc["npc_rank"]);
this.title = toInteger(dbAssoc["npc_title"]);
this.job = toInteger(dbAssoc["npc_job"]);
@@ -112,7 +112,9 @@ class NPCData {
this.heedThreats = intToBool(dbAssoc["npc_headthreats"]);
this.threats = toInteger(dbAssoc["npc_threats"]);
this.invincible = intToBool(dbAssoc["npc_invincible"]);
- this.animationName = intToBool(dbAssoc["npc_animation"]);
+ this.animationName = toString(dbAssoc["npc_animation"]);
+ this.enabled = intToBool(dbAssoc["npc_enabled"]);
+ this.lookAtPlayer = intToBool(dbAssoc["npc_lookatplr"]);
this.bodyParts = {
hair: [toInteger(dbAssoc["npc_hd_part_hair_model"]) || 0, toInteger(dbAssoc["npc_hd_part_hair_texture"]) || 0],
@@ -394,6 +396,7 @@ function saveNPCToDatabase(npcDataId) {
let safeAnimationName = escapeDatabaseString(dbConnection, tempNPCData.animationName);
let safeName = escapeDatabaseString(dbConnection, tempNPCData.name);
+ let safeTitle = escapeDatabaseString(dbConnection, tempNPCData.title);
let data = [
["npc_server", getServerId()],
@@ -416,6 +419,15 @@ function saveNPCToDatabase(npcDataId) {
["npc_threats", toInteger(tempNPCData.threats)],
["npc_stay", boolToInt(tempNPCData.stay)],
["npc_type_flags", toInteger(tempNPCData.typeFlags)],
+ ["npc_int", toInteger(tempNPCData.interior)],
+ ["npc_vw", toInteger(tempNPCData.dimension)],
+ ["npc_fight_style", toInteger(tempNPCData.walkStyle)],
+ ["npc_walk_style", toInteger(tempNPCData.fightStyle)],
+ ["npc_rank", toInteger(tempNPCData.rank)],
+ ["npc_title", toString(safeTitle)],
+ ["npc_enabled", boolToInt(tempNPCData.enabled)],
+ ["npc_lookatplr", boolToInt(tempNPCData.lookAtPlayer)],
+ //["npc_recreate", toInteger(tempNPCData.recreateOnDeath)],
];
let dbQuery = null;
@@ -729,8 +741,10 @@ function getClosestNPC(position, interior, dimension) {
let closest = 0;
for (let i in npcs) {
- if (getDistance(npcs[i].ped.position, position) < getDistance(npcs[closest].ped.position, position) && npcs[closest].interior == interior && npcs[closest].dimension == dimension) {
- closest = i;
+ if (npcs[i].interior == interior && npcs[i].dimension == dimension) {
+ if (getDistance(npcs[i].ped.position, position) < getDistance(npcs[closest].ped.position, position)) {
+ closest = i;
+ }
}
}
From a715cdcc9f87038aec4e98f7561cd3b359b46dc4 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:14:11 -0500
Subject: [PATCH 156/311] Fix client house/business handling
---
scripts/server/netevents.js | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js
index 12869e6a..f03732fb 100644
--- a/scripts/server/netevents.js
+++ b/scripts/server/netevents.js
@@ -131,9 +131,9 @@ function playerClientStarted(client) {
// ===========================================================================
function playerClientStopped(client) {
- logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?). Kicking them from the server ...`);
- getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
- disconnectPlayer(client);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
+ //getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
+ //disconnectPlayer(client);
}
// ===========================================================================
@@ -1103,19 +1103,19 @@ function setPlayerInfiniteRun(client, state) {
// ==========================================================================
-function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems) {
- sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, hasItems);
+function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
+ sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems);
}
// ==========================================================================
-function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior) {
- sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior);
+function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
+ sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked);
}
// ==========================================================================
-function sendJobToPlayer(client, jobId, jobLocationId, name, position) {
+function sendJobToPlayer(client, jobId, jobLocationId, name, position, blipModel, pickupModel) {
sendNetworkEventToPlayer("agrp.job", client, jobId, jobLocationId, name, position);
}
@@ -1149,7 +1149,7 @@ function sendAllJobsToPlayer(client) {
let jobs = getServerData().jobs;
for (let i in jobs) {
for (let j in jobs[i].locations) {
- sendJobToPlayer(client, jobs[i].index, jobs[i].locations[j].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].blipModel);
+ sendJobToPlayer(client, jobs[i].index, jobs[i].locations[j].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].pickupModel, jobs[i].blipModel);
}
}
}
@@ -1298,6 +1298,11 @@ function sendMapChangeWarningToPlayer(client, changingToNight) {
function playerMapLoaded(client, mapName) {
//updateAllInteriorVehiclesForPlayer(client, propertyData.exitInterior, propertyData.exitDimension);
+ getPlayerData(client).scene = mapName;
+
+ setTimeout(function () {
+ processPlayerEnteringExitingProperty(client);
+ }, 500);
}
// ==========================================================================
@@ -1306,4 +1311,10 @@ function setMapChangeWarningForPlayer(client, isChanging) {
sendNetworkEventToPlayer("agrp.mapChangeWarning", client, isChanging);
}
+// ==========================================================================
+
+function fadePlayerCamera(client, fadeIn, time, colour = toColour(0, 0, 0, 255)) {
+ sendNetworkEventToPlayer("agrp.fadeCamera", client, fadeIn, time, colour);
+}
+
// ==========================================================================
\ No newline at end of file
From d34b10470c9ec895020f307807c9a58cbcf7378f Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:14:18 -0500
Subject: [PATCH 157/311] Add server shutdown native
---
scripts/server/native/connected.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js
index 98b92217..bd05c88c 100644
--- a/scripts/server/native/connected.js
+++ b/scripts/server/native/connected.js
@@ -1475,4 +1475,10 @@ function setServerPassword(password) {
server.setPassword(password);
}
+// ===========================================================================
+
+function shutdownServer() {
+ server.shutdown();
+}
+
// ===========================================================================
\ No newline at end of file
From f3f2dd0e7d850cf4bb040ef956d45601cdb1aa72 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:14:51 -0500
Subject: [PATCH 158/311] Check for scene when entering/exiting property
---
scripts/server/misc.js | 60 ++++++++++++++++++++++--------------------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 1149de83..1bbe4791 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -211,7 +211,7 @@ function enterExitPropertyCommand(command, params, client) {
return false;
}
- if (areServerElementsSupported()) {
+ if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
if (!getPlayerData(client).currentPickup) {
return false;
}
@@ -307,7 +307,8 @@ function enterExitPropertyCommand(command, params, client) {
meActionToNearbyPlayers(client, getLanguageLocaleString(englishId, "EntersProperty", typeString, nameString));
if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
- if (isMainWorldScene(closestProperty.exitScene)) {
+ getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.exitPosition;
+ if (isMainWorldScene(closestProperty.exitScene) || closestProperty.exitScene == "AGRP.MAINWORLD") {
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
} else {
setPlayerScene(client, closestProperty.exitScene);
@@ -320,7 +321,7 @@ function enterExitPropertyCommand(command, params, client) {
}
setTimeout(function () {
- handlePlayerEnteringExitingProperty(client);
+ processPlayerEnteringExitingProperty(client);
}, 1100);
return true;
}
@@ -337,11 +338,12 @@ function enterExitPropertyCommand(command, params, client) {
meActionToNearbyPlayers(client, getLanguageLocaleString(englishId, "ExitsProperty", typeString, nameString));
- if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
- if (isMainWorldScene(closestProperty.exitScene)) {
+ if (closestProperty.entranceScene != "" && isGameFeatureSupported("interiorScene")) {
+ getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.entrancePosition;
+ if (isMainWorldScene(closestProperty.entranceScene) || closestProperty.entranceScene == "AGRP.MAINWORLD") {
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
} else {
- setPlayerScene(client, closestProperty.exitScene);
+ setPlayerScene(client, closestProperty.entranceScene);
}
return false;
@@ -352,7 +354,7 @@ function enterExitPropertyCommand(command, params, client) {
}
setTimeout(function () {
- handlePlayerEnteringExitingProperty(client);
+ processPlayerEnteringExitingProperty(client);
}, 1100);
}
}
@@ -863,9 +865,7 @@ function processPlayerDeath(client) {
updatePlayerSpawnedState(client, false);
setPlayerControlState(client, false);
setTimeout(function () {
- if (isFadeCameraSupported()) {
- fadeCamera(client, false, 1.0);
- }
+ fadePlayerCamera(client, false, 1000);
setTimeout(function () {
if (isPlayerInPaintBall(client)) {
respawnPlayerForPaintBall(client);
@@ -880,15 +880,9 @@ function processPlayerDeath(client) {
stopWorking(client);
}
- if (getGame() == AGRP_GAME_MAFIA_ONE) {
- spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestJail.position, closestJail.heading);
- } else {
- spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
- }
+ spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
- if (isFadeCameraSupported()) {
- fadeCamera(client, true, 1.0);
- }
+ fadePlayerCamera(client, true, 1000);
updatePlayerSpawnedState(client, true);
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
@@ -903,16 +897,8 @@ function processPlayerDeath(client) {
stopWorking(client);
}
- if (getGame() == AGRP_GAME_MAFIA_ONE) {
- spawnPlayer(client, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0], closestHospital.position, closestHospital.heading);
- } else {
- spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
- }
-
- if (isFadeCameraSupported()) {
- fadeCamera(client, true, 1.0);
- }
-
+ spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
+ fadePlayerCamera(client, true, 1000);
updatePlayerSpawnedState(client, true);
makePlayerStopAnimation(client);
setPlayerControlState(client, true);
@@ -946,4 +932,20 @@ function isPlayerRestrained(client) {
return (getPlayerData(client).pedState == AGRP_PEDSTATE_BINDED);
}
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
+
+function getPlayerInPropertyData(client) {
+ let businessId = getPlayerBusiness(client);
+ if (businessId != -1) {
+ getPlayerData(client).inProperty = [AGRP_PROPERTY_TYPE_BUSINESS, businessId];
+ return false;
+ }
+
+ let houseId = getPlayerHouse(client);
+ if (houseId != -1) {
+ getPlayerData(client).inProperty = [AGRP_PROPERTY_TYPE_HOUSE, houseId];
+ return false;
+ }
+
+ getPlayerData(client).inProperty = null;
+}
\ No newline at end of file
From 4f2c15819290e509a572ae58b8b112d8ca97cc97 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:15:02 -0500
Subject: [PATCH 159/311] Add locale from country ISO util
---
scripts/server/locale.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/server/locale.js b/scripts/server/locale.js
index 7d067795..e506a96e 100644
--- a/scripts/server/locale.js
+++ b/scripts/server/locale.js
@@ -295,4 +295,16 @@ async function translateMessage(messageText, translateFrom = getGlobalConfig().l
});
}
+// ===========================================================================
+
+function getLocaleFromCountryISO(isoCode) {
+ for (let i in getLocales()) {
+ for (let j in getLocales()[i].countries) {
+ if (toLowerCase(getLocales()[i].countries[j]) == toLowerCase(isoCode)) {
+ return getLocales()[i].id;
+ }
+ }
+ }
+}
+
// ===========================================================================
\ No newline at end of file
From 94195d95d301adedeadd53de0e6e6c87ac290323 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:15:16 -0500
Subject: [PATCH 160/311] Fix house pickup for clientside
---
scripts/server/house.js | 40 ++++++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 7686eed3..92e44614 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -1079,13 +1079,6 @@ function createHouseEntrancePickup(houseId) {
getHouseData(houseId).entrancePickup = entrancePickup;
updateHousePickupLabelData(houseId);
}
- } else {
- let pickupModelId = getGameConfig().pickupModels[getGame()].House;
-
- if (houseData.entrancePickupModel != 0) {
- pickupModelId = houseData.entrancePickupModel;
- }
- sendHouseToPlayer(null, houseId, houseId.description, houseId.entrancePosition, blipModelId, pickupModelId, houseData.buyPrice, houseData.rentPrice, houseId.hasInterior);
}
}
@@ -1787,7 +1780,8 @@ function getHouseFromParams(params) {
// ===========================================================================
function updateHousePickupLabelData(houseId) {
- if (!areServerElementsSupported()) {
+ if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
+ sendHouseToPlayer(null, houseId, getHouseData(houseId).description, getHouseData(houseId).entrancePosition, getHouseEntranceBlipModelForNetworkEvent(houseId), getHouseEntrancePickupModelForNetworkEvent(houseId), getHouseData(houseId).buyPrice, getHouseData(houseId).rentPrice, getHouseData(houseId).hasInterior, getHouseData(houseId).locked);
return false;
}
@@ -1868,4 +1862,34 @@ function isPlayerInAnyHouse(client) {
return false;
}
+// ===========================================================================
+
+function getHouseEntranceBlipModelForNetworkEvent(houseIndex) {
+ let blipModelId = -1;
+ if (isGameFeatureSupported("blip")) {
+ blipModelId = getGameConfig().blipSprites[getGame()].House;
+
+ if (getHouseData(houseIndex).entranceBlipModel != 0) {
+ blipModelId = getHouseData(houseIndex).entranceBlipModel;
+ }
+ }
+
+ return blipModelId;
+}
+
+// ===========================================================================
+
+function getHouseEntrancePickupModelForNetworkEvent(houseIndex) {
+ let pickupModelId = -1;
+ if (isGameFeatureSupported("pickup")) {
+ pickupModelId = getGameConfig().pickupModels[getGame()].House;
+
+ if (getHouseData(houseIndex).entrancePickupModel != 0) {
+ pickupModelId = getHouseData(houseIndex).entrancePickupModel;
+ }
+ }
+
+ return pickupModelId;
+}
+
// ===========================================================================
\ No newline at end of file
From 4948ba8f9873746f5ea63356b34540790430ab8f Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:15:38 -0500
Subject: [PATCH 161/311] Add ped fall event for MafiaC + send jobs
---
scripts/server/event.js | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index e41cbd7d..e4a0507a 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -33,6 +33,10 @@ function addAllEventHandlers() {
addEventHandler("onPedExitedVehicleEx", onPedExitedVehicle);
addEventHandler("onPedEnteredSphereEx", onPedEnteredSphere);
addEventHandler("onPedExitedSphereEx", onPedExitedSphere);
+
+ if (getGame() == AGRP_GAME_MAFIA_ONE) {
+ addEventHandler("onPedFall", onPedFall);
+ }
}
// ===========================================================================
@@ -581,11 +585,14 @@ async function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
sendAllBusinessesToPlayer(client);
sendAllHousesToPlayer(client);
- //sendAllJobsToPlayer(client);
- //sendAllVehiclesToPlayer(client);
+ sendAllJobsToPlayer(client);
requestPlayerPedNetworkId(client);
}
+ if (!areServerElementsSupported()) {
+ sendAllVehiclesToPlayer(client);
+ }
+
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
updatePlayerSpawnedState(client, true);
@@ -599,6 +606,19 @@ async function onPlayerSpawn(client) {
setPlayerWeaponDamageEvent(client, AGRP_WEAPON_DAMAGE_EVENT_NORMAL);
+ if (doesPlayerHaveGUIEnabled(client) && getServerConfig().useGUI == true) {
+ if (checkForGeoIPModule()) {
+ let iso = getPlayerCountryISOCode(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");
+ }
+ }
+ }
+ }
+
if (areServerElementsSupported()) {
if (getGlobalConfig().playerStreamInDistance == -1 || getGlobalConfig().playerStreamOutDistance == -1) {
getPlayerPed(client).netFlags.distanceStreaming = false;
@@ -840,4 +860,15 @@ function onPlayerExitingVehicle(client, vehicle, seat) {
}
+// ===========================================================================
+
+function onPedFall(ped) {
+ if (ped.isType(ELEMENT_PLAYER)) {
+ let client = getClientFromPlayerElement(ped);
+ if (client != null) {
+ processPlayerDeath(client);
+ }
+ }
+}
+
// ===========================================================================
\ No newline at end of file
From ab4106e568a6344d7b1d97aed060abf74aacd4fc Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:16:29 -0500
Subject: [PATCH 162/311] Shutdown server if required module fail
---
scripts/server/startup.js | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/scripts/server/startup.js b/scripts/server/startup.js
index 3e945cd3..cb27c1ee 100644
--- a/scripts/server/startup.js
+++ b/scripts/server/startup.js
@@ -69,6 +69,15 @@ function checkForHashingModule() {
// ===========================================================================
+function checkForGeoIPModule() {
+ if (typeof module.geoip == "undefined") {
+ return false;
+ }
+ return true;
+}
+
+// ===========================================================================
+
function checkForMySQLModule() {
if (typeof module.mysql == "undefined") {
return false;
@@ -94,14 +103,14 @@ function checkForAllRequiredModules() {
if (!checkForHashingModule()) {
logToConsole(LOG_WARN, "[AGRP.Startup]: Hashing module is not loaded!");
- logToConsole(LOG_WARN, "[AGRP.Startup]: This resource will now shutdown.");
- thisResource.stop();
+ logToConsole(LOG_ERROR, "[AGRP.Startup]: This server will now shutdown.");
+ shutdownServer();
}
if (!checkForMySQLModule()) {
logToConsole(LOG_WARN, "[AGRP.Startup]: MySQL module is not loaded!");
- logToConsole(LOG_WARN, "[AGRP.Startup]: This resource will now shutdown.");
- thisResource.stop();
+ logToConsole(LOG_ERROR, "[AGRP.Startup]: This server will now shutdown.");
+ shutdownServer();
}
//if (!checkForSMTPModule()) {
From 84ad138763ab22187295ee2a2f91be7254b7100e Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:10:50 -0500
Subject: [PATCH 163/311] Rename a few VC skins
---
scripts/shared/gamedata.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index a55aee1c..7ce10d36 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -925,17 +925,17 @@ let gameData = {
[105, "Prostitute 1", true],
[106, "Prostitute 2", false],
[107, "Ricardo Diaz", true],
- [108, "Love Fist Guy", true],
+ [108, "Love Fist 1", true],
[109, "Ken Rosenburg", true],
[110, "Candy Suxx", true],
[111, "Hilary", true],
- [112, "Love Fist", true],
+ [112, "Love Fist 2", true],
[113, "Phil", true],
[114, "Rockstar Guy", true],
[115, "Sonny", true],
[116, "Lance", true],
[117, "Mercedes", true],
- [118, "Love Fist", true],
+ [118, "Love Fist 3", true],
[119, "Alex Scrub", true],
[120, "Officer Lance Vance", false],
[121, "Lance Vance", true],
From 36e2175075fb932688f32e52c428780459b7148f Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:11:03 -0500
Subject: [PATCH 164/311] Mark vehicle as server
---
scripts/server/vehicle.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index d8159595..8aeca4be 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -1514,6 +1514,8 @@ function spawnVehicle(vehicleData) {
setEntityData(vehicle, "agrp.interior", vehicleData.interior, true);
setEntityData(vehicle, "agrp.engine", vehicleData.engine, true);
+ setEntityData(vehicle, "agrp.server", true, true);
+
forcePlayerToSyncElementProperties(null, vehicle);
setElementTransient(vehicle, false);
From 34b84aeea005f3b821a2eb4955650e76073ff1ef Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:11:14 -0500
Subject: [PATCH 165/311] Fix NPC saving and utils
---
scripts/server/npc.js | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/scripts/server/npc.js b/scripts/server/npc.js
index d0f46f79..e9e4df44 100644
--- a/scripts/server/npc.js
+++ b/scripts/server/npc.js
@@ -45,6 +45,7 @@ class NPCData {
this.scale = toVector3(1.0, 1.0, 1.0);
this.heading = 0.0;
this.clan = 0;
+ this.rank = 0;
this.isWorking = false;
this.jobUniform = this.skin;
this.lastJobVehicle = null;
@@ -104,8 +105,8 @@ class NPCData {
this.job = toInteger(dbAssoc["npc_job"]);
this.interior = toInteger(dbAssoc["npc_int"]);
this.dimension = toInteger(dbAssoc["npc_vw"]);
- this.walkStyle = toInteger(dbAssoc["npc_walkstyle"]);
- this.fightStyle = toInteger(dbAssoc["npc_fightstyle"]);
+ this.walkStyle = toInteger(dbAssoc["npc_walk_style"]);
+ this.fightStyle = toInteger(dbAssoc["npc_fight_style"]);
this.health = toInteger(dbAssoc["npc_health"]);
this.armour = toInteger(dbAssoc["npc_armour"]);
this.typeFlags = toInteger(dbAssoc["npc_type_flags"]);
@@ -421,8 +422,8 @@ function saveNPCToDatabase(npcDataId) {
["npc_type_flags", toInteger(tempNPCData.typeFlags)],
["npc_int", toInteger(tempNPCData.interior)],
["npc_vw", toInteger(tempNPCData.dimension)],
- ["npc_fight_style", toInteger(tempNPCData.walkStyle)],
- ["npc_walk_style", toInteger(tempNPCData.fightStyle)],
+ ["npc_fight_style", toInteger(tempNPCData.fightStyle)],
+ ["npc_walk_style", toInteger(tempNPCData.walkStyle)],
["npc_rank", toInteger(tempNPCData.rank)],
["npc_title", toString(safeTitle)],
["npc_enabled", boolToInt(tempNPCData.enabled)],
@@ -524,7 +525,7 @@ function deleteNPC(npcId) {
if (getNPCData(npcId)) {
if (getNPCData(npcId).ped != false) {
- deleteEntity(getNPCData(npcId).ped);
+ deleteGameElement(getNPCData(npcId).ped);
}
getServerData().npcs.splice(npcId, 1);
}
@@ -676,7 +677,7 @@ function getNPCInfoCommand(command, params, client) {
return false;
}
- let closestNPC = getClosestNPC(getPlayerPosition(client));
+ let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client));
if (!getNPCData(closestNPC)) {
messagePlayerError(client, getLocaleString(client, "InvalidNPC"));
@@ -736,7 +737,7 @@ function getNPCInfoCommand(command, params, client) {
// ===========================================================================
-function getClosestNPC(position, interior, dimension) {
+function getClosestNPC(position, dimension, interior) {
let npcs = getServerData().npcs;
let closest = 0;
From e1e912ae3c599528519f0a2fcc59f2a76478a51c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:11:23 -0500
Subject: [PATCH 166/311] Don't set sync flags
---
scripts/server/event.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index e4a0507a..4e469c23 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -724,7 +724,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
if (seat == AGRP_VEHSEAT_DRIVER) {
vehicle.engine = getVehicleData(vehicle).engine;
setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
- vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
+ //vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
if (getVehicleData(vehicle).buyPrice > 0 && !doesPlayerHaveVehicleKeys(client, vehicle)) {
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}${getCurrencyString(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
@@ -825,7 +825,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
if (seat == AGRP_VEHSEAT_DRIVER) {
- vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
+ //vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
}
onPlayerEnteringVehicle(client, vehicle, seat);
}
@@ -841,7 +841,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
if (seat == AGRP_VEHSEAT_DRIVER) {
- vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
+ //vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
}
onPlayerExitingVehicle(client, vehicle, seat);
}
From 485d9023c1b26e1203c60fd1a1f8c9c01e28c5c8 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:11:40 -0500
Subject: [PATCH 167/311] Don't set sync flags + remove parked stuff
---
scripts/client/utilities.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 7a24a8b0..490bcef1 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -400,20 +400,20 @@ function processLocalPlayerVehicleControlState() {
if (doesEntityDataExist(localPlayer.vehicle, "agrp.engine")) {
if (getEntityData(localPlayer.vehicle, "agrp.engine") == false) {
localPlayer.vehicle.engine = false;
- localPlayer.vehicle.netFlags.sendSync = 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) {
- localPlayer.vehicle.position = parkedVehiclePosition;
- localPlayer.vehicle.heading = parkedVehicleHeading;
- }
+ //if (parkedVehiclePosition) {
+ // localPlayer.vehicle.position = parkedVehiclePosition;
+ // localPlayer.vehicle.heading = parkedVehicleHeading;
+ //}
}
} else {
- localPlayer.vehicle.netFlags.sendSync = true;
+ //localPlayer.vehicle.netFlags.sendSync = true;
}
}
}
From 0d50c483051e28ba2a50a36c0a1e1a3bfa4de297 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:11:52 -0500
Subject: [PATCH 168/311] Don't set sync flags in native
---
scripts/client/native/connected.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js
index 6bbe7780..985fd2c3 100644
--- a/scripts/client/native/connected.js
+++ b/scripts/client/native/connected.js
@@ -213,7 +213,7 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
// ===========================================================================
function setVehicleEngine(vehicleId, state) {
- getElementFromId(vehicleId).netFlags.sendSync = state;
+ //getElementFromId(vehicleId).netFlags.sendSync = state;
getElementFromId(vehicleId).engine = state;
}
From 8e9a92e1c263cec1d6bceb0edfd1a17955056313 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:12:00 -0500
Subject: [PATCH 169/311] Remove extra parked stuff
---
scripts/client/main.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/client/main.js b/scripts/client/main.js
index 7e81b061..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;
From cad6d11a588d95b8464759aa8776bf04609f5e58 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 2 Oct 2022 09:12:17 -0500
Subject: [PATCH 170/311] Use server engine state
---
scripts/client/event.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index 983cf904..ae41496a 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -208,11 +208,12 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
if (ped == localPlayer) {
if (areServerElementsSupported()) {
if (inVehicleSeat == 0) {
- setVehicleEngine(vehicle.id, false);
- //setLocalPlayerControlState(false, 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);
}
}
}
From e072d8d2e4ab78113ac6839634a53ff5170f972a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 14:17:04 -0500
Subject: [PATCH 171/311] Add duration and loop to some anim data
---
scripts/shared/gamedata.js | 110 ++++++++++++++++++-------------------
1 file changed, 55 insertions(+), 55 deletions(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index 7ce10d36..aebe9878 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -16,6 +16,8 @@ class AnimationData {
this.animType = (typeof data.animType != "undefined") ? data.animType : AGRP_ANIMTYPE_NORMAL;
this.animSpeed = (typeof data.animSpeed != "undefined") ? data.animSpeed : 0.0;
this.moveType = (typeof data.moveType != "undefined") ? data.moveType : AGRP_ANIMMOVE_NONE;
+ this.duration = -1;
+ this.loop = true;
// GTA IV
this.infiniteLoop = (typeof data.infiniteLoop != "undefined") ? data.infiniteLoop : false;
@@ -4786,8 +4788,8 @@ let gameData = {
new AnimationData("talk", { groupId: 0, animId: 11 }),
new AnimationData("chat", { groupId: 0, animId: 11 }),
- new AnimationData("hailtaxi", { groupId: 0, animId: 12 }),
- new AnimationData("wave", { groupId: 0, animId: 12 }),
+ new AnimationData("hailtaxi", { groupId: 0, animId: 12, duration: 2000 }),
+ new AnimationData("wave", { groupId: 0, animId: 12, duration: 5250 }),
new AnimationData("headscratch", { groupId: 0, animId: 157 }),
new AnimationData("lookaround1", { groupId: 0, animId: 158 }),
@@ -4832,19 +4834,19 @@ let gameData = {
new AnimationData("phonein", { groupId: 0, animId: 165 }),
new AnimationData("phonetalk", { groupId: 0, animId: 166 }),
new AnimationData("sit", { groupId: 0, animId: 169, animSpeed: 1.0 }),
- new AnimationData("atm", { groupId: 0, animId: 171 }),
- new AnimationData("cpr", { groupId: 24, animId: 214 }),
+ new AnimationData("atm", { groupId: 0, animId: 171, duration: 7500, loop: true }),
+ new AnimationData("cpr", { groupId: 24, animId: 214, duration: 5000, loop: true }),
new AnimationData("idle1", { groupId: 26, animId: 215 }),
new AnimationData("idle2", { groupId: 26, animId: 216 }),
new AnimationData("idle3", { groupId: 26, animId: 217 }),
new AnimationData("idle4", { groupId: 26, animId: 218 }),
- new AnimationData("dance1", { groupId: 28, animId: 226 }),
- new AnimationData("dance2", { groupId: 28, animId: 227 }),
- new AnimationData("dance3", { groupId: 28, animId: 228 }),
- new AnimationData("dance4", { groupId: 28, animId: 229 }),
- new AnimationData("dance5", { groupId: 28, animId: 230 }),
- new AnimationData("dance6", { groupId: 28, animId: 231 }),
- new AnimationData("dance7", { groupId: 28, animId: 232 }),
+ new AnimationData("dance1", { groupId: 28, animId: 226, duration: 5000, loop: true }),
+ new AnimationData("dance2", { groupId: 28, animId: 227, duration: 5000, loop: true }),
+ new AnimationData("dance3", { groupId: 28, animId: 228, duration: 5000, loop: true }),
+ new AnimationData("dance4", { groupId: 28, animId: 229, duration: 5000, loop: true }),
+ new AnimationData("dance5", { groupId: 28, animId: 230, duration: 5000, loop: true }),
+ new AnimationData("dance6", { groupId: 28, animId: 231, duration: 5000, loop: true }),
+ new AnimationData("dance7", { groupId: 28, animId: 232, duration: 5000, loop: true }),
new AnimationData("pressbutton", { groupId: 0, animId: 62 }),
new AnimationData("sitright", { groupId: 0, animId: 169, moveType: AGRP_ANIMMOVE_RIGHT }),
new AnimationData("sitleft", { groupId: 0, animId: 169, moveType: AGRP_ANIMMOVE_LEFT }),
@@ -6770,51 +6772,49 @@ let gameData = {
SingleSparking: 21,
}
},
- mapAreas: {
+ areas: {
[AGRP_GAME_GTA_III]: [
- /*
- [ROADBR1, 1, [[617.442, -958.347, 6.26083], [1065.44, -908.347, 206.261]], 1],
- [PORT_W, 0, [[751.68, -1178.22, -13.8723], [1065.68, -958.725, 136.128]], 1],
- [FISHFAC, 2, [[944.208, -1149.81, -9.72576], [1016.14, -1076.01, 40.2742]], 1],
- [PORT_S, 0, [[1065.88, -1251.55, -13.5049], [1501.88, -1069.93, 136.495]], 1],
- [PORT_E, 0, [[1363.68, -1069.65, -18.8643], [1815.68, -613.646, 131.136]], 1],
- [PORT_I, 0, [[1065.88, -1069.85, 1.49868], [1363.38, -742.054, 151.499]], 1],
- [CHINA, 0, [[745.421, -908.289, -21.203], [1065.42, -463.69, 129.593]], 1],
- [REDLIGH, 0, [[745.378, -463.616, -22.6676], [1065.38, -282.616, 147.332]], 1],
- [TOWERS, 0, [[745.421, -282.4, -13.4117], [1065.42, -78.7699, 136.588]], 1],
- [LITTLEI, 0, [[1065.9, -512.324, -14.296], [1388.9, -78.324, 135.704]], 1],
- [HARWOOD, 0, [[745.979, -78.1778, -48.5832], [1388.98, 322.676, 101.417]], 1],
- [EASTBAY, 0, [[1389.37, -613.467, -29.883], [1797.6, 199.628, 120.117]], 1],
- [S_VIEW, 0, [[1066.1, -741.806, -34.2068], [1363.6, -512.806, 115.793]], 1],
- [COPS_1, 2, [[1135.8, -695.021, 6.9661], [1182.36, -631.021, 56.9661]], 1],
- [HOSPI_1, 2, [[1136.09, -609.976, 6.287], [1182.09, -521.167, 56.287]], 1],
- [IND_ZON, 0, [[617.151, -1329.72, -117.535], [1902.66, 434.115, 482.465]], 1],
- [ROADBR2, 1, [[444.768, -958.298, 30.7441], [614.878, -908.298, 180.744]], 2],
- [FILLIN1, 2, [[1363.77, -613.339, -4.43849], [1389.17, -512.539, 70.4322]], 1],
- [CONSTRU, 0, [[239.878, -411.617, 7.62939], [614.322, -61.6167, 163.819]], 2],
- [STADIUM, 0, [[-225.764, -412.604, -9.53674], [116.236, 160.496, 120.271]], 2],
- [YAKUSA, 0, [[199.766, -1672.42, -61.7588], [577.766, -1059.93, 432.688]], 2],
- [SHOPING, 0, [[-224.438, -1672.05, -61.3183], [99.562, -1004.45, 432.352]], 2],
- [COM_EAS, 0, [[200.107, -1059.19, -0.000144958], [615.107, -412.193, 198.864]], 2],
- [PARK, 0, [[-121.567, -1003.07, -46.7463], [199.271, -413.068, 224.163]], 2],
- [UNIVERS, 0, [[117.268, -411.622, 0.000190735], [239.268, -61.6218, 166.36]], 2],
- [HOSPI_2, 0, [[117.236, -61.1105, -17.071], [615.236, 268.889, 83.754]], 2],
- [AIRPORT, 0, [[-1632.97, -1344.71, -45.9404], [-468.629, -268.443, 254.696]], 3],
- [PROJECT, 0, [[-811.835, -268.074, -45.8745], [-371.041, 92.7263, 254.241]], 3],
- [SWANKS, 0, [[-867.229, 93.3882, -50.1134], [-266.914, 650.058, 250.426]], 3],
- [SUB_IND, 0, [[-1407.57, -267.966, -49.6792], [-812.306, 92.7559, 250.437]], 3],
- [BIG_DAM, 0, [[-1394.5, 93.4441, -46.7412], [-867.52, 704.544, 253.344]], 3],
- [MAIN_D1, 2, [[1037.53, -907.274, 0.0, 1065.16], [-637.689, 30.0069]], 1],
- [MAIN_D2, 2, [[966.079, -637.366, 0.0, 1064.83], [-609.557, 30.0789]], 1],
- [MAIN_D3, 2, [[965.795, -608.99, 0.0, 995.306], [-470.23, 30.9302]], 1],
- [MAIN_D4, 2, [[995.59, -511.092, 0.0, 1065.11], [-470.23, 30.0789]], 1],
- [MAIN_D5, 2, [[1035.88, -463.56, 0.0, 1064.8], [85, -179.224, 30.6465]], 1],
- [SUB_ZON, 0, [[-1644.64, -1351.38, -117.0], [-266.895, 1206.35, 483.0]], 3],
- [COM_ZON, 0, [[-265.479, -1719.97, -114.769], [615.52, 367.265, 485.231]], 1],
- [SUB_ZO2, 0, [[-265.444, 161.113, -41.7094], [-121.287, 367.043, 358.291]], 1],
- [SUB_ZO3, 0, [[-265.434, 79.0922, -45.8201], [-226.334, 161.064, 354.18]], 1],
- [WEE_DAM, 2, [[-1238.59, 306.841, -0.48605], [-910.445, 504.646, 39.514]], 3],
- */
+ ["Callahan Bridge", 1, [[617.442, -958.347, 6.26083], [1065.44, -908.347, 206.261]], 1],
+ ["Callahan Point", 0, [[751.68, -1178.22, -13.8723], [1065.68, -958.725, 136.128]], 1],
+ ["Fish Factory", 2, [[944.208, -1149.81, -9.72576], [1016.14, -1076.01, 40.2742]], 1],
+ ["Atlantic Quays", 0, [[1065.88, -1251.55, -13.5049], [1501.88, -1069.93, 136.495]], 1],
+ ["Portland Harbor", 0, [[1363.68, -1069.65, -18.8643], [1815.68, -613.646, 131.136]], 1],
+ ["Trenton", 0, [[1065.88, -1069.85, 1.49868], [1363.38, -742.054, 151.499]], 1],
+ ["Chinatown", 0, [[745.421, -908.289, -21.203], [1065.42, -463.69, 129.593]], 1],
+ ["Red Light District", 0, [[745.378, -463.616, -22.6676], [1065.38, -282.616, 147.332]], 1],
+ ["Hepburn Heights", 0, [[745.421, -282.4, -13.4117], [1065.42, -78.7699, 136.588]], 1],
+ ["Saint Marks", 0, [[1065.9, -512.324, -14.296], [1388.9, -78.324, 135.704]], 1],
+ ["Harwood", 0, [[745.979, -78.1778, -48.5832], [1388.98, 322.676, 101.417]], 1],
+ ["Portland Beach", 0, [[1389.37, -613.467, -29.883], [1797.6, 199.628, 120.117]], 1],
+ ["Portland View", 0, [[1066.1, -741.806, -34.2068], [1363.6, -512.806, 115.793]], 1],
+ ["Liberty City", 2, [[1135.8, -695.021, 6.9661], [1182.36, -631.021, 56.9661]], 1],
+ ["Liberty City", 2, [[1136.09, -609.976, 6.287], [1182.09, -521.167, 56.287]], 1],
+ ["Portland", 0, [[617.151, -1329.72, -117.535], [1902.66, 434.115, 482.465]], 1],
+ ["Callahan Bridge", 1, [[444.768, -958.298, 30.7441], [614.878, -908.298, 180.744]], 2],
+ ["Liberty City", 2, [[1363.77, -613.339, -4.43849], [1389.17, -512.539, 70.4322]], 1],
+ ["Fort Staunton", 0, [[239.878, -411.617, 7.62939], [614.322, -61.6167, 163.819]], 2],
+ ["Aspatria", 0, [[-225.764, -412.604, -9.53674], [116.236, 160.496, 120.271]], 2],
+ ["Torrington", 0, [[199.766, -1672.42, -61.7588], [577.766, -1059.93, 432.688]], 2],
+ ["Bedford Point", 0, [[-224.438, -1672.05, -61.3183], [99.562, -1004.45, 432.352]], 2],
+ ["Newport", 0, [[200.107, -1059.19, -0.000144958], [615.107, -412.193, 198.864]], 2],
+ ["Belleville Park", 0, [[-121.567, -1003.07, -46.7463], [199.271, -413.068, 224.163]], 2],
+ ["Liberty Campus", 0, [[117.268, -411.622, 0.000190735], [239.268, -61.6218, 166.36]], 2],
+ ["Rockford", 0, [[117.236, -61.1105, -17.071], [615.236, 268.889, 83.754]], 2],
+ ["Francis Intl. Airport", 0, [[-1632.97, -1344.71, -45.9404], [-468.629, -268.443, 254.696]], 3],
+ ["Wichita Gardens", 0, [[-811.835, -268.074, -45.8745], [-371.041, 92.7263, 254.241]], 3],
+ ["Cedar Grove", 0, [[-867.229, 93.3882, -50.1134], [-266.914, 650.058, 250.426]], 3],
+ ["Pike Creek", 0, [[-1407.57, -267.966, -49.6792], [-812.306, 92.7559, 250.437]], 3],
+ ["Cochrane Dam", 0, [[-1394.5, 93.4441, -46.7412], [-867.52, 704.544, 253.344]], 3],
+ ["Liberty City", 2, [[1037.53, -907.274, 0.0, 1065.16], [-637.689, 30.0069]], 1],
+ ["Liberty City", 2, [[966.079, -637.366, 0.0, 1064.83], [-609.557, 30.0789]], 1],
+ ["Liberty City", 2, [[965.795, -608.99, 0.0, 995.306], [-470.23, 30.9302]], 1],
+ ["Liberty City", 2, [[995.59, -511.092, 0.0, 1065.11], [-470.23, 30.0789]], 1],
+ ["Liberty City", 2, [[1035.88, -463.56, 0.0, 1064.8], [85, -179.224, 30.6465]], 1],
+ ["Shoreside Vale", 0, [[-1644.64, -1351.38, -117.0], [-266.895, 1206.35, 483.0]], 3],
+ ["Staunton Island", 0, [[-265.479, -1719.97, -114.769], [615.52, 367.265, 485.231]], 1],
+ ["Shoreside Vale", 0, [[-265.444, 161.113, -41.7094], [-121.287, 367.043, 358.291]], 1],
+ ["Shoreside Vale", 0, [[-265.434, 79.0922, -45.8201], [-226.334, 161.064, 354.18]], 1],
+ ["Cochrane Dam", 2, [[-1238.59, 306.841, -0.48605], [-910.445, 504.646, 39.514]], 3],
]
}
};
From b4d9371db23c98d6e1df346752dfbaf8c1a55dad Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 16:50:59 -0500
Subject: [PATCH 172/311] Debug logging
---
scripts/client/event.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/client/event.js b/scripts/client/event.js
index ae41496a..056fc09d 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -64,6 +64,7 @@ function onResourceStart(event, resource) {
}
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();
@@ -74,6 +75,7 @@ function onResourceStart(event, resource) {
function onResourceStop(event, resource) {
if (resource == thisResource) {
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStop called - Sending signal to server`);
sendResourceStoppedSignalToServer();
}
}
@@ -82,6 +84,7 @@ 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();
}
@@ -90,6 +93,7 @@ function onResourceReady(event, resource) {
// ===========================================================================
function onProcess(event, deltaTime) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Event] onProcess`);
if (localPlayer == null) {
return false;
}
@@ -124,6 +128,7 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
// ===========================================================================
function onDrawnHUD(event) {
+ logToConsole(LOG_VERBOSE, `[AGRP.Event] HUD drawn`);
processMouseCursorRendering();
if (!renderHUD) {
From 2d3a9dbc4c9ec3742753823e9172d024b3ee8982 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 16:51:19 -0500
Subject: [PATCH 173/311] Remove extra debug line
---
scripts/server/client.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 6b08c18a..3d541fb8 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -216,8 +216,6 @@ function initClient(client) {
return false;
}
- logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
-
if (playerInitialized[client.index] == true) {
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
return false;
From d5841dc0e6f5f5a49c719fbebd1ef9a0180e7c6d Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 16:51:38 -0500
Subject: [PATCH 174/311] Clear stale client stuff on join (just in case)
---
scripts/server/event.js | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index 4e469c23..4a660620 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -42,7 +42,7 @@ function addAllEventHandlers() {
// ===========================================================================
function onPlayerConnect(event, ipAddress, port) {
- logToConsole(LOG_INFO, `[AGRP.Event] Client connecting (IP: ${ipAddress})`);
+ logToConsole(LOG_INFO, `[AGRP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
//if(isIpAddressBanned(ipAddress)) {
// messagePlayerError(client, "You are banned from this server!");
// return false;
@@ -52,15 +52,14 @@ function onPlayerConnect(event, ipAddress, port) {
// ===========================================================================
function onPlayerJoin(event, client) {
- logToConsole(LOG_INFO, `[AGRP.Event] Client ${getPlayerName(client)}[${getPlayerId(client)}] joining from ${getPlayerIP(client)}`);
+ logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
- //if (isFadeCameraSupported()) {
- // fadeCamera(client, true, 1.0);
- //}
+ playerResourceReady[getPlayerId(client)] = false;
+ playerResourceStarted[getPlayerId(client)] = false;
+ playerInitialized[getPlayerId(client)] = false;
+ playerGUIReady[getPlayerId(client)] = false;
- //if(isCustomCameraSupported()) {
- // showConnectCameraToPlayer(client);
- //}
+ getServerData().clients[getPlayerId(client)] = null;
let messageText = `👋 ${getPlayerName(client)} is connecting to the server ...`;
messageDiscordEventChannel(messageText);
@@ -69,13 +68,12 @@ function onPlayerJoin(event, client) {
for (let i in clients) {
messagePlayerNormal(clients[i], getLocaleString(clients[i], "PlayerConnecting", getPlayerName(client)));
}
-
- //messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
}
// ===========================================================================
function onPlayerJoined(event, client) {
+ logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
//initClient(client);
}
From 6dfb45ff8a163d71bf04aba3df53b30217064189 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 16:51:44 -0500
Subject: [PATCH 175/311] Debug logging
---
scripts/server/netevents.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js
index f03732fb..e7b51868 100644
--- a/scripts/server/netevents.js
+++ b/scripts/server/netevents.js
@@ -80,7 +80,7 @@ function addAllNetworkEventHandlers() {
// ===========================================================================
function updatePlayerNameTag(client) {
- //logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
+ logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
}
@@ -131,7 +131,7 @@ function playerClientStarted(client) {
// ===========================================================================
function playerClientStopped(client) {
- logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
+ logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
//getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
//disconnectPlayer(client);
}
From 91d21189dc3b627eb83a578d4ff3798261a16bc0 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 16:52:13 -0500
Subject: [PATCH 176/311] Better checks for client data util
---
scripts/server/utilities.js | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js
index e6fe4354..638be407 100644
--- a/scripts/server/utilities.js
+++ b/scripts/server/utilities.js
@@ -51,12 +51,19 @@ function getGameAreas(gameId) {
* @return {ClientData} The player/client's data (class instancee)
*/
function getPlayerData(client) {
- if (client != null) {
- if (isClientInitialized(client)) {
- return getServerData().clients[getPlayerId(client)];
- }
+ if (client == null) {
+ return false;
}
- return false;
+
+ if (!isClientInitialized(client)) {
+ return false;
+ }
+
+ if (typeof getServerData().clients[getPlayerId(client)] == "undefined") {
+ return false;
+ }
+
+ return getServerData().clients[getPlayerId(client)];
}
// ===========================================================================
@@ -426,11 +433,11 @@ function isClientInitialized(client) {
// return false;
//}
- //if (playerInitialized[getPlayerId(client)] == false) {
- // return false;
- //}
+ if (playerInitialized[getPlayerId(client)] == true) {
+ return true;
+ }
- return (typeof getServerData().clients[getPlayerId(client)] != "undefined");
+ return false;
}
// ===========================================================================
From 0ef0474b2e591175d2841c465b11c07bc6bcd114 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 3 Oct 2022 16:52:25 -0500
Subject: [PATCH 177/311] Add a few seats positions
---
scripts/shared/gamedata.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index aebe9878..0a970acb 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -6816,7 +6816,15 @@ let gameData = {
["Shoreside Vale", 0, [[-265.434, 79.0922, -45.8201], [-226.334, 161.064, 354.18]], 1],
["Cochrane Dam", 2, [[-1238.59, 306.841, -0.48605], [-910.445, 504.646, 39.514]], 3],
]
+ },
+ seats: {
+ [AGRP_GAME_GTA_VC]: [
+ //new SeatData(new Vec3(480.47, -53.20, 11.48), -1.76, "sit1", 17),
+ //new SeatData(new Vec3(480.84, -53.44, 11.48), -1.22, "sit1", 17),
+ //new SeatData(new Vec3(480.94, -49.96, 11.48), -1.38, "sit1", 17),
+ //new SeatData(new Vec3(478.97, -49.14, 11.48), -2.32, "sit1", 17),
+ ],
}
};
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
From bb6a4713961539a7041d21a7ba85ed8e68108109 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:04:36 -0500
Subject: [PATCH 178/311] Use full game width for item action bar
---
scripts/client/item.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/client/item.js b/scripts/client/item.js
index 30eb6fdb..5f371ee3 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -38,8 +38,8 @@ function processItemActionRendering() {
let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
let backgroundColour = toColour(0, 0, 0, 255);
- graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x / 2) - 1, itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 1], [itemActionDelaySize.x + 2, itemActionDelaySize.y + 2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
- graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x / 2), itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x) - 1, itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 1], [itemActionDelaySize.x + 2, itemActionDelaySize.y + 2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x), itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
}
}
}
From 71d4bec43609a0ce520a18551f0e301c68559d6b Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:04:49 -0500
Subject: [PATCH 179/311] Show more action tips
---
scripts/server/item.js | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/scripts/server/item.js b/scripts/server/item.js
index 33d054f4..b15df96d 100644
--- a/scripts/server/item.js
+++ b/scripts/server/item.js
@@ -1313,6 +1313,8 @@ function playerUseItem(client, hotBarSlot) {
logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
+ markPlayerActionTipSeen(client, "UseItemKeyAfterEquipping");
+
switch (toInteger(itemTypeData.useType)) {
case AGRP_ITEM_USE_TYPE_SKIN: {
getPlayerData(client).itemActionItem = itemIndex;
@@ -1554,6 +1556,12 @@ function playerUseItem(client, hotBarSlot) {
case AGRP_ITEM_USE_TYPE_WALKIETALKIE: {
itemData.enabled = !itemData.enabled;
meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(itemData.enabled))} their walkie-talkie`);
+
+ if (itemData.enabled) {
+ if (!hasPlayerSeenActionTip(client, "RadioCommandAfterEnablingWalkieTalkie")) {
+ messagePlayerInfo(client, getGroupedLocaleString(client, "ActionTips", "RadioCommandAfterEnablingWalkieTalkie", `{ALTCOLOUR}/r{MAINCOLOUR}`));
+ }
+ }
break;
}
@@ -1946,6 +1954,18 @@ function playerSwitchItem(client, newHotBarSlot) {
messagePlayerTip(client, getGroupedLocaleString(client, "VehiclePartItemUsage", getKeyOrCommandForPlayerMessage(client, "use"), getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).name));
}
break;
+
+ case AGRP_ITEM_USE_TYPE_WALKIETALKIE:
+ if (!hasPlayerSeenActionTip(client, "UseItemKeyAfterEquippingWalkieTalkie")) {
+ messagePlayerInfo(client, getGroupedLocaleString(client, "ActionTips", "UseItemKeyAfterEquippingWalkieTalkie", (doesPlayerHaveKeyBindForCommand(client, "use")) ? `{ALTCOLOUR}U{MAINCOLOUR}` : `{ALTCOLOUR}/use{MAINCOLOUR}`));
+ }
+ break;
+
+ default:
+ if (!hasPlayerSeenActionTip(client, "UseItemKeyAfterEquipping")) {
+ messagePlayerInfo(client, getGroupedLocaleString(client, "ActionTips", "UseItemKeyAfterEquipping", (doesPlayerHaveKeyBindForCommand(client, "use")) ? `{ALTCOLOUR}U{MAINCOLOUR}` : `{ALTCOLOUR}/use{MAINCOLOUR}`));
+ }
+ break;
}
getPlayerData(client).activeHotBarSlot = newHotBarSlot;
From c26bcb707628708594d0987bf5cc8b587326fb12 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:05:09 -0500
Subject: [PATCH 180/311] Mark action tip seen when using walkie talkie
---
scripts/server/item/walkie-talkie.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/server/item/walkie-talkie.js b/scripts/server/item/walkie-talkie.js
index 6ea03bdd..551dac88 100644
--- a/scripts/server/item/walkie-talkie.js
+++ b/scripts/server/item/walkie-talkie.js
@@ -131,7 +131,10 @@ function walkieTalkieChatCommand(command, params, client) {
messagePlayerError(client, "Please turn on a walkie talkie first!");
return false;
}
+
walkieTalkieTransmit(getPlayerActiveWalkieTalkieFrequency(client), params, client);
+
+ markPlayerActionTipSeen(client, "RadioCommandAfterEnablingWalkieTalkie");
}
// ===========================================================================
\ No newline at end of file
From 0f4ce5a7fc8e7f55f0bb7aa0fe007b9b503b3298 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:05:16 -0500
Subject: [PATCH 181/311] Use locale string
---
scripts/server/job.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 28984962..01c275ec 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -2367,7 +2367,7 @@ function jobStartRouteCommand(command, params, client) {
function jobStopRouteCommand(command, params, client) {
if (!canPlayerUseJobs(client)) {
- messagePlayerError(client, "You are not allowed to use jobs.");
+ messagePlayerError(client, getLocaleString(client, "NotAllowedToUseJobs"));
return false;
}
From eeaf8aae8e3b39603f14f59a8ec13ecd27ac6f82 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:05:22 -0500
Subject: [PATCH 182/311] Cleanup
---
scripts/server/misc.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 1bbe4791..f4992d4c 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -465,7 +465,7 @@ function showPlayerPrompt(client, promptMessage, promptTitle, yesButtonText, noB
showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText, noButtonText);
} else {
messagePlayerNormal(client, `❓ ${promptMessage} `);
- messagePlayerInfo(client, getLocaleString(client, "PromptResponseTip", `{ ALTCOLOUR } /yes{MAINCOLOUR}`, `{ALTCOLOUR}/no{ MAINCOLOUR } `));
+ messagePlayerInfo(client, getLocaleString(client, "PromptResponseTip", `{ALTCOLOUR}/yes{MAINCOLOUR}`, `{ALTCOLOUR}/no{MAINCOLOUR}`));
}
}
@@ -508,7 +508,7 @@ function listOnlineAdminsCommand(command, params, client) {
if (getPlayerData(clients[i])) {
if (typeof getPlayerData(clients[i]).accountData.flags.admin != "undefined") {
if (getPlayerData(clients[i]).accountData.flags.admin > 0 || getPlayerData(clients[i]).accountData.flags.admin == -1) {
- admins.push(`{ ALTCOLOUR } [${getPlayerData(clients[i]).accountData.staffTitle}] { MAINCOLOUR }${getCharacterFullName(clients[i])} `);
+ admins.push(`{ALTCOLOUR}[${getPlayerData(clients[i]).accountData.staffTitle}]{MAINCOLOUR} ${getCharacterFullName(clients[i])}`);
}
}
}
From eaac0fd1a7e92591dca2bdc4e76fdda18b171617 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:15:51 -0500
Subject: [PATCH 183/311] Fix for player ped anims
---
scripts/server/animation.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index f809e948..ce41a7a4 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -102,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);
From 0b7fb7bbbd70447f2b89f3047aaec60303d24c0c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:16:06 -0500
Subject: [PATCH 184/311] Use disconnect name for client script verification
fail
---
scripts/server/netevents.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/netevents.js b/scripts/server/netevents.js
index e7b51868..c5c884dd 100644
--- a/scripts/server/netevents.js
+++ b/scripts/server/netevents.js
@@ -132,7 +132,7 @@ function playerClientStarted(client) {
function playerClientStopped(client) {
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
- //getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
+ getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
//disconnectPlayer(client);
}
From 427ecf7ea832329880a87399d2aed831ec3548be Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:16:16 -0500
Subject: [PATCH 185/311] Fix player info showing wrong dates
---
scripts/server/misc.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index f4992d4c..51e4270c 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -407,16 +407,16 @@ function getPlayerInfoCommand(command, params, client) {
["Account", `${getPlayerData(targetClient).accountData.name}{mediumGrey}[${getPlayerData(targetClient).accountData.databaseId}]{ALTCOLOUR}`],
["Character", `${getCharacterFullName(targetClient)}{mediumGrey}[${getPlayerCurrentSubAccount(targetClient).databaseId}]{ALTCOLOUR}`],
["Connected", `${getTimeDifferenceDisplay(getCurrentUnixTimestamp(), getPlayerData(targetClient).connectTime)} ago`],
- ["Registered", `${registerDate.toLocaleDateString()} - ${registerDate.toLocaleTimeString()}`],
+ ["Registered", `${registerDate.toLocaleDateString()}`],
["Game Version", `${targetClient.gameVersion}`],
["Script Version", `${scriptVersion}`],
["Client Version", `${getPlayerData(targetClient).clientVersion}`],
["Client Version", `${getPlayerData(targetClient).clientVersion}`],
["Cash", `${getCurrencyString(getPlayerCurrentSubAccount(client).cash)}`],
- ["Skin", `${skinName}{mediumGrey}[${skinModel}]{ALTCOLOUR}`],
+ ["Skin", `${skinName}{mediumGrey}[Model: ${skinModel}/Index: ${skinIndex}]{ALTCOLOUR}`],
["Clan", `${clan}`],
["Job", `${job}`],
- ["Current Date", `${currentDate.toLocaleDateString()} - ${currentDate.toLocaleTimeString()}`],
+ ["Current Date", `${currentDate.toLocaleDateString()}`],
]
let stats = tempStats.map(stat => `{MAINCOLOUR}${stat[0]}: {ALTCOLOUR}${stat[1]} {MAINCOLOUR}`);
@@ -948,4 +948,6 @@ function getPlayerInPropertyData(client) {
}
getPlayerData(client).inProperty = null;
-}
\ No newline at end of file
+}
+
+// ===========================================================================
\ No newline at end of file
From b53542fbf6b9c7bc0f8546c3e3d3bff945bdd74a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:16:22 -0500
Subject: [PATCH 186/311] Update property.js
---
scripts/server/property.js | 1683 ++++++++++++++++++------------------
1 file changed, 850 insertions(+), 833 deletions(-)
diff --git a/scripts/server/property.js b/scripts/server/property.js
index c377b1dd..60fcdc9f 100644
--- a/scripts/server/property.js
+++ b/scripts/server/property.js
@@ -19,7 +19,7 @@ const AGRP_PROP_TYPE_HOUSE = 6; // House
// ===========================================================================
-// Business Location Types
+// Property Location Types
const AGRP_PROP_LOC_NONE = 0; // None
const AGRP_PROP_LOC_GATE = 1; // Moveable gate that belongs to the property
const AGRP_PROP_LOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
@@ -31,7 +31,7 @@ const AGRP_PROP_LOC_PAYPHONE = 7; // Payphone
// ===========================================================================
-// Business Owner Types
+// Property Owner Types
const AGRP_PROP_OWNER_NONE = 0; // Not owned
const AGRP_PROP_OWNER_PLAYER = 1; // Owned by a player (character/subaccount)
const AGRP_PROP_OWNER_JOB = 2; // Owned by a job
@@ -162,7 +162,7 @@ function initPropertyScript() {
function loadPropertyFromId(propertyIndex) {
let dbConnection = connectToDatabase();
if (dbConnection) {
- let dbQueryString = `SELECT * FROM prop_main WHERE prop_id = ${businessId} LIMIT 1;`;
+ let dbQueryString = `SELECT * FROM prop_main WHERE prop_id = ${propertyIndex} LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
if (dbQuery) {
let dbAssoc = fetchQueryAssoc(dbQuery);
@@ -191,7 +191,7 @@ function loadPropertiesFromDatabase() {
if (dbQuery.numRows > 0) {
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempPropertyData = new PropertyData(dbAssoc);
- tempPropertyData.locations = loadBusinessLocationsFromDatabase(tempPropertyData.databaseId);
+ tempPropertyData.locations = loadPropertyLocationsFromDatabase(tempPropertyData.databaseId);
tempProperties.push(tempPropertyData);
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
}
@@ -243,198 +243,198 @@ function createPropertyCommand(command, params, client) {
params,
getPlayerPosition(client),
toVector3(0.0, 0.0, 0.0),
- (isGameFeatureSupported("pickup")) ? getGameConfig().pickupModels[getGame()].Business : -1,
+ (isGameFeatureSupported("pickup")) ? getGameConfig().pickupModels[getGame()].Property : -1,
-1,
getPlayerInterior(client),
getPlayerDimension(client),
- getPlayerData(client).interiorScene);
+ getPlayerData(client).interiorScene
+ );
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: ${getInlinePropertyColour(propertyIndex)}${params}`);
}
// ===========================================================================
-function createBusinessLocationCommand(command, params, client) {
+function createPropertyLocationCommand(command, params, client) {
if (!isPlayerSpawned(client)) {
messagePlayerError(client, "You must be spawned to use this command!");
return false;
}
let locationType = toString(getParam(params, " ", 1));
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- let tempBusinessLocationData = createBusinessLocation(locationType, businessId);
- getServerData().businesses[businessId].push(tempBusinessLocationData);
+ let tempPropertyLocationData = createPropertyLocation(locationType, propertyIndex);
+ getServerData().properties[propertyIndex].push(tempPropertyLocationData);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location ${getInlinePropertyColour(propertyIndex)}${params}{MAINCOLOUR} for business ${getInlinePropertyColour(propertyIndex)}${tempPropertyData.name}`);
}
// ===========================================================================
-/*
-function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1) {
- let tempBusinessData = new BusinessData(false);
- tempBusinessData.name = name;
+function createProperty(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1) {
+ let tempPropertyData = new PropertyData(false);
+ tempPropertyData.name = name;
- tempBusinessData.entrancePosition = entrancePosition;
- tempBusinessData.entranceRotation = 0.0;
- tempBusinessData.entrancePickupModel = entrancePickupModel;
- tempBusinessData.entranceBlipModel = entranceBlipModel;
- tempBusinessData.entranceInterior = entranceInterior;
- tempBusinessData.entranceDimension = entranceDimension;
- tempBusinessData.entranceScene = entranceScene;
+ tempPropertyData.entrancePosition = entrancePosition;
+ tempPropertyData.entranceRotation = 0.0;
+ tempPropertyData.entrancePickupModel = entrancePickupModel;
+ tempPropertyData.entranceBlipModel = entranceBlipModel;
+ tempPropertyData.entranceInterior = entranceInterior;
+ tempPropertyData.entranceDimension = entranceDimension;
+ tempPropertyData.entranceScene = entranceScene;
- tempBusinessData.exitPosition = exitPosition;
- tempBusinessData.exitRotation = 0.0;
- tempBusinessData.exitPickupModel = 0;
- tempBusinessData.exitBlipModel = -1;
- tempBusinessData.exitInterior = 0;
- tempBusinessData.exitDimension = 0;
- tempBusinessData.exitScene = -1;
+ tempPropertyData.exitPosition = exitPosition;
+ tempPropertyData.exitRotation = 0.0;
+ tempPropertyData.exitPickupModel = 0;
+ tempPropertyData.exitBlipModel = -1;
+ tempPropertyData.exitInterior = 0;
+ tempPropertyData.exitDimension = 0;
+ tempPropertyData.exitScene = -1;
- tempBusinessData.needsSaved = true;
- let businessId = getServerData().businesses.push(tempBusinessData);
- setBusinessDataIndexes();
- saveAllBusinessesToDatabase();
+ tempPropertyData.needsSaved = true;
+ let propertyIndex = getServerData().properties.push(tempPropertyData);
+ setPropertyDataIndexes();
+ saveAllPropertyesToDatabase();
- createBusinessPickups(businessId - 1);
- createBusinessBlips(businessId - 1);
+ createPropertyPickups(propertyIndex - 1);
+ createPropertyBlips(propertyIndex - 1);
- return tempBusinessData;
+ return tempPropertyData;
}
// ===========================================================================
-function deleteBusinessCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function deletePropertyCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- deleteBusiness(businessId, getPlayerData(client).accountData.databaseId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`);
+ deleteProperty(propertyIndex, getPlayerData(client).accountData.databaseId);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}`);
}
// ===========================================================================
-function deleteBusinessLocationCommand(command, params, client) {
- //let businessId = toInteger(getParam(params, " ", 2));
- //deleteBusinessLocation(businessId);
- //messagePlayerSuccess(client, `Business '${tempBusinessData.name} deleted!`);
+function deletePropertyLocationCommand(command, params, client) {
+ //let propertyIndex = toInteger(getParam(params, " ", 2));
+ //deletePropertyLocation(propertyIndex);
+ //messagePlayerSuccess(client, `Property '${tempPropertyData.name} deleted!`);
}
// ===========================================================================
-function setBusinessNameCommand(command, params, client) {
- let newBusinessName = toString(params);
+function setPropertyNameCommand(command, params, client) {
+ let newPropertyName = toString(params);
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- let oldBusinessName = getBusinessData(businessId).name;
- 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}`);
+ let oldPropertyName = getPropertyData(propertyIndex).name;
+ getPropertyData(propertyIndex).name = newPropertyName;
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.name", getPropertyData(propertyIndex).name, true);
+ getPropertyData(propertyIndex).needsSaved = true;
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed property ${getInlinePropertyColour(propertyIndex)}${oldPropertyName}{MAINCOLOUR} to ${getInlinePropertyColour(propertyIndex)}${newPropertyName}`);
}
// ===========================================================================
-function setBusinessOwnerCommand(command, params, client) {
+function setPropertyOwnerCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- let newBusinessOwner = getPlayerFromParams(params);
- let businessId = getPlayerBusiness(client);
+ let newPropertyOwner = getPlayerFromParams(params);
+ let propertyIndex = getPlayerProperty(client);
- if (!newBusinessOwner) {
+ if (!newPropertyOwner) {
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
return false;
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_PLAYER;
- getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).ownerType = AGRP_BIZ_OWNER_PLAYER;
+ getPropertyData(propertyIndex).ownerId = getPlayerCurrentSubAccount(newPropertyOwner).databaseId;
+ getPropertyData(propertyIndex).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to {ALTCOLOUR}${getCharacterFullName(newBusinessOwner)}`);
+ messagePlayerSuccess(client, `{MAINCOLOUR}You gave property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} to {ALTCOLOUR}${getCharacterFullName(newPropertyOwner)}`);
}
// ===========================================================================
-function setBusinessJobCommand(command, params, client) {
+function setPropertyJobCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let jobId = getJobFromParams(params);
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
if (!getJobData(jobId)) {
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
return false;
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_JOB;
- getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).ownerType = AGRP_BIZ_OWNER_JOB;
+ getPropertyData(propertyIndex).ownerId = getJobData(jobId).databaseId;
+ getPropertyData(propertyIndex).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 ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name} {MAINCOLOUR}to the {jobYellow}${getJobData(jobId).name}`);
}
// ===========================================================================
-function setBusinessClanCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function setPropertyClanCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(getLocaleString(client, "InvalidProperty"));
return false;
}
@@ -445,70 +445,70 @@ function setBusinessClanCommand(command, params, client) {
return false;
}
- if (getBusinessData(business).ownerType != AGRP_VEHOWNER_PLAYER) {
- messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
+ if (getPropertyData(business).ownerType != AGRP_VEHOWNER_PLAYER) {
+ messagePlayerError(client, getLocaleString(client, "MustOwnProperty"));
return false;
}
- if (getBusinessData(business).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
- messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
+ if (getPropertyData(business).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
+ messagePlayerError(client, getLocaleString(client, "MustOwnProperty"));
return false;
}
- showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ showPlayerPrompt(client, getLocaleString(client, "SetPropertyClanConfirmMessage"), getLocaleString(client, "SetPropertyClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = AGRP_PROMPT_BIZGIVETOCLAN;
- //getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_CLAN;
- //getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
- //getBusinessData(businessId).needsSaved = true;
+ //getPropertyData(propertyIndex).ownerType = AGRP_BIZ_OWNER_CLAN;
+ //getPropertyData(propertyIndex).ownerId = getClanData(clanId).databaseId;
+ //getPropertyData(propertyIndex).needsSaved = true;
}
// ===========================================================================
-function setBusinessRankCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function setPropertyRankCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(getLocaleString(client, "InvalidProperty"));
return false;
}
let rankId = params;
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_CLAN) {
- let clanId = getClanIndexFromDatabaseId(getBusinessData(businessId).ownerId);
+ let clanId = getClanIndexFromDatabaseId(getPropertyData(propertyIndex).ownerId);
rankId = getClanRankFromParams(clanId, params);
if (!getClanRankData(clanId, rankId)) {
messagePlayerError(client, getLocaleString(client, "InvalidClanRank"));
return false;
}
- getBusinessData(businessId).rank = getClanRankData(clanId, rankId).databaseId;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${getClanRankData(clanId, rankId).name} {MAINCOLOUR}of the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`);
- } else if (getBusinessData(businessId).ownerType == AGRP_VEHOWNER_JOB) {
- getBusinessData(businessId).rank = rankId;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${rankId} {MAINCOLOUR}of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getBusinessData(businessId).ownerId)).name} {MAINCOLOUR}job!`);
+ getPropertyData(propertyIndex).rank = getClanRankData(clanId, rankId).databaseId;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name} {MAINCOLOUR}rank to {ALTCOLOUR}${getClanRankData(clanId, rankId).name} {MAINCOLOUR}of the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`);
+ } else if (getPropertyData(propertyIndex).ownerType == AGRP_VEHOWNER_JOB) {
+ getPropertyData(propertyIndex).rank = rankId;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name} {MAINCOLOUR}rank to {ALTCOLOUR}${rankId} {MAINCOLOUR}of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getPropertyData(propertyIndex).ownerId)).name} {MAINCOLOUR}job!`);
}
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).needsSaved = true;
}
// ===========================================================================
-function setBusinessRankCommand(command, params, client) {
+function setPropertyRankCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(getLocaleString(client, "InvalidProperty"));
return false;
}
@@ -526,8 +526,8 @@ function setBusinessRankCommand(command, params, client) {
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
@@ -536,19 +536,19 @@ function setBusinessRankCommand(command, params, client) {
return false;
}
- getBusinessData(businessId).clanRank = getClanRankData(clanId, clanRankId).level;
+ getPropertyData(propertyIndex).clanRank = getClanRankData(clanId, clanRankId).level;
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}'s clan rank to {clanOrange}${getClanRankData(clanId, clanRankId).name} {MAINCOLOUR}(level ${getClanRankData(clanId, clanRankId).level}) and above!`);
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR}'s clan rank to {clanOrange}${getClanRankData(clanId, clanRankId).name} {MAINCOLOUR}(level ${getClanRankData(clanId, clanRankId).level}) and above!`);
}
// ===========================================================================
-function setBusinessJobCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function setPropertyJobCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
let closestJobLocation = getClosestJobLocation(getVehiclePosition(vehicle));
@@ -558,8 +558,8 @@ function setBusinessJobCommand(command, params, client) {
jobId = getJobIdFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
@@ -568,146 +568,146 @@ function setBusinessJobCommand(command, params, client) {
return false;
}
- getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_JOB;
- getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
+ getPropertyData(propertyIndex).ownerType = AGRP_BIZ_OWNER_JOB;
+ getPropertyData(propertyIndex).ownerId = getJobData(jobId).databaseId;
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
}
// ===========================================================================
-function setBusinessPublicCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function setPropertyPublicCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_PUBLIC;
- getBusinessData(businessId).ownerId = 0;
+ getPropertyData(propertyIndex).ownerType = AGRP_BIZ_OWNER_PUBLIC;
+ getPropertyData(propertyIndex).ownerId = 0;
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
}
// ===========================================================================
-function removeBusinessOwnerCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function removePropertyOwnerCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_NONE;
- getBusinessData(businessId).ownerId = -1;
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).ownerType = AGRP_BIZ_OWNER_NONE;
+ getPropertyData(propertyIndex).ownerId = -1;
+ getPropertyData(propertyIndex).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} owner`);
+ messagePlayerSuccess(client, `{MAINCOLOUR}You removed property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}'s{MAINCOLOUR} owner`);
}
// ===========================================================================
-function toggleBusinessInteriorLightsCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function togglePropertyInteriorLightsCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, "You can't change the interior lights for this business!");
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, "You can't change the interior lights for this property!");
return false;
}
- getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
- updateBusinessInteriorLightsForOccupants(businessId);
+ getPropertyData(propertyIndex).interiorLights = !getPropertyData(propertyIndex).interiorLights;
+ updatePropertyInteriorLightsForOccupants(propertyIndex);
- getBusinessData(businessId).needsSaved = true;
- meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
+ getPropertyData(propertyIndex).needsSaved = true;
+ meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getPropertyData(propertyIndex).interiorLights))} the property lights`);
}
// ===========================================================================
-function setBusinessEntranceFeeCommand(command, params, client) {
+function setPropertyEntranceFeeCommand(command, params, client) {
let entranceFee = toInteger(getParam(params, " ", 1)) || 0;
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- getBusinessData(businessId).entranceFee = entranceFee;
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
+ getPropertyData(propertyIndex).entranceFee = entranceFee;
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
}
// ===========================================================================
-function setBusinessPaintBallCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function setPropertyPaintBallCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- getBusinessData(businessId).type = AGRP_BIZ_TYPE_PAINTBALL;
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
+ getPropertyData(propertyIndex).type = AGRP_BIZ_TYPE_PAINTBALL;
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, getLocaleString(client, "PropertyIsNowPaintBall"));
}
// ===========================================================================
-function getBusinessInfoCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function getPropertyInfoCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- let businessData = getBusinessData(businessId);
+ let propertyData = getPropertyData(propertyIndex);
let ownerName = "Unknown";
- switch (businessData.ownerType) {
+ switch (propertyData.ownerType) {
case AGRP_BIZ_OWNER_CLAN:
- ownerName = getClanData(businessData.ownerId).name;
+ ownerName = getClanData(propertyData.ownerId).name;
break;
case AGRP_BIZ_OWNER_JOB:
- ownerName = getJobData(businessData.ownerId).name;
+ ownerName = getJobData(propertyData.ownerId).name;
break;
case AGRP_BIZ_OWNER_PLAYER:
- let subAccountData = loadSubAccountFromId(businessData.ownerId);
+ let subAccountData = loadSubAccountFromId(propertyData.ownerId);
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
break;
@@ -716,92 +716,92 @@ function getBusinessInfoCommand(command, params, client) {
break;
case AGRP_BIZ_OWNER_NONE:
- //submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType for business ${businessId}/${getBusinessData(businessId).databaseId}`);
+ //submitBugReport(client, `[AUTOMATED REPORT] getPropertyInfoCommand() - Invalid ownerType for business ${propertyIndex}/${getPropertyData(propertyIndex).databaseId}`);
ownerName = "None";
break;
default:
- submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType ${businessData.ownerType} for business ${businessId}/${getBusinessData(businessId).databaseId}`);
+ submitBugReport(client, `[AUTOMATED REPORT] getPropertyInfoCommand() - Invalid ownerType ${propertyData.ownerType} for property ${propertyIndex}/${getPropertyData(propertyIndex).databaseId}`);
ownerName = "None";
break;
}
let tempStats = [
- [`Name`, `${businessData.name}`],
- [`ID`, `${businessData.index}/${businessData.databaseId}`],
- [`Owner`, `${ownerName} (${getBusinessOwnerTypeText(businessData.ownerType)})`],
- [`Locked`, `${getLockedUnlockedFromBool(businessData.locked)}`],
- [`BuyPrice`, `${getCurrencyString(businessData.buyPrice)}`],
- //[`RentPrice`, `${businessData.rentPrice}`],
- [`HasInterior`, `${getYesNoFromBool(businessData.hasInterior)}`],
- [`CustomInterior`, `${getYesNoFromBool(businessData.customInterior)}`],
- [`HasBuyableItems`, `${getYesNoFromBool(doesBusinessHaveAnyItemsToBuy(businessId))}`],
- [`EntranceFee`, `${getCurrencyString(businessData.entranceFee)}`],
- [`InteriorLights`, `${getOnOffFromBool(businessData.interiorLights)}`],
- [`Balance`, `${getCurrencyString(businessData.till)}`],
- [`RadioStation`, `${businessData.streamingRadioStation}`],
- [`LabelHelpType`, `${businessData.labelHelpType}`],
+ [`Name`, `${propertyData.name}`],
+ [`ID`, `${propertyData.index}/${propertyData.databaseId}`],
+ [`Owner`, `${ownerName} (${getPropertyOwnerTypeText(propertyData.ownerType)})`],
+ [`Locked`, `${getLockedUnlockedFromBool(propertyData.locked)}`],
+ [`BuyPrice`, `${getCurrencyString(propertyData.buyPrice)}`],
+ //[`RentPrice`, `${propertyData.rentPrice}`],
+ [`HasInterior`, `${getYesNoFromBool(propertyData.hasInterior)}`],
+ [`CustomInterior`, `${getYesNoFromBool(propertyData.customInterior)}`],
+ [`HasBuyableItems`, `${getYesNoFromBool(doesPropertyHaveAnyItemsToBuy(propertyIndex))}`],
+ [`EntranceFee`, `${getCurrencyString(propertyData.entranceFee)}`],
+ [`InteriorLights`, `${getOnOffFromBool(propertyData.interiorLights)}`],
+ [`Balance`, `${getCurrencyString(propertyData.till)}`],
+ [`RadioStation`, `${propertyData.streamingRadioStation}`],
+ [`LabelHelpType`, `${propertyData.labelHelpType}`],
];
let stats = tempStats.map(stat => `{MAINCOLOUR}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
- messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessInfo", businessData.name)));
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderPropertyInfo", propertyData.name)));
let chunkedList = splitArrayIntoChunks(stats, 6);
for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
- //messagePlayerInfo(client, `🏢 {businessBlue}[Business Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getBusinessData(businessId).name}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${businessId}/${getBusinessData(businessId).databaseId}`);
+ //messagePlayerInfo(client, `🏢 ${getInlinePropertyColour(propertyIndex)}[Property Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getPropertyData(propertyIndex).name}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getPropertyOwnerTypeText(getPropertyData(propertyIndex).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getPropertyData(propertyIndex).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${propertyIndex}/${getPropertyData(propertyIndex).databaseId}`);
}
// ===========================================================================
-function getBusinessFloorItemsCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function getPropertyFloorItemsCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- showBusinessFloorInventoryToPlayer(client, businessId);
+ showPropertyFloorInventoryToPlayer(client, propertyIndex);
}
// ===========================================================================
-function getBusinessStorageItemsCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function getPropertyStorageItemsCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- showBusinessStorageInventoryToPlayer(client, businessId);
+ showPropertyStorageInventoryToPlayer(client, propertyIndex);
}
// ===========================================================================
-function setBusinessPickupCommand(command, params, client) {
+function setPropertyPickupCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
@@ -818,26 +818,26 @@ function setBusinessPickupCommand(command, params, client) {
return false;
}
- getBusinessData(businessId).entrancePickupModel = getGameConfig().pickupModels[getGame()][typeParam];
+ getPropertyData(propertyIndex).entrancePickupModel = getGameConfig().pickupModels[getGame()][typeParam];
} else {
- getBusinessData(businessId).entrancePickupModel = toInteger(typeParam);
+ getPropertyData(propertyIndex).entrancePickupModel = toInteger(typeParam);
}
- resetBusinessPickups(businessId);
+ resetPropertyPickups(propertyIndex);
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).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 property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} pickup display to {ALTCOLOUR}${typeParam}!`);
}
// ===========================================================================
-function setBusinessInteriorTypeCommand(command, params, client) {
+function setPropertyInteriorTypeCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
@@ -848,15 +848,15 @@ function setBusinessInteriorTypeCommand(command, params, client) {
if (isNaN(typeParam)) {
if (toLowerCase(typeParam) == "None") {
- getBusinessData(businessId).exitPosition = toVector3(0.0, 0.0, 0.0);
- getBusinessData(businessId).exitDimension = 0;
- getBusinessData(businessId).exitInterior = -1;
- getBusinessData(businessId).hasInterior = false;
- 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`);
+ getPropertyData(propertyIndex).exitPosition = toVector3(0.0, 0.0, 0.0);
+ getPropertyData(propertyIndex).exitDimension = 0;
+ getPropertyData(propertyIndex).exitInterior = -1;
+ getPropertyData(propertyIndex).hasInterior = false;
+ getPropertyData(propertyIndex).entranceScene = "";
+ getPropertyData(propertyIndex).exitScene = "";
+ getPropertyData(propertyIndex).exitPickupModel = -1;
+ getPropertyData(propertyIndex).customInterior = false;
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} interior`);
return false;
}
@@ -872,42 +872,42 @@ function setBusinessInteriorTypeCommand(command, params, client) {
return false;
}
- 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).hasInterior = true;
- getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
+ getPropertyData(propertyIndex).exitPosition = getGameConfig().interiors[getGame()][typeParam][0];
+ getPropertyData(propertyIndex).exitInterior = getGameConfig().interiors[getGame()][typeParam][1];
+ getPropertyData(propertyIndex).exitDimension = getPropertyData(propertyIndex).databaseId + getGlobalConfig().propertyDimensionStart;
+ getPropertyData(propertyIndex).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
+ getPropertyData(propertyIndex).hasInterior = true;
+ getPropertyData(propertyIndex).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
if (isGameFeatureSupported("interiorScene")) {
if (isMainWorldScene(getPlayerData(client).scene)) {
- getBusinessData(businessId).exitScene = getGameConfig().mainWorldScene[getGame()];
+ getPropertyData(propertyIndex).exitScene = getGameConfig().mainWorldScene[getGame()];
} else {
- getBusinessData(businessId).exitScene = getGameConfig().interiors[getGame()][typeParam][3];
+ getPropertyData(propertyIndex).exitScene = getGameConfig().interiors[getGame()][typeParam][3];
}
}
}
- //deleteBusinessExitPickup(businessId);
- //deleteBusinessExitBlip(businessId);
- //createBusinessExitBlip(businessId);
- //createBusinessExitPickup(businessId);
+ //deletePropertyExitPickup(propertyIndex);
+ //deletePropertyExitBlip(propertyIndex);
+ //createPropertyExitBlip(propertyIndex);
+ //createPropertyExitPickup(propertyIndex);
- resetBusinessPickups(businessId);
+ resetPropertyPickups(propertyIndex);
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).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 property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
}
// ===========================================================================
-function addBusinessPropertyTemplateEntities(command, params, client) {
+function addPropertyPropertyTemplateEntities(command, params, client) {
let propertyTemplateParam = getParam(params, " ", 1) || "business";
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
@@ -929,41 +929,41 @@ function addBusinessPropertyTemplateEntities(command, params, client) {
return false;
}
- 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).hasInterior = true;
- getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
- getBusinessData(businessId).interiorScene = getGameConfig().interiors[getGame()][typeParam][3];
+ getPropertyData(propertyIndex).exitPosition = getGameConfig().interiors[getGame()][typeParam][0];
+ getPropertyData(propertyIndex).exitInterior = getGameConfig().interiors[getGame()][typeParam][1];
+ getPropertyData(propertyIndex).exitDimension = getPropertyData(propertyIndex).databaseId + getGlobalConfig().businessDimensionStart;
+ getPropertyData(propertyIndex).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
+ getPropertyData(propertyIndex).hasInterior = true;
+ getPropertyData(propertyIndex).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
+ getPropertyData(propertyIndex).interiorScene = getGameConfig().interiors[getGame()][typeParam][3];
}
- //deleteBusinessExitPickup(businessId);
- //deleteBusinessExitBlip(businessId);
- //createBusinessExitBlip(businessId);
- //createBusinessExitPickup(businessId);
+ //deletePropertyExitPickup(propertyIndex);
+ //deletePropertyExitBlip(propertyIndex);
+ //createPropertyExitBlip(propertyIndex);
+ //createPropertyExitPickup(propertyIndex);
- resetBusinessPickups(businessId);
+ resetPropertyPickups(propertyIndex);
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).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 property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`);
}
// ===========================================================================
-function setBusinessBlipCommand(command, params, client) {
+function setPropertyBlipCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
if (isNaN(typeParam)) {
if (isNull(getGameConfig().blipSprites[getGame()][typeParam])) {
- messagePlayerError(client, "Invalid business type! Use a business type name or a blip image ID");
+ messagePlayerError(client, "Invalid property type! Use a property type name or a blip image ID");
let blipTypes = Object.keys(getGameConfig().blipSprites[getGame()]);
let chunkedList = splitArrayIntoChunks(blipTypes, 10);
@@ -975,167 +975,167 @@ function setBusinessBlipCommand(command, params, client) {
return false;
}
- getBusinessData(businessId).entranceBlipModel = getGameConfig().blipSprites[getGame()][typeParam];
+ getPropertyData(propertyIndex).entranceBlipModel = getGameConfig().blipSprites[getGame()][typeParam];
} else {
- getBusinessData(businessId).entranceBlipModel = toInteger(typeParam);
+ getPropertyData(propertyIndex).entranceBlipModel = toInteger(typeParam);
}
- resetBusinessBlips(businessId);
- getBusinessData(businessId).needsSaved = true;
+ resetPropertyBlips(propertyIndex);
+ getPropertyData(propertyIndex).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 ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`);
}
// ===========================================================================
-function giveDefaultItemsToBusinessCommand(command, params, client) {
+function giveDefaultItemsToPropertyCommand(command, params, client) {
let typeParam = getParam(params, " ", 1) || "business";
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
if (!isNaN(typeParam)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (isNull(getGameConfig().defaultBusinessItems[getGame()][typeParam])) {
- messagePlayerError(client, "Invalid business items type! Use a business items type name");
- let businessItemTypes = Object.keys(getGameConfig().defaultBusinessItems[getGame()]);
+ if (isNull(getGameConfig().defaultPropertyItems[getGame()][typeParam])) {
+ messagePlayerError(client, "Invalid property items type! Use a property items type name");
+ let businessItemTypes = Object.keys(getGameConfig().defaultPropertyItems[getGame()]);
let chunkedList = splitArrayIntoChunks(businessItemTypes, 10);
- messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDefaultBusinessItemTypes")));
+ messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDefaultPropertyItemTypes")));
for (let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
return false;
}
- for (let i in getGameConfig().defaultBusinessItems[getGame()][typeParam]) {
- let itemTypeId = getItemTypeFromParams(getGameConfig().defaultBusinessItems[getGame()][typeParam][i][0]);
+ for (let i in getGameConfig().defaultPropertyItems[getGame()][typeParam]) {
+ let itemTypeId = getItemTypeFromParams(getGameConfig().defaultPropertyItems[getGame()][typeParam][i][0]);
let itemTypeData = getItemTypeData(itemTypeId);
if (itemTypeData) {
- let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, AGRP_ITEM_OWNER_BIZFLOOR, getBusinessData(businessId).databaseId, getGameConfig().defaultBusinessItems[getGame()][typeParam][i][1]);
- getItemData(newItemIndex).buyPrice = applyServerInflationMultiplier(itemTypeData.orderPrice) * getGameConfig().defaultBusinessItems[getGame()][typeParam][i][2];
+ let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, AGRP_ITEM_OWNER_BIZFLOOR, getPropertyData(propertyIndex).databaseId, getGameConfig().defaultPropertyItems[getGame()][typeParam][i][1]);
+ getItemData(newItemIndex).buyPrice = applyServerInflationMultiplier(itemTypeData.orderPrice) * getGameConfig().defaultPropertyItems[getGame()][typeParam][i][2];
}
}
- cacheBusinessItems(businessId);
- updateBusinessPickupLabelData(businessId);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`);
+ cachePropertyItems(propertyIndex);
+ updatePropertyPickupLabelData(propertyIndex);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`);
}
// ===========================================================================
-function setBusinessDealershipCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function setPropertyDealershipCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- 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`);
+ getPropertyData(propertyIndex).labelHelpType == AGRP_PROPLABEL_INFO_ENTERVEHICLE;
+ getPropertyData(propertyIndex).type = AGRP_BIZ_TYPE_DEALERSHIP;
+ updatePropertyPickupLabelData(propertyIndex);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the property type of ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} to dealership`);
}
// ===========================================================================
-function deleteBusinessFloorItemsCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function deletePropertyFloorItemsCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- let tempCache = getBusinessData(businessId).floorItemCache;
+ let tempCache = getPropertyData(propertyIndex).floorItemCache;
for (let i in tempCache) {
deleteItem(tempCache[i]);
}
- cacheBusinessItems(businessId);
+ cachePropertyItems(propertyIndex);
- 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 property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}`);
}
// ===========================================================================
-function deleteBusinessStorageItemsCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function deletePropertyStorageItemsCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- let tempCache = getBusinessData(businessId).storageItemCache;
+ let tempCache = getPropertyData(propertyIndex).storageItemCache;
for (let i in tempCache) {
deleteItem(tempCache[i]);
}
- cacheBusinessItems(businessId);
+ cachePropertyItems(propertyIndex);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}`);
}
// ===========================================================================
-function withdrawFromBusinessCommand(command, params, client) {
+function withdrawFromPropertyCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let amount = toInteger(getParam(params, " ", 1)) || 0;
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- if (getBusinessData(businessId).till < amount) {
- messagePlayerError(client, `Business {businessBlue}${tempBusinessData.name} doesn't have that much money! Use /bizbalance.`);
+ if (getPropertyData(propertyIndex).till < amount) {
+ messagePlayerError(client, `Property ${getInlinePropertyColour(propertyIndex)}${tempPropertyData.name} doesn't have that much money! Use /bizbalance.`);
return false;
}
- getBusinessData(businessId).till -= amount;
+ getPropertyData(propertyIndex).till -= amount;
givePlayerCash(client, amount);
updatePlayerCash(client);
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).needsSaved = true;
- messagePlayerSuccess(client, `You withdrew ${getCurrencyString(amount)} from business {businessBlue}${getBusinessData(businessId).name} till`);
+ messagePlayerSuccess(client, `You withdrew ${getCurrencyString(amount)} from property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name} till`);
}
// ===========================================================================
-function setBusinessBuyPriceCommand(command, params, client) {
+function setPropertyBuyPriceCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let amount = toInteger(getParam(params, " ", 1)) || 0;
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
@@ -1144,32 +1144,32 @@ function setBusinessBuyPriceCommand(command, params, client) {
return false;
}
- getBusinessData(businessId).buyPrice = amount;
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
+ getPropertyData(propertyIndex).buyPrice = amount;
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.price", getPropertyData(propertyIndex).buyPrice, true);
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, `{MAINCOLOUR}You set property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
}
// ===========================================================================
-function depositIntoBusinessCommand(command, params, client) {
+function depositIntoPropertyCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let amount = toInteger(getParam(params, " ", 1)) || 0;
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
// Let anybody deposit money
- //if(!canPlayerManageBusiness(client, businessId)) {
- // messagePlayerError(client, "You can't deposit cash into this business!");
+ //if(!canPlayerManageProperty(client, propertyIndex)) {
+ // messagePlayerError(client, "You can't deposit cash into this property!");
// return false;
//}
@@ -1178,17 +1178,17 @@ function depositIntoBusinessCommand(command, params, client) {
return false;
}
- getBusinessData(businessId).till += amount;
+ getPropertyData(propertyIndex).till += amount;
takePlayerCash(client, amount);
updatePlayerCash(client);
- getBusinessData(businessId).needsSaved = true;
- messagePlayerSuccess(client, `You deposited ${getCurrencyString(amount)} into business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till`);
+ getPropertyData(propertyIndex).needsSaved = true;
+ messagePlayerSuccess(client, `You deposited ${getCurrencyString(amount)} into property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} till`);
}
// ===========================================================================
-function orderItemForBusinessCommand(command, params, client) {
+function orderItemForPropertyCommand(command, params, client) {
if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
@@ -1211,17 +1211,17 @@ function orderItemForBusinessCommand(command, params, client) {
let amount = toInteger(splitParams.slice(-2, -1)) || 1;
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
- let businessId = getPlayerBusiness(client);
+ let propertyIndex = getPlayerProperty(client);
logToConsole(LOG_DEBUG, `[AGRP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
@@ -1229,157 +1229,157 @@ function orderItemForBusinessCommand(command, params, client) {
//getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
getPlayerData(client).businessOrderAmount = amount;
- getPlayerData(client).businessOrderBusiness = businessId;
+ getPlayerData(client).businessOrderProperty = propertyIndex;
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 ${getCurrencyString(pricePerItem)} each will cost a total of ${getCurrencyString(orderTotalCost)}`, "Business Order Cost");
+ getPropertyData(propertyIndex).needsSaved = true;
+ showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at ${getCurrencyString(pricePerItem)} each will cost a total of ${getCurrencyString(orderTotalCost)}`, "Property Order Cost");
getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
}
// ===========================================================================
-function orderItemForBusiness(businessId, itemType, amount) {
- if (getBusinessData(businessId).till < orderTotalCost) {
- let neededAmount = orderTotalCost - getBusinessData(businessId).till;
+function orderItemForProperty(propertyIndex, itemType, amount) {
+ if (getPropertyData(propertyIndex).till < orderTotalCost) {
+ let neededAmount = orderTotalCost - getPropertyData(propertyIndex).till;
//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 ${getCurrencyString(getItemTypeData(itemType).orderPrice)} each for business {businessBlue}${getBusinessData(businessId).name}`);
+ getPropertyData(propertyIndex).till -= orderTotalCost;
+ addToPropertyInventory(propertyIndex, itemType, amount);
+ //messagePlayerSuccess(client, `You ordered ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at ${getCurrencyString(getItemTypeData(itemType).orderPrice)} each for business ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}`);
}
// ===========================================================================
-function viewBusinessTillAmountCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function viewPropertyTillAmountCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (!canPlayerManageBusiness(client, businessId)) {
- messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
+ if (!canPlayerManageProperty(client, propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "CantModifyProperty"));
return false;
}
- messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} till has {ALTCOLOUR}${getCurrencyString(getBusinessData(businessId).till)}`);
+ messagePlayerSuccess(client, `Property ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} till has {ALTCOLOUR}${getCurrencyString(getPropertyData(propertyIndex).till)}`);
}
// ===========================================================================
-function buyBusinessCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function buyPropertyCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (getBusinessData(businessId).buyPrice <= 0) {
- messagePlayerError(client, getLocaleString(client, "BusinessNotForSale"));
+ if (getPropertyData(propertyIndex).buyPrice <= 0) {
+ messagePlayerError(client, getLocaleString(client, "PropertyNotForSale"));
return false;
}
- if (getPlayerCurrentSubAccount(client).cash < getBusinessData(businessId).buyPrice) {
- messagePlayerError(client, getLocaleString(client, "BusinessPurchaseNotEnoughMoney"));
+ if (getPlayerCurrentSubAccount(client).cash < getPropertyData(propertyIndex).buyPrice) {
+ messagePlayerError(client, getLocaleString(client, "PropertyPurchaseNotEnoughMoney"));
return false;
}
- showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
+ showPlayerPrompt(client, getLocaleString(client, "BuyPropertyConfirmMessage"), getLocaleString(client, "BuyPropertyConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = AGRP_PROMPT_BIZBUY;
}
// ===========================================================================
-function moveBusinessEntranceCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function movePropertyEntranceCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- getBusinessData(businessId).entrancePosition = getPlayerPosition(client);
- getBusinessData(businessId).entranceDimension = getPlayerDimension(client);
- getBusinessData(businessId).entranceInterior = getPlayerInterior(client);
+ getPropertyData(propertyIndex).entrancePosition = getPlayerPosition(client);
+ getPropertyData(propertyIndex).entranceDimension = getPlayerDimension(client);
+ getPropertyData(propertyIndex).entranceInterior = getPlayerInterior(client);
- //deleteBusinessEntranceBlip(businessId);
- //deleteBusinessEntrancePickup(businessId);
- //createBusinessEntranceBlip(businessId);
- //createBusinessEntrancePickup(businessId);
+ //deletePropertyEntranceBlip(propertyIndex);
+ //deletePropertyEntrancePickup(propertyIndex);
+ //createPropertyEntranceBlip(propertyIndex);
+ //createPropertyEntrancePickup(propertyIndex);
- resetBusinessPickups(businessId);
- resetBusinessBlips(businessId);
+ resetPropertyPickups(propertyIndex);
+ resetPropertyBlips(propertyIndex);
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).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 ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR} entrance to their position`);
}
// ===========================================================================
-function moveBusinessExitCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function movePropertyExitCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (!areParamsEmpty(params)) {
- businessId = getBusinessFromParams(params);
+ propertyIndex = getPropertyFromParams(params);
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- getBusinessData(businessId).exitPosition = getPlayerPosition(client);
- getBusinessData(businessId).exitDimension = getPlayerDimension(client);
- getBusinessData(businessId).exitInterior = getPlayerInterior(client);
+ getPropertyData(propertyIndex).exitPosition = getPlayerPosition(client);
+ getPropertyData(propertyIndex).exitDimension = getPlayerDimension(client);
+ getPropertyData(propertyIndex).exitInterior = getPlayerInterior(client);
- deleteBusinessExitBlip(businessId);
- deleteBusinessExitPickup(businessId);
+ deletePropertyExitBlip(propertyIndex);
+ deletePropertyExitPickup(propertyIndex);
- createBusinessExitBlip(businessId);
- createBusinessExitPickup(businessId);
+ createPropertyExitBlip(propertyIndex);
+ createPropertyExitPickup(propertyIndex);
- getBusinessData(businessId).needsSaved = true;
+ getPropertyData(propertyIndex).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 ${getInlinePropertyColour(propertyIndex)}${getPropertyData(propertyIndex).name}{MAINCOLOUR}exit to their position`);
}
// ===========================================================================
-function getBusinessDataFromDatabaseId(databaseId) {
+function getPropertyDataFromDatabaseId(databaseId) {
if (databaseId <= 0) {
return false;
}
- let matchingBusinesses = getServerData().businesses.filter(b => b.databaseId == databaseId)
- if (matchingBusinesses.length == 1) {
- return matchingBusinesses[0];
+ let matchingPropertyes = getServerData().properties.filter(b => b.databaseId == databaseId)
+ if (matchingPropertyes.length == 1) {
+ return matchingPropertyes[0];
}
return false;
}
// ===========================================================================
-function getClosestBusinessEntrance(position, dimension) {
+function getClosestPropertyEntrance(position, dimension) {
let closest = 0;
- for (let i in getServerData().businesses) {
- if (getServerData().businesses[i].entranceDimension == dimension) {
- if (getDistance(position, getServerData().businesses[i].entrancePosition) <= getDistance(position, getServerData().businesses[closest].entrancePosition)) {
+ for (let i in getServerData().properties) {
+ if (getServerData().properties[i].entranceDimension == dimension) {
+ if (getDistance(position, getServerData().properties[i].entrancePosition) <= getDistance(position, getServerData().properties[closest].entrancePosition)) {
closest = i;
}
}
@@ -1389,11 +1389,11 @@ function getClosestBusinessEntrance(position, dimension) {
// ===========================================================================
-function getClosestBusinessExit(position, dimension) {
+function getClosestPropertyExit(position, dimension) {
let closest = 0;
- for (let i in getServerData().businesses) {
- if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == dimension) {
- if (getDistance(position, getServerData().businesses[i].exitPosition) <= getDistance(position, getServerData().businesses[closest].exitPosition)) {
+ for (let i in getServerData().properties) {
+ if (getServerData().properties[i].hasInterior && getServerData().properties[i].exitDimension == dimension) {
+ if (getDistance(position, getServerData().properties[i].exitPosition) <= getDistance(position, getServerData().properties[closest].exitPosition)) {
closest = i;
}
}
@@ -1403,9 +1403,9 @@ function getClosestBusinessExit(position, dimension) {
// ===========================================================================
-function isPlayerInAnyBusiness(client) {
- for (let i in getServerData().businesses) {
- if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
+function isPlayerInAnyProperty(client) {
+ for (let i in getServerData().properties) {
+ if (getServerData().properties[i].hasInterior && getServerData().properties[i].exitDimension == getPlayerDimension(client)) {
return i;
}
}
@@ -1415,24 +1415,24 @@ function isPlayerInAnyBusiness(client) {
// ===========================================================================
-function getPlayerBusiness(client) {
- if (getServerData().businesses.length == 0) {
+function getPlayerProperty(client) {
+ if (getServerData().properties.length == 0) {
return -1;
}
if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()]) {
- let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
- if (getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
- return getBusinessData(closestEntrance).index;
+ let closestEntrance = getClosestPropertyEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getPlayerPosition(client), getPropertyData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
+ return getPropertyData(closestEntrance).index;
}
} else {
- let closestEntrance = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
- if (getDistance(getPlayerPosition(client), getBusinessData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
- return getBusinessData(closestEntrance).index;
+ let closestEntrance = getClosestPropertyEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getPlayerPosition(client), getPropertyData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
+ return getPropertyData(closestEntrance).index;
}
- for (let i in getServerData().businesses) {
- if (getServerData().businesses[i].hasInterior && getServerData().businesses[i].exitDimension == getPlayerDimension(client)) {
+ for (let i in getServerData().properties) {
+ if (getServerData().properties[i].hasInterior && getServerData().properties[i].exitDimension == getPlayerDimension(client)) {
return i;
}
}
@@ -1442,14 +1442,14 @@ function getPlayerBusiness(client) {
// ===========================================================================
-function saveAllBusinessesToDatabase() {
+function saveAllPropertyesToDatabase() {
if (getServerConfig().devServer) {
return false;
}
- for (let i in getServerData().businesses) {
- if (getServerData().businesses[i].needsSaved) {
- saveBusinessToDatabase(i);
+ for (let i in getServerData().properties) {
+ if (getServerData().properties[i].needsSaved) {
+ savePropertyToDatabase(i);
}
}
@@ -1458,85 +1458,85 @@ function saveAllBusinessesToDatabase() {
// ===========================================================================
-function saveBusinessToDatabase(businessId) {
- let tempBusinessData = getServerData().businesses[businessId];
+function savePropertyToDatabase(propertyIndex) {
+ let tempPropertyData = getServerData().properties[propertyIndex];
- if (!tempBusinessData.needsSaved) {
+ if (!tempPropertyData.needsSaved) {
return false;
}
- logToConsole(LOG_DEBUG, `[AGRP.Property]: Saving business '${tempBusinessData.name}' to database ...`);
+ logToConsole(LOG_DEBUG, `[AGRP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
let dbConnection = connectToDatabase();
if (dbConnection) {
- let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
+ let safePropertyName = escapeDatabaseString(dbConnection, tempPropertyData.name);
let data = [
- ["biz_server", getServerId()],
- ["biz_name", safeBusinessName],
- ["biz_owner_type", tempBusinessData.ownerType],
- ["biz_owner_id", tempBusinessData.ownerId],
- ["biz_locked", boolToInt(tempBusinessData.locked)],
- ["biz_entrance_fee", tempBusinessData.entranceFee],
- ["biz_till", tempBusinessData.till],
- ["biz_entrance_pos_x", tempBusinessData.entrancePosition.x],
- ["biz_entrance_pos_y", tempBusinessData.entrancePosition.y],
- ["biz_entrance_pos_z", tempBusinessData.entrancePosition.z],
- ["biz_entrance_rot_z", tempBusinessData.entranceRotation],
- ["biz_entrance_int", tempBusinessData.entranceInterior],
- ["biz_entrance_vw", tempBusinessData.entranceDimension],
- ["biz_entrance_pickup", tempBusinessData.entrancePickupModel],
- ["biz_entrance_blip", tempBusinessData.entranceBlipModel],
- ["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],
- ["biz_exit_rot_z", tempBusinessData.exitRotation],
- ["biz_exit_int", tempBusinessData.exitInterior],
- ["biz_exit_vw", tempBusinessData.exitDimension],
- ["biz_exit_pickup", tempBusinessData.exitPickupModel],
- ["biz_exit_blip", tempBusinessData.exitBlipModel],
- ["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", (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],
+ ["prop_server", getServerId()],
+ ["prop_name", safePropertyName],
+ ["prop_owner_type", tempPropertyData.ownerType],
+ ["prop_owner_id", tempPropertyData.ownerId],
+ ["prop_locked", boolToInt(tempPropertyData.locked)],
+ ["prop_entrance_fee", tempPropertyData.entranceFee],
+ ["prop_till", tempPropertyData.till],
+ ["prop_entrance_pos_x", tempPropertyData.entrancePosition.x],
+ ["prop_entrance_pos_y", tempPropertyData.entrancePosition.y],
+ ["prop_entrance_pos_z", tempPropertyData.entrancePosition.z],
+ ["prop_entrance_rot_z", tempPropertyData.entranceRotation],
+ ["prop_entrance_int", tempPropertyData.entranceInterior],
+ ["prop_entrance_vw", tempPropertyData.entranceDimension],
+ ["prop_entrance_pickup", tempPropertyData.entrancePickupModel],
+ ["prop_entrance_blip", tempPropertyData.entranceBlipModel],
+ ["prop_entrance_scene", tempPropertyData.entranceScene],
+ ["prop_exit_pos_x", tempPropertyData.exitPosition.x],
+ ["prop_exit_pos_y", tempPropertyData.exitPosition.y],
+ ["prop_exit_pos_z", tempPropertyData.exitPosition.z],
+ ["prop_exit_rot_z", tempPropertyData.exitRotation],
+ ["prop_exit_int", tempPropertyData.exitInterior],
+ ["prop_exit_vw", tempPropertyData.exitDimension],
+ ["prop_exit_pickup", tempPropertyData.exitPickupModel],
+ ["prop_exit_blip", tempPropertyData.exitBlipModel],
+ ["prop_exit_scene", tempPropertyData.exitScene],
+ ["prop_has_interior", boolToInt(tempPropertyData.hasInterior)],
+ ["prop_interior_lights", boolToInt(tempPropertyData.interiorLights)],
+ ["prop_label_help_type", tempPropertyData.labelHelpType],
+ ["prop_radio_station", (getRadioStationData(tempPropertyData.streamingRadioStationIndex) != false) ? toInteger(getRadioStationData(tempPropertyData.streamingRadioStationIndex).databaseId) : -1],
+ ["prop_custom_interior", boolToInt(tempPropertyData.customInterior)],
+ ["prop_buy_price", tempPropertyData.buyPrice],
+ //["prop_rent_price", tempPropertyData.rentPrice],
];
let dbQuery = null;
- if (tempBusinessData.databaseId == 0) {
- let queryString = createDatabaseInsertQuery("biz_main", data);
+ if (tempPropertyData.databaseId == 0) {
+ let queryString = createDatabaseInsertQuery("prop_main", data);
dbQuery = queryDatabase(dbConnection, queryString);
- getServerData().businesses[businessId].databaseId = getDatabaseInsertId(dbConnection);
+ getServerData().properties[propertyIndex].databaseId = getDatabaseInsertId(dbConnection);
} else {
- let queryString = createDatabaseUpdateQuery("biz_main", data, `biz_id=${tempBusinessData.databaseId}`);
+ let queryString = createDatabaseUpdateQuery("prop_main", data, `prop_id=${tempPropertyData.databaseId}`);
dbQuery = queryDatabase(dbConnection, queryString);
}
- getBusinessData(businessId).needsSaved = false;
+ getPropertyData(propertyIndex).needsSaved = false;
freeDatabaseQuery(dbQuery);
disconnectFromDatabase(dbConnection);
return true;
}
- logToConsole(LOG_DEBUG, `[AGRP.Property]: Saved business '${tempBusinessData.name}' to database!`);
+ logToConsole(LOG_DEBUG, `[AGRP.Property]: Saved property '${tempPropertyData.name}' to database!`);
return false;
}
// ===========================================================================
-function createAllBusinessPickups() {
- if (!getServerConfig().createBusinessPickups) {
+function createAllPropertyPickups() {
+ if (!getServerConfig().createPropertyPickups) {
return false;
}
- for (let i in getServerData().businesses) {
- createBusinessEntrancePickup(i);
- createBusinessExitPickup(i);
- updateBusinessPickupLabelData(i);
+ for (let i in getServerData().properties) {
+ createPropertyEntrancePickup(i);
+ createPropertyExitPickup(i);
+ updatePropertyPickupLabelData(i);
}
return true;
@@ -1544,8 +1544,8 @@ function createAllBusinessPickups() {
// ===========================================================================
-function createAllBusinessBlips() {
- if (!getServerConfig().createBusinessBlips) {
+function createAllPropertyBlips() {
+ if (!getServerConfig().createPropertyBlips) {
return false;
}
@@ -1553,74 +1553,74 @@ function createAllBusinessBlips() {
return false;
}
- for (let i in getServerData().businesses) {
- createBusinessEntranceBlip(i);
- createBusinessExitBlip(i);
+ for (let i in getServerData().properties) {
+ createPropertyEntranceBlip(i);
+ createPropertyExitBlip(i);
}
}
// ===========================================================================
-function createBusinessEntrancePickup(businessId) {
+function createPropertyEntrancePickup(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (!getServerConfig().createBusinessPickups) {
+ if (!getServerConfig().createPropertyPickups) {
return false;
}
- let businessData = getBusinessData(businessId);
+ let propertyData = getPropertyData(propertyIndex);
- //if(businessData.hasInterior) {
+ //if(propertyData.hasInterior) {
// return false;
//}
- if (businessData.entrancePickupModel == -1) {
+ if (propertyData.entrancePickupModel == -1) {
return false;
}
- logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for property ${propertyData.name}`);
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
let entrancePickup = null;
if (isGameFeatureSupported("pickup")) {
- let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Property;
- if (businessData.entrancePickupModel != 0) {
- pickupModelId = businessData.entrancePickupModel;
+ if (propertyData.entrancePickupModel != 0) {
+ pickupModelId = propertyData.entrancePickupModel;
}
- entrancePickup = createGamePickup(pickupModelId, businessData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
+ entrancePickup = createGamePickup(pickupModelId, propertyData.entrancePosition, getGameConfig().pickupTypes[getGame()].business);
} else if (isGameFeatureSupported("dummyElement")) {
- entrancePickup = createGameDummyElement(businessData.entrancePosition);
+ entrancePickup = createGameDummyElement(propertyData.entrancePosition);
}
if (entrancePickup != null) {
- if (businessData.entranceDimension != -1) {
- setElementDimension(entrancePickup, businessData.entranceDimension);
+ if (propertyData.entranceDimension != -1) {
+ setElementDimension(entrancePickup, propertyData.entranceDimension);
setElementOnAllDimensions(entrancePickup, false);
} else {
setElementOnAllDimensions(entrancePickup, true);
}
- if (getGlobalConfig().businessPickupStreamInDistance == -1 || getGlobalConfig().businessPickupStreamOutDistance == -1) {
+ if (getGlobalConfig().propertyPickupStreamInDistance == -1 || getGlobalConfig().propertyPickupStreamOutDistance == -1) {
entrancePickup.netFlags.distanceStreaming = false;
} else {
- setElementStreamInDistance(entrancePickup, getGlobalConfig().businessPickupStreamInDistance);
- setElementStreamOutDistance(entrancePickup, getGlobalConfig().businessPickupStreamOutDistance);
+ setElementStreamInDistance(entrancePickup, getGlobalConfig().propertyPickupStreamInDistance);
+ setElementStreamOutDistance(entrancePickup, getGlobalConfig().propertyPickupStreamOutDistance);
}
setElementTransient(entrancePickup, false);
- getBusinessData(businessId).entrancePickup = entrancePickup;
- updateBusinessPickupLabelData(businessId);
+ getPropertyData(propertyIndex).entrancePickup = entrancePickup;
+ updatePropertyPickupLabelData(propertyIndex);
}
} else {
- let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
+ let pickupModelId = getGameConfig().pickupModels[getGame()].Property;
- if (businessData.entrancePickupModel != 0) {
- pickupModelId = businessData.entrancePickupModel;
+ if (propertyData.entrancePickupModel != 0) {
+ pickupModelId = propertyData.entrancePickupModel;
}
- sendBusinessToPlayer(null, businessId, businessData.name, businessData.entrancePosition, blipModelId, pickupModelId, businessData.hasInterior, businessData.buyPrice, businessData.rentPrice, doesBusinessHaveAnyItemsToBuy(businessId));
+ sendPropertyToPlayer(null, propertyIndex, propertyData.name, propertyData.entrancePosition, blipModelId, pickupModelId, propertyData.hasInterior, propertyData.buyPrice, propertyData.rentPrice, doesPropertyHaveAnyItemsToBuy(propertyIndex));
}
return false;
@@ -1628,12 +1628,12 @@ function createBusinessEntrancePickup(businessId) {
// ===========================================================================
-function createBusinessEntranceBlip(businessId) {
+function createPropertyEntranceBlip(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (!getServerConfig().createBusinessBlips) {
+ if (!getServerConfig().createPropertyBlips) {
return false;
}
@@ -1641,111 +1641,111 @@ function createBusinessEntranceBlip(businessId) {
return false;
}
- let businessData = getBusinessData(businessId);
+ let propertyData = getPropertyData(propertyIndex);
- //if(businessData.hasInterior) {
+ //if(propertyData.hasInterior) {
// return false;
//}
- if (businessData.entranceBlipModel == -1) {
+ if (propertyData.entranceBlipModel == -1) {
return false;
}
- let blipModelId = getGameConfig().blipSprites[getGame()].Business;
+ let blipModelId = getGameConfig().blipSprites[getGame()].Property;
- if (businessData.entranceBlipModel != 0) {
- blipModelId = businessData.entranceBlipModel;
+ if (propertyData.entranceBlipModel != 0) {
+ blipModelId = propertyData.entranceBlipModel;
}
- logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
if (areServerElementsSupported()) {
- let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
+ let entranceBlip = createGameBlip(propertyData.entrancePosition, blipModelId, 1, getColourByType("propertyColour"));
if (entranceBlip != null) {
- if (businessData.entranceDimension != -1) {
- setElementDimension(entranceBlip, businessData.entranceDimension);
+ if (propertyData.entranceDimension != -1) {
+ setElementDimension(entranceBlip, propertyData.entranceDimension);
setElementOnAllDimensions(entranceBlip, false);
} else {
setElementOnAllDimensions(entranceBlip, true);
}
- if (getGlobalConfig().businessBlipStreamInDistance == -1 || getGlobalConfig().businessBlipStreamOutDistance == -1) {
+ if (getGlobalConfig().propertyBlipStreamInDistance == -1 || getGlobalConfig().propertyBlipStreamOutDistance == -1) {
entranceBlip.netFlags.distanceStreaming = false;
} else {
- setElementStreamInDistance(entranceBlip, getGlobalConfig().businessBlipStreamInDistance);
- setElementStreamOutDistance(entranceBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ setElementStreamInDistance(entranceBlip, getGlobalConfig().propertyBlipStreamInDistance);
+ setElementStreamOutDistance(entranceBlip, getGlobalConfig().propertyBlipStreamOutDistance);
}
setElementTransient(entranceBlip, false);
- businessData.entranceBlip = entranceBlip;
+ propertyData.entranceBlip = entranceBlip;
}
}
}
// ===========================================================================
-function createBusinessExitPickup(businessId) {
+function createPropertyExitPickup(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (!getServerConfig().createBusinessPickups) {
+ if (!getServerConfig().createPropertyPickups) {
return false;
}
- let businessData = getBusinessData(businessId);
+ let propertyData = getPropertyData(propertyIndex);
- //if(!businessData.hasInterior) {
+ //if(!propertyData.hasInterior) {
// return false;
//}
- if (businessData.exitPickupModel == -1) {
+ if (propertyData.exitPickupModel == -1) {
return false;
}
- logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${propertyData.name}`);
let exitPickup = null;
if (isGameFeatureSupported("pickup")) {
let pickupModelId = getGameConfig().pickupModels[getGame()].Exit;
- if (businessData.exitPickupModel != 0) {
- pickupModelId = businessData.exitPickupModel;
+ if (propertyData.exitPickupModel != 0) {
+ pickupModelId = propertyData.exitPickupModel;
}
- exitPickup = createGamePickup(pickupModelId, businessData.exitPosition, getGameConfig().pickupTypes[getGame()].business);
+ exitPickup = createGamePickup(pickupModelId, propertyData.exitPosition, getGameConfig().pickupTypes[getGame()].business);
} else if (isGameFeatureSupported("dummyElement")) {
- //exitPickup = createGameDummyElement(businessData.exitPosition);
+ //exitPickup = createGameDummyElement(propertyData.exitPosition);
}
if (exitPickup != null) {
- if (businessData.exitDimension != -1) {
- setElementDimension(exitPickup, businessData.exitDimension);
+ if (propertyData.exitDimension != -1) {
+ setElementDimension(exitPickup, propertyData.exitDimension);
setElementOnAllDimensions(exitPickup, false);
} else {
setElementOnAllDimensions(exitPickup, true);
}
- if (getGlobalConfig().businessPickupStreamInDistance == -1 || getGlobalConfig().businessPickupStreamOutDistance == -1) {
+ if (getGlobalConfig().propertyPickupStreamInDistance == -1 || getGlobalConfig().propertyPickupStreamOutDistance == -1) {
exitPickup.netFlags.distanceStreaming = false;
} else {
- setElementStreamInDistance(exitPickup, getGlobalConfig().businessPickupStreamInDistance);
- setElementStreamOutDistance(exitPickup, getGlobalConfig().businessPickupStreamOutDistance);
+ setElementStreamInDistance(exitPickup, getGlobalConfig().propertyPickupStreamInDistance);
+ setElementStreamOutDistance(exitPickup, getGlobalConfig().propertyPickupStreamOutDistance);
}
setElementTransient(exitPickup, false);
- getBusinessData(businessId).exitPickup = exitPickup;
- updateBusinessPickupLabelData(businessId);
+ getPropertyData(propertyIndex).exitPickup = exitPickup;
+ updatePropertyPickupLabelData(propertyIndex);
}
}
// ===========================================================================
-function createBusinessExitBlip(businessId) {
+function createPropertyExitBlip(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (!getServerConfig().createBusinessBlips) {
+ if (!getServerConfig().createPropertyBlips) {
return false;
}
@@ -1753,78 +1753,78 @@ function createBusinessExitBlip(businessId) {
return false;
}
- let businessData = getBusinessData(businessId);
+ let propertyData = getPropertyData(propertyIndex);
- //if(!businessData.hasInterior) {
+ //if(!propertyData.hasInterior) {
// return false;
//}
- if (businessData.exitBlipModel == -1) {
+ if (propertyData.exitBlipModel == -1) {
return false;
}
- let blipModelId = getGameConfig().blipSprites[getGame()].Business;
+ let blipModelId = getGameConfig().blipSprites[getGame()].Property;
- if (businessData.exitBlipModel != 0) {
- blipModelId = businessData.exitBlipModel;
+ if (propertyData.exitBlipModel != 0) {
+ blipModelId = propertyData.exitBlipModel;
}
- logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
- let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
+ let exitBlip = createGameBlip(propertyData.exitPosition, blipModelId, 1, getColourByName("propertyColour"));
if (exitBlip != null) {
- if (businessData.exitDimension != -1) {
- setElementDimension(exitBlip, businessData.exitDimension);
+ if (propertyData.exitDimension != -1) {
+ setElementDimension(exitBlip, propertyData.exitDimension);
setElementOnAllDimensions(exitBlip, false);
} else {
setElementOnAllDimensions(exitBlip, true);
}
- if (getGlobalConfig().businessBlipStreamInDistance == -1 || getGlobalConfig().businessBlipStreamOutDistance == -1) {
+ if (getGlobalConfig().propertyBlipStreamInDistance == -1 || getGlobalConfig().propertyBlipStreamOutDistance == -1) {
exitBlip.netFlags.distanceStreaming = false;
} else {
- setElementStreamInDistance(exitBlip, getGlobalConfig().businessBlipStreamInDistance);
- setElementStreamOutDistance(exitBlip, getGlobalConfig().businessBlipStreamOutDistance);
+ setElementStreamInDistance(exitBlip, getGlobalConfig().propertyBlipStreamInDistance);
+ setElementStreamOutDistance(exitBlip, getGlobalConfig().propertyBlipStreamOutDistance);
}
setElementTransient(exitBlip, false);
- businessData.exitBlip = exitBlip;
+ propertyData.exitBlip = exitBlip;
}
}
// ===========================================================================
-function deleteBusiness(businessId, whoDeleted = 0) {
- let tempBusinessData = getBusinessData(businessId);
+function deleteProperty(propertyIndex, whoDeleted = 0) {
+ let tempPropertyData = getPropertyData(propertyIndex);
let dbConnection = connectToDatabase();
let dbQuery = null;
- deleteBusinessBlips(businessId);
- deleteBusinessPickups(businessId);
+ deleteProperdeletePropertyPickupstyBlips(propertyIndex);
+ (propertyIndex);
if (dbConnection) {
- dbQuery = queryDatabase(dbConnection, `UPDATE biz_main SET biz_deleted = 1, biz_when_deleted = UNIX_TIMESTAMP(), biz_who_deleted = ${whoDeleted} WHERE biz_id = ${tempBusinessData.databaseId}`);
+ dbQuery = queryDatabase(dbConnection, `UPDATE prop_main SET prop_deleted = 1, prop_when_deleted = UNIX_TIMESTAMP(), prop_who_deleted = ${whoDeleted} WHERE prop_id = ${tempPropertyData.databaseId}`);
if (dbQuery) {
freeDatabaseQuery(dbQuery);
}
disconnectFromDatabase(dbConnection);
}
- removePlayersFromBusiness(businessId);
+ removePlayersFromProperty(propertyIndex);
- getServerData().businesses.splice(businessId, 1);
+ getServerData().properties.splice(propertyIndex, 1);
return true;
}
// ===========================================================================
-function removePlayersFromBusiness(businessIndex) {
+function removePlayersFromProperty(propertyIndex) {
getClients().forEach(function (client) {
- if (doesBusinessHaveInterior(businessIndex)) {
- if (getPlayerBusiness(client) == businessIndex) {
- if (getPlayerInterior(client) == getBusinessData(businessIndex).exitInterior && getPlayerDimension(client) == getBusinessData(businessIndex).exitDimension) {
- exitBusiness(client);
+ if (doesPropertyHaveInterior(propertyIndex)) {
+ if (getPlayerProperty(client) == propertyIndex) {
+ if (getPlayerInterior(client) == getPropertyData(propertyIndex).exitInterior && getPlayerDimension(client) == getPropertyData(propertyIndex).exitDimension) {
+ exitProperty(client);
}
}
}
@@ -1835,24 +1835,24 @@ function removePlayersFromBusiness(businessIndex) {
// ===========================================================================
-function removePlayerFromBusiness(client) {
- exitBusiness(client);
+function removePlayerFromProperty(client) {
+ exitProperty(client);
return false;
}
// ===========================================================================
-function exitBusiness(client) {
- let businessId = getPlayerBusiness(client);
+function exitProperty(client) {
+ let propertyIndex = getPlayerProperty(client);
- if (businessId == false) {
+ if (propertyIndex == false) {
return false;
}
if (isPlayerSpawned(client)) {
- setPlayerInterior(client, getServerData().businesses[businessId].entranceInterior);
- setPlayerDimension(client, getServerData().businesses[businessId].entranceDimension);
- setPlayerPosition(client, getServerData().businesses[businessId].entrancePosition);
+ setPlayerInterior(client, getServerData().properties[propertyIndex].entranceInterior);
+ setPlayerDimension(client, getServerData().properties[propertyIndex].entranceDimension);
+ setPlayerPosition(client, getServerData().properties[propertyIndex].entrancePosition);
return true;
}
@@ -1861,7 +1861,7 @@ function exitBusiness(client) {
// ===========================================================================
-function getBusinessOwnerTypeText(ownerType) {
+function getPropertyOwnerTypeText(ownerType) {
switch (ownerType) {
case AGRP_BIZ_OWNER_CLAN:
return "clan";
@@ -1883,34 +1883,33 @@ function getBusinessOwnerTypeText(ownerType) {
// ===========================================================================
-function getBusinessData(businessId) {
- if (businessId == -1) {
+function getPropertyData(propertyIndex) {
+ if (propertyIndex == -1) {
return false;
}
- if (typeof getServerData().businesses[businessId] != null) {
- return getServerData().businesses[businessId];
+ if (typeof getServerData().properties[propertyIndex] != null) {
+ return getServerData().properties[propertyIndex];
}
return false;
}
// ===========================================================================
-function doesBusinessHaveInterior(businessId) {
- return getBusinessData(businessId).hasInterior;
+function doesPropertyHaveInterior(propertyIndex) {
+ return getPropertyData(propertyIndex).hasInterior;
}
// ===========================================================================
-function deleteBusinessEntrancePickup(businessId) {
+function deletePropertyEntrancePickup(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (getBusinessData(businessId).entrancePickup != null) {
- //removeFromWorld(getBusinessData(businessId).entrancePickup);
- deleteGameElement(getBusinessData(businessId).entrancePickup);
- getBusinessData(businessId).entrancePickup = null;
+ if (getPropertyData(propertyIndex).entrancePickup != null) {
+ deleteGameElement(getPropertyData(propertyIndex).entrancePickup);
+ getPropertyData(propertyIndex).entrancePickup = null;
return true;
}
@@ -1920,21 +1919,21 @@ function deleteBusinessEntrancePickup(businessId) {
// ===========================================================================
-function deleteBusinessExitPickup(businessId) {
+function deletePropertyExitPickup(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (getBusinessData(businessId).exitPickup != null) {
- //removeFromWorld(getBusinessData(businessId).exitPickup);
- deleteGameElement(getBusinessData(businessId).exitPickup);
- getBusinessData(businessId).exitPickup = null;
+ if (getPropertyData(propertyIndex).exitPickup != null) {
+ //removeFromWorld(getPropertyData(propertyIndex).exitPickup);
+ deleteGameElement(getPropertyData(propertyIndex).exitPickup);
+ getPropertyData(propertyIndex).exitPickup = null;
}
}
// ===========================================================================
-function deleteBusinessEntranceBlip(businessId) {
+function deletePropertyEntranceBlip(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
@@ -1943,16 +1942,16 @@ function deleteBusinessEntranceBlip(businessId) {
return false;
}
- if (getBusinessData(businessId).entranceBlip != null) {
- //removeFromWorld(getBusinessData(businessId).entranceBlip);
- deleteGameElement(getBusinessData(businessId).entranceBlip);
- getBusinessData(businessId).entranceBlip = null;
+ if (getPropertyData(propertyIndex).entranceBlip != null) {
+ //removeFromWorld(getPropertyData(propertyIndex).entranceBlip);
+ deleteGameElement(getPropertyData(propertyIndex).entranceBlip);
+ getPropertyData(propertyIndex).entranceBlip = null;
}
}
// ===========================================================================
-function deleteBusinessExitBlip(businessId) {
+function deletePropertyExitBlip(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
@@ -1961,55 +1960,55 @@ function deleteBusinessExitBlip(businessId) {
return false;
}
- if (getBusinessData(businessId).exitBlip != null) {
- //removeFromWorld(getBusinessData(businessId).exitBlip);
- deleteGameElement(getBusinessData(businessId).exitBlip);
- getBusinessData(businessId).exitBlip = null;
+ if (getPropertyData(propertyIndex).exitBlip != null) {
+ //removeFromWorld(getPropertyData(propertyIndex).exitBlip);
+ deleteGameElement(getPropertyData(propertyIndex).exitBlip);
+ getPropertyData(propertyIndex).exitBlip = null;
}
}
// ===========================================================================
-function reloadAllBusinessesCommand(command, params, client) {
+function reloadAllPropertyesCommand(command, params, client) {
let clients = getClients();
for (let i in clients) {
- removePlayerFromBusiness(clients[i]);
+ removePlayerFromProperty(clients[i]);
}
- for (let i in getServerData().businesses) {
- deleteBusinessExitBlip(i);
- deleteBusinessEntranceBlip(i);
- deleteBusinessExitPickup(i);
- deleteBusinessEntrancePickup(i);
+ for (let i in getServerData().properties) {
+ deletePropertyExitBlip(i);
+ deletePropertyEntranceBlip(i);
+ deletePropertyExitPickup(i);
+ deletePropertyEntrancePickup(i);
}
//forceAllPlayersToStopWorking();
- clearArray(getServerData().businesses);
- getServerData().businesses = loadBusinessesFromDatabase();
- createAllBusinessPickups();
- createAllBusinessBlips();
- setBusinessDataIndexes();
- cacheAllBusinessItems();
+ clearArray(getServerData().properties);
+ getServerData().properties = loadPropertyesFromDatabase();
+ createAllPropertyPickups();
+ createAllPropertyBlips();
+ setPropertyDataIndexes();
+ cacheAllPropertyItems();
- announceAdminAction(`AllBusinessesReloaded`);
+ announceAdminAction(`AllPropertyesReloaded`);
}
// ===========================================================================
-function setBusinessDataIndexes() {
- for (let i in getServerData().businesses) {
- getServerData().businesses[i].index = i;
+function setPropertyDataIndexes() {
+ for (let i in getServerData().properties) {
+ getServerData().properties[i].index = i;
- //if (getServerData().businesses[i].streamingRadioStation > 0) {
- // let radioStationIndex = getRadioStationFromDatabaseId(getServerData().businesses[i].streamingRadioStation);
+ //if (getServerData().properties[i].streamingRadioStation > 0) {
+ // let radioStationIndex = getRadioStationFromDatabaseId(getServerData().properties[i].streamingRadioStation);
// if (radioStationIndex != -1) {
- // getServerData().businesses[i].streamingRadioStationIndex = radioStationIndex;
+ // getServerData().properties[i].streamingRadioStationIndex = radioStationIndex;
// }
//}
- for (let j in getServerData().businesses[i].locations) {
- if (getServerData().businesses[i].locations[j].type == AGRP_BIZ_LOC_ATM) {
- getServerData().atmLocationCache.push([i, j, getServerData().businesses[i].locations[j].position]);
+ for (let j in getServerData().properties[i].locations) {
+ if (getServerData().properties[i].locations[j].type == AGRP_BIZ_LOC_ATM) {
+ getServerData().atmLocationCache.push([i, j, getServerData().properties[i].locations[j].position]);
}
}
}
@@ -2017,15 +2016,15 @@ function setBusinessDataIndexes() {
// ===========================================================================
-// Adds an item to a business inventory by item type, amount and buy price
-function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
+// Adds an item to a property inventory by item type, amount and buy price
+function addToPropertyInventory(propertyIndex, itemType, amount, buyPrice) {
let tempItemData = new ItemData(false);
tempItemData.amount = amount;
tempItemData.buyPrice = buyPrice;
tempItemData.itemType = getItemTypeData(itemType).databaseId;
- tempItemData.ownerId = getBusinessData(business).databaseId;
+ tempItemData.ownerId = getPropertyData(propertyIndex).databaseId;
tempItemData.ownerType = AGRP_ITEMOWNER_BIZ;
- tempItemData.ownerIndex = businessId;
+ tempItemData.ownerIndex = propertyIndex;
tempItemData.itemTypeIndex = itemType;
saveItemToDatabase(tempItemData);
getServerData().items.push(tempItemData);
@@ -2036,31 +2035,31 @@ function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
// ===========================================================================
-function buyFromBusinessCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function buyFromPropertyCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
if (areParamsEmpty(params)) {
- showBusinessFloorInventoryToPlayer(client, businessId);
+ showPropertyFloorInventoryToPlayer(client, propertyIndex);
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
- if (getBusinessData(businessId).locked) {
- messagePlayerError(client, `This business is closed!`);
+ if (getPropertyData(propertyIndex).locked) {
+ messagePlayerError(client, `This property is closed!`);
return false;
}
- if (getBusinessData(businessId).hasInterior) {
- if (!getPlayerBusiness(client)) {
+ if (getPropertyData(propertyIndex).hasInterior) {
+ if (!getPlayerProperty(client)) {
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
- messagePlayerTip(client, getLocaleString(client, "NeedToEnterPropertyKeyPress", "business", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)}{MAINCOLOUR}`));
+ messagePlayerTip(client, getLocaleString(client, "NeedToEnterPropertyKeyPress", getLocaleString(client, getPropertyTypeName(propertyIndex)), `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)}{MAINCOLOUR}`));
} else {
- messagePlayerNormal(client, getLocaleString(client, "NeedToEnterBusinessCommand", "business", "{ALTCOLOUR}/enter{MAINCOLOUR}"));
+ messagePlayerNormal(client, getLocaleString(client, "NeedToEnterPropertyCommand", getLocaleString(client, getPropertyTypeName(propertyIndex)), "{ALTCOLOUR}/enter{MAINCOLOUR}"));
}
return false;
}
@@ -2068,12 +2067,12 @@ function buyFromBusinessCommand(command, params, client) {
let itemSlot = toInteger(getParam(params, " ", 1)) || 1;
- if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ if (typeof getPropertyData(propertyIndex).floorItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
return false;
}
- if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ if (getPropertyData(propertyIndex).floorItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
return false;
}
@@ -2087,8 +2086,8 @@ function buyFromBusinessCommand(command, params, client) {
}
}
- if (getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount < amount) {
- messagePlayerError(client, `There are only ${getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount} ${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name} in slot ${itemSlot - 1}`);
+ if (getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).amount < amount) {
+ messagePlayerError(client, `There are only ${getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).amount} ${getItemTypeData(getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).itemTypeIndex).name} in slot ${itemSlot - 1}`);
return false;
}
@@ -2098,25 +2097,25 @@ function buyFromBusinessCommand(command, params, client) {
return false;
}
- let totalCost = getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).buyPrice * amount;
- let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name;
+ let totalCost = getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).buyPrice * amount;
+ let itemName = getItemTypeData(getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).itemTypeIndex).name;
if (getPlayerCurrentSubAccount(client).cash < totalCost) {
- messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice * amount - getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
+ messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${getPropertyData(propertyIndex).floorItemCache[itemSlot - 1].buyPrice * amount - getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
return false;
}
takePlayerCash(client, totalCost);
- createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).value, AGRP_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
+ createItem(getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).itemTypeIndex, getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).value, AGRP_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
cachePlayerHotBarItems(client);
- getBusinessData(businessId).till = getBusinessData(businessId).till + totalCost;
+ getPropertyData(propertyIndex).till = getPropertyData(propertyIndex).till + totalCost;
- getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount = getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount - amount;
- if (getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).amount == 0) {
- destroyItem(getBusinessData(businessId).floorItemCache[itemSlot - 1]);
+ getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).amount = getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).amount - amount;
+ if (getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).amount == 0) {
+ destroyItem(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]);
}
- let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
+ let useType = getItemTypeData(getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
if (useType == AGRP_ITEM_USE_TYPE_WEAPON || AGRP_ITEM_USE_TYPE_TAZER || useType == AGRP_ITEM_USE_TYPE_AMMO_CLIP) {
if (isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
messagePlayerError(client, getLocaleString(client, "WeaponBanned"));
@@ -2141,322 +2140,322 @@ function buyFromBusinessCommand(command, params, client) {
// ===========================================================================
-function setBusinessItemSellPriceCommand(command, params, client) {
- let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
+function setPropertyItemSellPriceCommand(command, params, client) {
+ let propertyIndex = getPropertyFromParams(getParam(params, " ", 3)) || getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
- if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ if (typeof getPropertyData(propertyIndex).floorItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot - 1} doesn't exist!`);
return false;
}
- if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ if (getPropertyData(propertyIndex).floorItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot - 1} slot is empty!`);
return false;
}
- let oldPrice = getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice;
+ let oldPrice = getPropertyData(propertyIndex).floorItemCache[itemSlot - 1].buyPrice;
let newPrice = toInteger(getParam(params, " ", 2)) || oldPrice;
if (newPrice < 0) {
messagePlayerError(client, "The price can't be negative!");
return false;
}
- getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).buyPrice = newPrice;
+ getItemData(getPropertyData(propertyIndex).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 ${getCurrencyString(oldPrice)} to ${getCurrencyString(newprice)}`);
+ messagePlayerSuccess(client, `You changed the price of the {ALTCOLOUR}${getItemTypeData(getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).itemTypeIndex).name}'s {MAINCOLOUR}in slot {ALTCOLOUR}${itemSlot} {MAINCOLOUR}from ${getCurrencyString(oldPrice)} to ${getCurrencyString(newprice)}`);
}
// ===========================================================================
-function storeItemInBusinessStorageCommand(command, params, client) {
- let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
+function storeItemInPropertyStorageCommand(command, params, client) {
+ let propertyIndex = getPropertyFromParams(getParam(params, " ", 3)) || getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
- if (typeof getBusinessData(businessId).floorItemCache[itemSlot - 1] == "undefined") {
+ if (typeof getPropertyData(propertyIndex).floorItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
return false;
}
- if (getBusinessData(businessId).floorItemCache[itemSlot - 1] == -1) {
+ if (getPropertyData(propertyIndex).floorItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
return false;
}
- let firstSlot = getBusinessStorageFirstFreeItemSlot(businessId);
+ let firstSlot = getPropertyStorageFirstFreeItemSlot(propertyIndex);
if (firstSlot == -1) {
messagePlayerError(client, `There isn't any room in this business storage`);
return false;
}
- getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZSTORAGE;
- getBusinessData(businessId).storageItemCache[firstSlot] = getBusinessData(businessId).floorItemCache[itemSlot - 1];
- getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
- messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} to the business storage in slot ${firstSlot}`);
+ getItemData(getPropertyData(propertyIndex).floorItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZSTORAGE;
+ getPropertyData(propertyIndex).storageItemCache[firstSlot] = getPropertyData(propertyIndex).floorItemCache[itemSlot - 1];
+ getPropertyData(propertyIndex).storageItemCache[itemSlot - 1] = -1;
+ messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getPropertyData(propertyIndex).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} to the business storage in slot ${firstSlot}`);
}
// ===========================================================================
-function stockItemOnBusinessFloorCommand(command, params, client) {
- let businessId = getPlayerBusiness(client);
+function stockItemOnPropertyFloorCommand(command, params, client) {
+ let propertyIndex = getPlayerProperty(client);
- if (!getBusinessData(businessId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
+ if (!getPropertyData(propertyIndex)) {
+ messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
return false;
}
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
- if (typeof getBusinessData(businessId).storageItemCache[itemSlot - 1] == "undefined") {
+ if (typeof getPropertyData(propertyIndex).storageItemCache[itemSlot - 1] == "undefined") {
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
return false;
}
- if (getBusinessData(businessId).storageItemCache[itemSlot - 1] == -1) {
+ if (getPropertyData(propertyIndex).storageItemCache[itemSlot - 1] == -1) {
messagePlayerError(client, `Item slot ${itemSlot} slot is empty!`);
return false;
}
- let firstSlot = getBusinessFloorFirstFreeItemSlot(businessId);
+ let firstSlot = getPropertyFloorFirstFreeItemSlot(propertyIndex);
if (firstSlot == -1) {
messagePlayerError(client, `There isn't any room in this business storage`);
return false;
}
- getItemData(getBusinessData(businessId).storageItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZFLOOR;
- getBusinessData(businessId).floorItemCache[firstSlot] = getBusinessData(businessId).storageItemCache[itemSlot - 1];
- getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
- messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} of the business storage to the business floor slot ${firstSlot}`);
+ getItemData(getPropertyData(propertyIndex).storageItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZFLOOR;
+ getPropertyData(propertyIndex).floorItemCache[firstSlot] = getPropertyData(propertyIndex).storageItemCache[itemSlot - 1];
+ getPropertyData(propertyIndex).storageItemCache[itemSlot - 1] = -1;
+ messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getPropertyData(propertyIndex).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} of the business storage to the business floor slot ${firstSlot}`);
}
// ===========================================================================
// Gets the first free slot in a business's storage items
-function getBusinessStorageFirstFreeItemSlot(businessId) {
- return getBusinessData(businessId).storageItemCache.findIndex(item => item == -1);
+function getPropertyStorageFirstFreeItemSlot(propertyIndex) {
+ return getPropertyData(propertyIndex).storageItemCache.findIndex(item => item == -1);
}
// ===========================================================================
// Gets the first free slot in a business's floor items
-function getBusinessFloorFirstFreeItemSlot(businessId) {
- return getBusinessData(businessId).floorItemCache.findIndex(item => item == -1);
+function getPropertyFloorFirstFreeItemSlot(propertyIndex) {
+ return getPropertyData(propertyIndex).floorItemCache.findIndex(item => item == -1);
}
// ===========================================================================
// Caches all items for all businesses
-function cacheAllBusinessItems() {
+function cacheAllPropertyItems() {
logToConsole(LOG_DEBUG, "[AGRP.Property] Caching all business items ...");
- for (let i in getServerData().businesses) {
- cacheBusinessItems(i);
+ for (let i in getServerData().properties) {
+ cachePropertyItems(i);
}
logToConsole(LOG_DEBUG, "[AGRP.Property] Cached all business items successfully!");
}
// ===========================================================================
-// Caches all items for a business by businessId
-function cacheBusinessItems(businessId) {
- clearArray(getBusinessData(businessId).floorItemCache);
- clearArray(getBusinessData(businessId).storageItemCache);
+// Caches all items for a business by propertyIndex
+function cachePropertyItems(propertyIndex) {
+ clearArray(getPropertyData(propertyIndex).floorItemCache);
+ clearArray(getPropertyData(propertyIndex).storageItemCache);
- //let businessData = getBusinessData(businessId);
- //logToConsole(LOG_VERBOSE, `[AGRP.Property] 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);
+ //let propertyData = getPropertyData(propertyIndex);
+ //logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${propertyData.name}) ...`);
+ //getPropertyData(propertyIndex).floorItemCache = getServerData().items.filter(item => item.ownerType == AGRP_ITEM_OWNER_BIZFLOOR && item.ownerId == propertyData.databaseId).map(i => i.index);
+ //getPropertyData(propertyIndex).storageItemCache = getServerData().items.filter(item => item.ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && item.ownerId == propertyData.databaseId);
- logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).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);
- } else if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
- getBusinessData(businessId).storageItemCache.push(i);
+ if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
+ getPropertyData(propertyIndex).floorItemCache.push(i);
+ } else if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
+ getPropertyData(propertyIndex).storageItemCache.push(i);
}
}
- logToConsole(LOG_VERBOSE, `[AGRP.Property] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
+ logToConsole(LOG_VERBOSE, `[AGRP.Property] Successfully cached ${getPropertyData(propertyIndex).floorItemCache.length} floor items and ${getPropertyData(propertyIndex).storageItemCache} storage items for business ${propertyIndex} (${getPropertyData(propertyIndex).name})!`);
}
// ===========================================================================
// Gets a business's data index from a business's databaseId
-function getBusinessIdFromDatabaseId(databaseId) {
- return getServerData().businesses.findIndex(business => business.databaseId == databaseId);
+function getPropertyIdFromDatabaseId(databaseId) {
+ return getServerData().properties.findIndex(business => business.databaseId == databaseId);
}
// ===========================================================================
-// Updates all pickup data for a business by businessId
-function updateBusinessPickupLabelData(businessId) {
+// Updates all pickup data for a business by propertyIndex
+function updatePropertyPickupLabelData(propertyIndex) {
if (!areServerElementsSupported()) {
return false;
}
- if (getBusinessData(businessId).exitPickup != null) {
- setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_EXIT, false);
- setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.id", businessId, false);
- setEntityData(getBusinessData(businessId).exitPickup, "agrp.label.type", AGRP_LABEL_EXIT, true);
+ if (getPropertyData(propertyIndex).exitPickup != null) {
+ setEntityData(getPropertyData(propertyIndex).exitPickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_EXIT, false);
+ setEntityData(getPropertyData(propertyIndex).exitPickup, "agrp.owner.id", propertyIndex, false);
+ setEntityData(getPropertyData(propertyIndex).exitPickup, "agrp.label.type", AGRP_LABEL_EXIT, true);
}
- if (getBusinessData(businessId).entrancePickup != null) {
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_ENTRANCE, false);
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.id", businessId, false);
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.type", AGRP_LABEL_BUSINESS, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.locked", getBusinessData(businessId).locked, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_NONE, true);
+ if (getPropertyData(propertyIndex).entrancePickup != null) {
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_ENTRANCE, false);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.owner.id", propertyIndex, false);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.type", AGRP_LABEL_BUSINESS, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.name", getPropertyData(propertyIndex).name, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.locked", getPropertyData(propertyIndex).locked, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_NONE, true);
- switch (getBusinessData(businessId).labelHelpType) {
+ switch (getPropertyData(propertyIndex).labelHelpType) {
case AGRP_PROPLABEL_INFO_ENTERVEHICLE: {
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTERVEHICLE, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTERVEHICLE, true);
break;
}
case AGRP_PROPLABEL_INFO_ENTER: {
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
break;
}
case AGRP_PROPLABEL_INFO_REPAIR: {
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_REPAIR, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_REPAIR, true);
break;
}
default: {
- if (getBusinessData(businessId).hasInterior) {
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
+ if (getPropertyData(propertyIndex).hasInterior) {
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
} else {
- if (doesBusinessHaveAnyItemsToBuy(businessId)) {
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_BUY, true);
+ if (doesPropertyHaveAnyItemsToBuy(propertyIndex)) {
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_BUY, true);
} else {
- removeEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help");
+ removeEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.help");
}
}
break;
}
}
- setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
+ setEntityData(getPropertyData(propertyIndex).entrancePickup, "agrp.label.price", getPropertyData(propertyIndex).buyPrice, true);
}
}
// ===========================================================================
-function resetBusinessPickups(businessId) {
- deleteBusinessPickups(businessId);
- createBusinessEntrancePickup(businessId);
- createBusinessExitPickup(businessId);
+function resetPropertyPickups(propertyIndex) {
+ deletePropertyPickups(propertyIndex);
+ createPropertyEntrancePickup(propertyIndex);
+ createPropertyExitPickup(propertyIndex);
}
// ===========================================================================
-function resetBusinessBlips(businessId) {
- deleteBusinessBlips(businessId);
- createBusinessEntranceBlip(businessId);
- createBusinessExitBlip(businessId);
+function resetPropertyBlips(propertyIndex) {
+ deletePropertyBlips(propertyIndex);
+ createPropertyEntranceBlip(propertyIndex);
+ createPropertyExitBlip(propertyIndex);
}
// ===========================================================================
-function resetAllBusinessPickups(businessId) {
- deleteBusinessPickups(businessId);
- createBusinessEntrancePickup(businessId);
- createBusinessExitPickup(businessId);
+function resetAllPropertyPickups(propertyIndex) {
+ deletePropertyPickups(propertyIndex);
+ createPropertyEntrancePickup(propertyIndex);
+ createPropertyExitPickup(propertyIndex);
}
// ===========================================================================
-function resetAllBusinessBlips() {
- for (let i in getServerData().businesses) {
- deleteBusinessBlips(i);
- createBusinessBlips(i);
+function resetAllPropertyBlips() {
+ for (let i in getServerData().properties) {
+ deletePropertyBlips(i);
+ createPropertyBlips(i);
}
}
// ===========================================================================
-function createBusinessBlips(businessId) {
- createBusinessEntranceBlip(businessId);
- createBusinessExitBlip(businessId);
+function createPropertyBlips(propertyIndex) {
+ createPropertyEntranceBlip(propertyIndex);
+ createPropertyExitBlip(propertyIndex);
}
// ===========================================================================
-function resetAllBusinessPickups() {
- for (let i in getServerData().businesses) {
- deleteBusinessPickups(i);
- createBusinessPickups(i);
+function resetAllPropertyPickups() {
+ for (let i in getServerData().properties) {
+ deletePropertyPickups(i);
+ createPropertyPickups(i);
}
}
// ===========================================================================
-function createBusinessPickups(businessId) {
- createBusinessEntrancePickup(businessId);
- createBusinessExitPickup(businessId);
+function createPropertyPickups(propertyIndex) {
+ createPropertyEntrancePickup(propertyIndex);
+ createPropertyExitPickup(propertyIndex);
}
// ===========================================================================
-function doesBusinessHaveAnyItemsToBuy(businessId) {
- return (getBusinessData(businessId).floorItemCache.length > 0);
+function doesPropertyHaveAnyItemsToBuy(propertyIndex) {
+ return (getPropertyData(propertyIndex).floorItemCache.length > 0);
}
// ===========================================================================
-//function sendPlayerBusinessGameScripts(client, businessId) {
-// for(let i in getBusinessData(businessId).gameScripts) {
-// sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
+//function sendPlayerPropertyGameScripts(client, propertyIndex) {
+// for(let i in getPropertyData(propertyIndex).gameScripts) {
+// sendPlayerGameScriptState(client, getPropertyData(propertyIndex).gameScripts[i].state);
// }
//}
// ===========================================================================
-//function clearPlayerBusinessGameScripts(client, businessId) {
-// for(let i in getBusinessData(businessId).gameScripts) {
+//function clearPlayerPropertyGameScripts(client, propertyIndex) {
+// for(let i in getPropertyData(propertyIndex).gameScripts) {
// sendPlayerGameScriptState(client, AGRP_GAMESCRIPT_DENY);
// }
//}
// ===========================================================================
-function updateBusinessInteriorLightsForOccupants(businessId) {
+function updatePropertyInteriorLightsForOccupants(propertyIndex) {
let clients = getClients()
for (let i in clients) {
- if (getPlayerBusiness(clients[i]) == businessId) {
- updateInteriorLightsForPlayer(clients[i], getBusinessData(businessId).interiorLights);
+ if (getPlayerProperty(clients[i]) == propertyIndex) {
+ updateInteriorLightsForPlayer(clients[i], getPropertyData(propertyIndex).interiorLights);
}
}
}
// ===========================================================================
-function canPlayerWithdrawFromBusinessTill(client, businessId) {
- if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+function canPlayerWithdrawFromPropertyTill(client, propertyIndex) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManagePropertyes"))) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_PLAYER && getPropertyData(propertyIndex).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
- if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_CLAN && getPropertyData(propertyIndex).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManagePropertyes"))) {
return true;
}
}
@@ -2466,17 +2465,17 @@ function canPlayerWithdrawFromBusinessTill(client, businessId) {
// ===========================================================================
-function canPlayerSetBusinessInteriorLights(client, businessId) {
- if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+function canPlayerSetPropertyInteriorLights(client, propertyIndex) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManagePropertyes"))) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_PLAYER && getPropertyData(propertyIndex).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
- if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_CLAN && getPropertyData(propertyIndex).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManagePropertyes"))) {
return true;
}
}
@@ -2486,17 +2485,17 @@ function canPlayerSetBusinessInteriorLights(client, businessId) {
// ===========================================================================
-function canPlayerLockUnlockBusiness(client, businessId) {
- if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+function canPlayerLockUnlockProperty(client, propertyIndex) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManagePropertyes"))) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_PLAYER && getPropertyData(propertyIndex).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
- if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_CLAN && getPropertyData(propertyIndex).ownerId == getClanData(getPlayerClan(client)).databaseId) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManagePropertyes"))) {
return true;
}
}
@@ -2506,24 +2505,24 @@ function canPlayerLockUnlockBusiness(client, businessId) {
// ===========================================================================
-function canPlayerManageBusiness(client, businessId) {
- if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
+function canPlayerManageProperty(client, propertyIndex) {
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManagePropertyes"))) {
return true;
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER) {
- if (getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_PLAYER) {
+ if (getPropertyData(propertyIndex).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true;
}
}
- if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN) {
- if (getBusinessData(businessId).ownerId == getPlayerClan(client)) {
- if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
+ if (getPropertyData(propertyIndex).ownerType == AGRP_BIZ_OWNER_CLAN) {
+ if (getPropertyData(propertyIndex).ownerId == getPlayerClan(client)) {
+ if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManagePropertyes"))) {
return true;
}
- //if(getBusinessData(businessId).clanRank <= getClanRankData(getPlayerClan(client), getPlayerClanRank(client)).level) {
+ //if(getPropertyData(propertyIndex).clanRank <= getClanRankData(getPlayerClan(client), getPlayerClanRank(client)).level) {
// return true;
//}
}
@@ -2534,29 +2533,29 @@ function canPlayerManageBusiness(client, businessId) {
// ===========================================================================
-function deleteBusinessBlips(business) {
- deleteBusinessExitBlip(business);
- deleteBusinessEntranceBlip(business);
+function deletePropertyBlips(business) {
+ deletePropertyExitBlip(business);
+ deletePropertyEntranceBlip(business);
}
// ===========================================================================
-function deleteBusinessPickups(business) {
- deleteBusinessExitPickup(business);
- deleteBusinessEntrancePickup(business);
+function deletePropertyPickups(business) {
+ deletePropertyExitPickup(business);
+ deletePropertyEntrancePickup(business);
}
// ===========================================================================
-function getBusinessFromParams(params) {
+function getPropertyFromParams(params) {
if (isNaN(params)) {
- for (let i in getServerData().businesses) {
- if (toLowerCase(getServerData().businesses[i].name).indexOf(toLowerCase(params)) != -1) {
+ for (let i in getServerData().properties) {
+ if (toLowerCase(getServerData().properties[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
- if (typeof getServerData().businesses[params] != "undefined") {
+ if (typeof getServerData().properties[params] != "undefined") {
return toInteger(params);
}
}
@@ -2565,24 +2564,24 @@ function getBusinessFromParams(params) {
// ===========================================================================
-function deleteAllBusinessBlips() {
- for (let i in getServerData().businesses) {
- deleteBusinessBlips(i);
+function deleteAllPropertyBlips() {
+ for (let i in getServerData().properties) {
+ deletePropertyBlips(i);
}
}
// ===========================================================================
-function deleteAllBusinessPickups() {
- for (let i in getServerData().businesses) {
- deleteBusinessPickups(i);
+function deleteAllPropertyPickups() {
+ for (let i in getServerData().properties) {
+ deletePropertyPickups(i);
}
}
// ===========================================================================
-function getBusinessFromInteriorAndDimension(dimension, interior) {
- let businesses = getServerData().businesses;
+function getPropertyFromInteriorAndDimension(dimension, interior) {
+ let businesses = getServerData().properties;
for (let i in businesses) {
if (businesses[i].exitInterior == interior && businesses[i].exitDimension == dimension) {
return i;
@@ -2594,36 +2593,36 @@ function getBusinessFromInteriorAndDimension(dimension, interior) {
// ===========================================================================
-function getClosestBusinessWithBuyableItemOfUseType(position, useType) {
- let availableBusinesses = getBusinessesWithBuyableItemOfUseType(useType);
+function getClosestPropertyWithBuyableItemOfUseType(position, useType) {
+ let availablePropertyes = getPropertyesWithBuyableItemOfUseType(useType);
- let closestBusiness = 0;
- for (let i in availableBusinesses) {
- if (getDistance(position, getBusinessData(availableBusinesses[i]).entrancePosition) < getDistance(position, getBusinessData(availableBusinesses[closestBusiness]).entrancePosition)) {
- closestBusiness = i;
+ let closestProperty = 0;
+ for (let i in availablePropertyes) {
+ if (getDistance(position, getPropertyData(availablePropertyes[i]).entrancePosition) < getDistance(position, getPropertyData(availablePropertyes[closestProperty]).entrancePosition)) {
+ closestProperty = i;
}
}
- return availableBusinesses[closestBusiness];
+ return availablePropertyes[closestProperty];
}
// ===========================================================================
-function getBusinessesWithBuyableItemOfUseType(useType) {
- let businesses = getServerData().businesses;
- let availableBusinesses = [];
+function getPropertyesWithBuyableItemOfUseType(useType) {
+ let businesses = getServerData().properties;
+ let availablePropertyes = [];
for (let i in businesses) {
- if (doesBusinessHaveBuyableItemOfUseType(i, useType)) {
- availableBusinesses.push(i);
+ if (doesPropertyHaveBuyableItemOfUseType(i, useType)) {
+ availablePropertyes.push(i);
}
}
- return availableBusinesses;
+ return availablePropertyes;
}
// ===========================================================================
-function doesBusinessHaveBuyableItemOfUseType(businessId, useType) {
- let floorItems = getBusinessData(businessId).floorItemCache;
+function doesPropertyHaveBuyableItemOfUseType(propertyIndex, useType) {
+ let floorItems = getPropertyData(propertyIndex).floorItemCache;
for (let i in floorItems) {
if (floorItems[i] != -1) {
if (getItemData(floorItems[i]) != false) {
@@ -2638,4 +2637,22 @@ function doesBusinessHaveBuyableItemOfUseType(businessId, useType) {
// ===========================================================================
-*/
\ No newline at end of file
+function getInlinePropertyColour(propertyIndex) {
+ if (getPropertyData(propertyIndex).type == AGRP_PROP_TYPE_HOUSE) {
+ return "{houseGreen}";
+ } else {
+ return "{businessBlue}";
+ }
+}
+
+// ===========================================================================
+
+function getPropertyTypeName(propertyIndex) {
+ if (getPropertyData(propertyIndex).type == AGRP_PROP_TYPE_HOUSE) {
+ return "House";
+ } else {
+ return "Business";
+ }
+}
+
+// ===========================================================================
\ No newline at end of file
From 89ed6d5023c688c8b6f243b3776dd17fc671e308 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:16:41 -0500
Subject: [PATCH 187/311] Use radio station index + data func for veh info
---
scripts/server/vehicle.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index 8aeca4be..b7189b92 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -1207,7 +1207,7 @@ function getVehicleInfoCommand(command, params, client) {
[`Lights`, `${getOnOffFromBool(vehicleData.lights)}`],
[`Buy Price`, `${vehicleData.buyPrice}`],
[`Rent Price`, `${vehicleData.rentPrice}`],
- [`Radio Station`, `${(vehicleData.streamingRadioStation == -1) ? "None" : getRadioStationData(vehicleData.streamingRadioStation).name}`],
+ [`Radio Station`, `${(vehicleData.streamingRadioStationIndex == -1) ? "None" : getRadioStationData(vehicleData.streamingRadioStationIndex).name}`],
[`Parked`, `${getYesNoFromBool(vehicleData.spawnLocked)}`],
[`License Plate`, `${vehicleData.licensePlate}`],
[`Colour`, `${getVehicleColourInfoString(vehicleData.colour1, vehicleData.colour1IsRGBA)}, ${getVehicleColourInfoString(vehicleData.colour1, vehicleData.colour1IsRGBA)}`],
From 660d1191f32fbb46458899a60b6a3f29fd7a6821 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:17:12 -0500
Subject: [PATCH 188/311] Fix a few job locale messages + fix del job loc cmd
---
scripts/server/job.js | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/scripts/server/job.js b/scripts/server/job.js
index 01c275ec..b9a0a553 100644
--- a/scripts/server/job.js
+++ b/scripts/server/job.js
@@ -1576,10 +1576,8 @@ function createJobLocationCommand(command, params, client) {
function deleteJobLocationCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client), getPlayerDimension(client));
+ deleteJobLocation(closestJobLocation.jobIndex, closestJobLocation.index);
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
-
-
- deleteJobLocation(closestJobLocation);
}
// ===========================================================================
@@ -2328,7 +2326,7 @@ function jobStartRouteCommand(command, params, client) {
}
if (getJobData(getPlayerJob(client)).routes.length == 0) {
- messagePlayerError(client, getLocaleString(client, "NoRoutesForJobLocation"));
+ messagePlayerError(client, getLocaleString(client, "NoRoutesForLocation"));
return false;
}
@@ -2430,7 +2428,7 @@ function startJobRoute(client, forceRoute = -1) {
}
if (jobRoute == -1) {
- messagePlayerError(client, `There are no routes for this location.`);
+ messagePlayerError(client, getLocaleString(client, "NoRoutesForLocation"));
return false;
}
@@ -2573,14 +2571,14 @@ function canPlayerUseJob(client, jobId) {
// ===========================================================================
-function deleteJobLocation(jobLocationData) {
+function deleteJobLocation(jobIndex, jobLocationIndex) {
if (jobLocationData.databaseId > 0) {
- quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${jobLocationData.databaseId}`);
+ quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${getJobLocationData(jobIndex, jobLocationIndex).databaseId}`);
}
- deleteJobLocationBlip(tempJob, tempLocation);
- deleteJobLocationPickup(tempJob, tempLocation);
- getJobData(getJobIdFromDatabaseId(tempJob)).locations.splice(tempLocation, 1);
+ deleteJobLocationBlip(jobIndex, jobLocationIndex);
+ deleteJobLocationPickup(jobIndex, jobLocationIndex);
+ getJobData(getJobIdFromDatabaseId(jobIndex)).locations.splice(jobLocationIndex, 1);
setAllJobDataIndexes();
}
@@ -2677,6 +2675,7 @@ function createJobLocation(jobId, position, interior, dimension, whoCreated) {
let newSlot = getServerData().jobs[jobId].locations.length - 1;
getServerData().jobs[jobId].locations[newSlot].index = newSlot;
createJobLocationPickup(jobId, newSlot);
+ createJobLocationBlip(jobId, newSlot);
saveJobLocationToDatabase(jobLocationData);
}
@@ -3901,6 +3900,25 @@ function getJobRouteLocationData(jobIndex, routeIndex, routeLocationIndex) {
// ===========================================================================
+/**
+ * @param {number} jobIndex - The data index of the job
+ * @param {number} locationIndex - The data index of the job location
+ * @return {JobLocationData} The job route locations's data (class instance)
+ */
+function getJobLocationData(jobIndex, locationIndex) {
+ if (typeof getServerData().jobs[jobIndex] == "undefined") {
+ return false;
+ }
+
+ if (typeof getServerData().jobs[jobIndex].locations[locationIndex] == "undefined") {
+ return false;
+ }
+
+ return getServerData().jobs[jobIndex].locations[locationIndex];
+}
+
+// ===========================================================================
+
function getClosestJobLocationForJob(position, jobId) {
let closestJobLocation = false;
for (let i in getServerData().jobs[jobId].locations) {
From 9e6bcc01377bb1b3ff22008c0a2d9539ebf15519 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:17:58 -0500
Subject: [PATCH 189/311] Add JSDoc for client account/subaccounts
---
scripts/server/client.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 3d541fb8..f9d154f9 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
From 8df407c2c19fab91993c84e54876ec0fc4bf3c02 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:18:19 -0500
Subject: [PATCH 190/311] Send player chatbox states on spawn
---
scripts/server/event.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/server/event.js b/scripts/server/event.js
index 4a660620..aeb89cc1 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -132,7 +132,8 @@ function onPlayerQuit(event, client, quitReasonId) {
getServerData().clients[getPlayerId(client)] = null;
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`);
- messageDiscordEventChannel(`👋 ${clientName} has left the server (${reasonTextEnglish})`);
+ //messageDiscordEventChannel(`👋 ${clientName} has left the server (${reasonTextEnglish})`);
+ messageDiscordEventChannel(getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish));
getClients().filter(c => c != client).forEach(forClient => {
messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", clientName, getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName)));
@@ -540,6 +541,12 @@ async function onPlayerSpawn(client) {
sendPlayerEnterPropertyKey(client, keyId.key);
}
+ sendPlayerChatBoxTimeStampsState(client, isPlayerAccountSettingEnabled(client, "ChatBoxTimestamps"));
+ sendPlayerChatEmojiState(client, isPlayerAccountSettingEnabled(client, "ChatEmoji"));
+ sendPlayerProfanityFilterState(client, isPlayerAccountSettingEnabled(client, "ProfanityFilter"));
+ sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines);
+ //sendPlayerGlobalKeyBindsState(client, !isPlayerAccountSettingEnabled(client, "NoKeyBinds"));
+
//if(isGTAIV()) {
// setEntityData(getPlayerPed(client), "agrp.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
From f0291cfe91459ffe3fd83fbf180e852f537f3178 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:18:37 -0500
Subject: [PATCH 191/311] Use locale strings for some prompts
---
scripts/server/gui.js | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/scripts/server/gui.js b/scripts/server/gui.js
index 10d28116..a312dca0 100644
--- a/scripts/server/gui.js
+++ b/scripts/server/gui.js
@@ -38,7 +38,7 @@ function playerPromptAnswerNo(client) {
switch (getPlayerData(client).promptType) {
case AGRP_PROMPT_CREATEFIRSTCHAR:
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} chose not to create a first character. Kicking them from the server ...`);
- showPlayerErrorGUI(client, "You don't have a character to play. Goodbye!", "No Characters");
+ showPlayerErrorGUI(client, getLocaleString(client, "DidNotCreateCharacter"), getLocaleString(client, getLocaleString(client, "GUIWarningTitle")));
getPlayerData(targetClient).customDisconnectReason = "FailedToCreateCharacter";
setTimeout(function () { disconnectPlayer(client); }, 5000);
break;
@@ -46,17 +46,19 @@ function playerPromptAnswerNo(client) {
case AGRP_PROMPT_BIZORDER:
if (getPlayerData(client).businessOrderAmount > 0) {
if (canPlayerUseGUI(client)) {
- showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
+ showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderCanceled"), getLocaleString(client, "Alert"));
} else {
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} canceled the order of ${getPlayerData(client).businessOrderAmount} ${getPlayerData(client).businessOrderItem} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness)}`);
- messagePlayerError(client, "You canceled the order!");
+ messagePlayerError(client, getLocaleString(client, "BusinessOrderCanceled"));
}
} else {
- showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
+ showPlayerErrorGUI(client, getLocaleString(client, "NotOrderingAnyBusinessItems"), getLocaleString(client, getLocaleString(client, "GUIWarningTitle")));
}
break;
default:
+ messagePlayerError(client, getLocaleString(client, "NoPromptReject"));
+ submitBugReport(client, `[AUTOMATED REPORT] Tried to reject invalid prompt type: ${getPlayerData(client).promptType}`);
break;
}
@@ -82,14 +84,15 @@ function playerPromptAnswerYes(client) {
if (getPlayerData(client).businessOrderAmount > 0) {
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
logToConsole(LOG_DEBUG, `[AGRP.GUI] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
- showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
+ showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderNotEnoughMoney"), getLocaleString(client, "BusinessOrderCanceled"));
getPlayerData(client).businessOrderAmount = 0;
getPlayerData(client).businessOrderBusiness = false;
getPlayerData(client).businessOrderItem = -1;
getPlayerData(client).businessOrderValue = -1;
} else {
logToConsole(LOG_DEBUG, `[AGRP.GUI] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
- showPlayerInfoGUI(client, `You ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} (${getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue)}) for ${getPlayerData(client).businessOrderCost}!`, "Business Order Successful");
+
+ showPlayerInfoGUI(client, getLocaleString(client, "BusinessOrderSuccessInfo", getPlayerData(client).businessOrderAmount, getItemTypeData(getPlayerData(client).businessOrderItem).name, getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue), getPlayerData(client).businessOrderCost), getLocaleString(client, "GUIInfoTitle"));
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, AGRP_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
@@ -233,20 +236,23 @@ function playerPromptAnswerYes(client) {
updateBusinessPickupLabelData(businessId);
messageDiscordEventChannel(`🏢 ${getCharacterFullName(client)} is now the owner of *${getBusinessData(businessId).name}*!`);
- messagePlayerSuccess(client, `🏢 You are now the owner of {businessBlue}${getBusinessData(businessId).name}`);
+ messagePlayerSuccess(client, getLocaleString(client, "BusinessPurchased", `{businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}`));
break;
}
case AGRP_PROMPT_RESETKEYBINDS: {
+ messagePlayerSuccess(client, getLocaleString(client, "KeyBindsReset"));
break;
}
case AGRP_PROMPT_COPYKEYBINDSTOSERVER: {
+ //messagePlayerSuccess(client, getLocaleString(client, "KeyBindsCopiedToServer", serverName));
break;
}
default: {
- submitBugReport(client, `[AUTOMATED REPORT] Unknown prompt type: ${getPlayerData(client).promptType}`);
+ messagePlayerError(client, getLocaleString(client, "NoPromptAccept"));
+ submitBugReport(client, `[AUTOMATED REPORT] Tried to accept invalid prompt type: ${getPlayerData(client).promptType}`);
break;
}
}
From a691c2a9d05eac48320e9d63193691eecbb7d570 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Fri, 14 Oct 2022 15:19:03 -0500
Subject: [PATCH 192/311] Fix wrong locale string name when using handcuffs
---
scripts/server/item.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/server/item.js b/scripts/server/item.js
index b15df96d..3d8646fe 100644
--- a/scripts/server/item.js
+++ b/scripts/server/item.js
@@ -1445,7 +1445,7 @@ function playerUseItem(client, hotBarSlot) {
meActionToNearbyPlayers(client, `takes their key and removes the handcuffs from ${getCharacterFullName(closestPlayer)}`);
} else {
if (!isPlayerSurrendered(closestPlayer)) {
- messagePlayerError(client, getLocaleString(client, "PlayerNotSurrenderedHandcuffed", getCharacterFullName(closestPlayer)));
+ messagePlayerError(client, getLocaleString(client, "PlayerNotSurrenderedHandcuff", getCharacterFullName(closestPlayer)));
return false;
}
From 54703e2cd950f427a8ae64f55f0326569ef3ff16 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sat, 15 Oct 2022 16:07:19 -0500
Subject: [PATCH 193/311] Add 2nd warehouse int type for GTA 3
---
scripts/shared/gamedata.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/shared/gamedata.js b/scripts/shared/gamedata.js
index 0a970acb..df546122 100644
--- a/scripts/shared/gamedata.js
+++ b/scripts/shared/gamedata.js
@@ -5913,7 +5913,8 @@ let gameData = {
Mansion: [toVector3(1461.00, -173.87, 55.78), 0, false, ""],
SmallGarage: [toVector3(-420.69, 289.86, 62.96), 0, false, ""],
JoeyGarage: [toVector3(1189.40, -867.69, 15.18), 0, false, ""],
- Warehouse: [toVector3(1497.46, -680.18, 12.14), 0, false, ""],
+ Warehouse1: [toVector3(1497.46, -680.18, 12.14), 0, false, ""],
+ Warehouse2: [toVector3(1131.44, -1113.07, 11.86), 0, false, ""],
},
[AGRP_GAME_GTA_VC]: { // GTA VC
Mall: [toVector3(379.62, 1007.00, 19.22), 4, false, ""],
From d9f4ec7c6f8045b3c6c99586afb8128d4418bd0d Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 16 Oct 2022 17:08:52 -0500
Subject: [PATCH 194/311] Fix biz/house price not being shown
---
scripts/client/label.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/client/label.js b/scripts/client/label.js
index df01f09a..8721c13c 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -318,7 +318,7 @@ function processLabelRendering() {
}
if (getDistance(localPlayer.position, business.entrancePosition) <= propertyLabelRenderDistance) {
- renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, getCurrencyString(business.buyPrice), getCurrencyString(business.rentPrice), business.labelInfoType);
+ renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, business.buyPrice, business.rentPrice, business.labelInfoType);
}
}
});
@@ -330,7 +330,7 @@ function processLabelRendering() {
}
if (getDistance(localPlayer.position, house.entrancePosition) <= propertyLabelRenderDistance) {
- renderPropertyEntranceLabel(house.description, house.entrancePosition, house.locked, true, getCurrencyString(house.buyPrice), getCurrencyString(house.rentPrice), house.labelInfoType);
+ renderPropertyEntranceLabel(house.description, house.entrancePosition, house.locked, true, house.buyPrice, house.rentPrice, house.labelInfoType);
}
}
});
@@ -360,11 +360,11 @@ function processLabelRendering() {
let rentPrice = "0";
let labelInfoType = AGRP_PROPLABEL_INFO_NONE;
if (pickups[i].getData("agrp.label.price") != null) {
- price = getCurrencyString(pickups[i].getData("agrp.label.price"));
+ price = pickups[i].getData("agrp.label.price");
}
if (pickups[i].getData("agrp.label.rentprice") != null) {
- rentPrice = getCurrencyString(pickups[i].getData("agrp.label.rentprice"));
+ rentPrice = pickups[i].getData("agrp.label.rentprice");
}
if (pickups[i].getData("agrp.label.help") != null) {
From 79893be66f972ccd9fe84a88ff536f3c1daf53db Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Sun, 16 Oct 2022 17:11:54 -0500
Subject: [PATCH 195/311] Announce more things to discord
---
scripts/server/business.js | 32 ++++++++++++++++----------------
scripts/server/command.js | 18 +++++++++---------
scripts/server/developer.js | 12 ++++++------
scripts/server/event.js | 15 +++++++++------
scripts/server/house.js | 16 ++++++++--------
scripts/server/messaging.js | 8 ++++++--
scripts/server/npc.js | 18 ++----------------
scripts/server/staff.js | 6 +++---
scripts/server/vehicle.js | 32 ++++++++++++++++++--------------
9 files changed, 77 insertions(+), 80 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index 75b7a0e1..33da7fec 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -327,7 +327,7 @@ function createBusinessCommand(command, params, 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);
}
// ===========================================================================
@@ -362,7 +362,7 @@ 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);
}
// ===========================================================================
@@ -422,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);
}
// ===========================================================================
@@ -472,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);
}
// ===========================================================================
@@ -556,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}`);
}
// ===========================================================================
@@ -1075,7 +1075,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);
}
// ===========================================================================
@@ -1113,7 +1113,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
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;
}
@@ -1154,7 +1154,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);
}
// ===========================================================================
@@ -1213,7 +1213,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);
}
// ===========================================================================
@@ -1258,7 +1258,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);
}
// ===========================================================================
@@ -1309,7 +1309,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);
}
// ===========================================================================
@@ -1334,7 +1334,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);
}
// ===========================================================================
@@ -1363,7 +1363,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);
}
// ===========================================================================
@@ -1392,7 +1392,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);
}
// ===========================================================================
@@ -1710,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);
}
// ===========================================================================
@@ -1748,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);
}
// ===========================================================================
diff --git a/scripts/server/command.js b/scripts/server/command.js
index 6b45fe5a..d05449f8 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -634,7 +634,7 @@ function loadCommands() {
new CommandData("vehowner", setVehicleOwnerCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
new CommandData("vehpublic", setVehiclePublicCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
new CommandData("vehclan", setVehicleClanCommand, "", getStaffFlagValue(""), true, true),
- new CommandData("vehbiz", setVehicleToBusinessCommand, "", getStaffFlagValue(""), true, true),
+ new CommandData("vehbiz", setVehicleBusinessCommand, "", getStaffFlagValue(""), true, true),
new CommandData("vehjob", setVehicleJobCommand, "[job id/name]", getStaffFlagValue("ManageVehicles"), true, true),
new CommandData("vehdelowner", removeVehicleOwnerCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
new CommandData("vehrank", setVehicleRankCommand, "", getStaffFlagValue("None"), true, true),
@@ -785,12 +785,12 @@ function disableCommand(command, params, client) {
params = toLowerCase(params);
if (!getCommand(params)) {
- messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`);
+ messagePlayerError(client, `The command {ALTCOLOUR}/${params}{MAINCOLOUR} does not exist!`);
return false;
}
getCommand(params).enabled = false;
- messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been disabled!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} disabled the {ALTCOLOUR}${params}{MAINCOLOUR} command!`, true);
return true;
}
@@ -805,12 +805,12 @@ function enableCommand(command, params, client) {
params = toLowerCase(params);
if (!getCommand(params)) {
- messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`);
+ messagePlayerError(client, `The command {ALTCOLOUR}/${params}{MAINCOLOUR} does not exist!`);
return false;
}
getCommand(params).enabled = true;
- messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been enabled!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} enabled the {ALTCOLOUR}${params}{MAINCOLOUR} command!`, true);
return true;
}
@@ -825,7 +825,7 @@ function disableAllCommandsByType(command, params, client) {
params = toLowerCase(params);
if (isNull(getServerData().commands[params])) {
- messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`);
+ messagePlayerError(client, `Command type {ALTCOLOUR}${params}{MAINCOLOUR} does not exist!`);
return false;
}
@@ -833,7 +833,7 @@ function disableAllCommandsByType(command, params, client) {
getServerData().commands[params][i].enabled = false;
}
- messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been disabled!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} disabled all {ALTCOLOUR}${params}{MAINCOLOUR} commands!`, true);
return true;
}
@@ -848,7 +848,7 @@ function enableAllCommandsByType(command, params, client) {
params = toLowerCase(params);
if (isNull(getServerData().commands[params])) {
- messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`);
+ messagePlayerError(client, `Command type {ALTCOLOUR}${params}{MAINCOLOUR} does not exist!`);
return false;
}
@@ -856,7 +856,7 @@ function enableAllCommandsByType(command, params, client) {
getServerData().commands[params][i].enabled = true;
}
- messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been enabled!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} enabled all {ALTCOLOUR}${params}{MAINCOLOUR} commands!`, true);
return true;
}
diff --git a/scripts/server/developer.js b/scripts/server/developer.js
index 72734180..7483736f 100644
--- a/scripts/server/developer.js
+++ b/scripts/server/developer.js
@@ -152,7 +152,7 @@ function addLogLevelCommand(command, params, client) {
}
sendPlayerLogLevel(null, logLevel);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}enabled log level {ALTCOLOUR}${toLowerCase(params)}`);
+ messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} enabled log level {ALTCOLOUR}${toLowerCase(params)}`);
return true;
}
@@ -219,7 +219,7 @@ function removeLogLevelCommand(command, params, client) {
}
sendPlayerLogLevel(null, logLevel);
- messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}disabled log level {ALTCOLOUR}${toLowerCase(params)}`);
+ messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} disabled log level {ALTCOLOUR}${toLowerCase(params)}`);
return true;
}
@@ -254,7 +254,7 @@ function simulateCommandForPlayerCommand(command, params, client) {
}
if (!getCommand(tempCommand)) {
- messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`);
+ messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} does not exist! Use /help for commands and information.`);
return false;
}
@@ -288,7 +288,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) {
let tempParams = splitParams.slice(1).join(" ");
if (!getCommand(tempCommand)) {
- messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`);
+ messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} does not exist! Use /help for commands and information.`);
return false;
}
@@ -441,9 +441,9 @@ function testErrorGUICommand(command, params, client) {
// ===========================================================================
function saveServerDataCommand(command, params, client) {
- messageAdmins(`{adminOrange}Vortrex{MAINCOLOUR} has forced a manual save of all data. Initiating ...`);
+ messageAdmins(`{adminOrange}Vortrex{MAINCOLOUR} has forced a manual save of all data. Initiating ...`, true);
saveServerDataToDatabase();
- messageAdmins(`{MAINCOLOUR}All server data saved to database successfully!`);
+ messageAdmins(`{MAINCOLOUR}All server data saved to database successfully!`, true);
return true;
}
diff --git a/scripts/server/event.js b/scripts/server/event.js
index aeb89cc1..7b7a3bc0 100644
--- a/scripts/server/event.js
+++ b/scripts/server/event.js
@@ -133,7 +133,7 @@ function onPlayerQuit(event, client, quitReasonId) {
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`);
//messageDiscordEventChannel(`👋 ${clientName} has left the server (${reasonTextEnglish})`);
- messageDiscordEventChannel(getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish));
+ messageDiscordEventChannel(`👋 ${getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish)}`);
getClients().filter(c => c != client).forEach(forClient => {
messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", clientName, getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName)));
@@ -218,9 +218,10 @@ function onPedExitingVehicle(event, ped, vehicle) {
function onResourceStart(event, resource) {
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`);
- //if(resource != thisResource) {
- // messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
- //}
+ if (resource == thisResource) {
+ //messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
+ messageDiscordEventChannel(`✅ Server is starting up!`);
+ }
}
// ===========================================================================
@@ -237,6 +238,8 @@ function onResourceStop(event, resource) {
saveServerDataToDatabase();
disconnectFromDatabase(persistentDatabaseConnection, true);
collectAllGarbage();
+
+ messageDiscordEventChannel(`⛔ Server is shutting down!`);
}
}
@@ -731,7 +734,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
//vehicle.netFlags.sendSync = getVehicleData(vehicle).engine;
- if (getVehicleData(vehicle).buyPrice > 0 && !doesPlayerHaveVehicleKeys(client, vehicle)) {
+ if (getVehicleData(vehicle).buyPrice > 0) {
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}${getCurrencyString(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
resetVehiclePosition(vehicle);
} else if (getVehicleData(vehicle).rentPrice > 0) {
@@ -763,7 +766,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
break;
case AGRP_VEHOWNER_BIZ:
- ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
+ ownerName = getBusinessData(getBusinessIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
ownerType = getLocaleString(client, "Business");
break;
diff --git a/scripts/server/house.js b/scripts/server/house.js
index 92e44614..9bb63d24 100644
--- a/scripts/server/house.js
+++ b/scripts/server/house.js
@@ -217,7 +217,7 @@ function createHouseCommand(command, params, client) {
}
createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getGame()].House, -1, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorScene);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created house: {houseGreen}${params}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created house: {houseGreen}${params}`, true);
}
// ===========================================================================
@@ -275,7 +275,7 @@ function setHouseDescriptionCommand(command, params, client) {
getHouseData(houseId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed house {houseGreen}${oldDescription}{MAINCOLOUR} to {houseGreen}${getHouseData(houseId).description}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed house {houseGreen}${oldDescription}{MAINCOLOUR} to {houseGreen}${getHouseData(houseId).description}`, true);
}
// ===========================================================================
@@ -468,7 +468,7 @@ function setHousePickupCommand(command, params, client) {
getHouseData(houseId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} pickup display to {ALTCOLOUR}${toLowerCase(typeParam)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} pickup to {ALTCOLOUR}${toLowerCase(typeParam)}`, true);
}
// ===========================================================================
@@ -504,7 +504,7 @@ function setHouseInteriorTypeCommand(command, params, client) {
tempHouseLocation.exitInterior = -1;
getHouseData(houseId).exitPickupModel = -1;
getHouseData(houseId).hasInterior = false;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior`, true);
return false;
}
@@ -534,7 +534,7 @@ function setHouseInteriorTypeCommand(command, params, client) {
getHouseData(houseId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior type to {ALTCOLOUR}${toLowerCase(typeParam)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`, true);
}
// ===========================================================================
@@ -585,7 +585,7 @@ function setHouseBlipCommand(command, params, client) {
resetHouseBlips(houseId);
getHouseData(houseId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} blip display to {ALTCOLOUR}${toLowerCase(typeParam)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} blip to {ALTCOLOUR}${toLowerCase(typeParam)}`, true);
}
// ===========================================================================
@@ -621,7 +621,7 @@ function moveHouseEntranceCommand(command, params, client) {
getHouseData(houseId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} entrance to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} entrance to their position`, true);
}
// ===========================================================================
@@ -661,7 +661,7 @@ function moveHouseExitCommand(command, params, client) {
getHouseData(houseId).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} exit to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} exit to their position`, true);
}
// ===========================================================================
diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js
index 483fc1fe..5ab1efa8 100644
--- a/scripts/server/messaging.js
+++ b/scripts/server/messaging.js
@@ -62,16 +62,20 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
// ===========================================================================
-function messageAdmins(messageText, colour = getColourByName("softRed")) {
+function messageAdmins(messageText, announceToEventChannel = false) {
let clients = getClients();
for (let i in clients) {
if (doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
- messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
+ messagePlayerNormal(clients[i], `🛡️ ${messageText}`, getColourByName("white"));
}
}
let plainMessage = removeColoursInMessage(messageText);
messageDiscordAdminChannel(plainMessage);
+
+ if (announceToEventChannel == true) {
+ messageDiscordEventChannel(`🛡️ ${plainMessage}`);
+ }
}
// ===========================================================================
diff --git a/scripts/server/npc.js b/scripts/server/npc.js
index e9e4df44..d476607c 100644
--- a/scripts/server/npc.js
+++ b/scripts/server/npc.js
@@ -515,7 +515,7 @@ function deleteNPCCommand(command, params, client) {
let npcName = getNPCData(closestNPC).name;
deleteNPC(closestNPC);
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted NPC {npcPink}${npcName}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted NPC {npcPink}${npcName}`, true);
}
// ===========================================================================
@@ -619,7 +619,7 @@ function setNPCClanCommand(command, params, client) {
getNPCData(closestNPC).ownerId = getClanData(clanId).databaseId;
getNPCData(closestNPC).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`, true);
}
// ===========================================================================
@@ -631,25 +631,11 @@ function addNPCTriggerCommand(command, params, client) {
}
let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client));
- let clanId = getClanFromParams(params);
if (!getNPCData(closestNPC)) {
messagePlayerError(client, getLocaleString(client, "InvalidNPC"));
return false;
}
-
- if (!getClanData(clanId)) {
- messagePlayerError(client, getLocaleString(client, "InvalidClan"));
- return false;
- }
-
- //let triggerData = new TriggerData();
-
- getNPCData(closestNPC).ownerType = AGRP_NPC_OWNER_CLAN;
- getNPCData(closestNPC).ownerId = getClanData(clanId).databaseId;
- getNPCData(closestNPC).needsSaved = true;
-
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`);
}
// ===========================================================================
diff --git a/scripts/server/staff.js b/scripts/server/staff.js
index 0c96796c..dff13093 100644
--- a/scripts/server/staff.js
+++ b/scripts/server/staff.js
@@ -394,7 +394,7 @@ function getVehicleCommand(command, params, client) {
setElementInterior(vehicle, getPlayerInterior(client));
setElementDimension(vehicle, getPlayerDimension(client));
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported a {vehiclePurple}${getVehicleName(vehicle)}{ALTCOLOUR} (ID ${vehicle.id}){MAINCOLOUR} to their position`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported a {vehiclePurple}${getVehicleName(vehicle)}{ALTCOLOUR} (ID ${vehicle.id}){MAINCOLOUR} to their position`, true);
}
// ===========================================================================
@@ -888,7 +888,7 @@ function getPlayerCommand(command, params, client) {
setPlayerInterior(targetClient, getPlayerInterior(client));
setPlayerDimension(targetClient, getPlayerDimension(client));
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their position.`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their position.`, true);
messagePlayerAlert(targetClient, `An admin has teleported you to their location`);
}
@@ -935,7 +935,7 @@ function returnPlayerCommand(command, params, client) {
getPlayerData(targetClient).returnToBusiness = null;
getPlayerData(targetClient).returnToType = AGRP_RETURNTO_TYPE_NONE;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} returned {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their previous position.`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} returned {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their previous position.`, true);
messagePlayerAlert(targetClient, `An admin has returned you to your previous location`);
}
diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js
index b7189b92..ebe14652 100644
--- a/scripts/server/vehicle.js
+++ b/scripts/server/vehicle.js
@@ -375,7 +375,7 @@ function createVehicleCommand(command, params, client) {
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
let vehicle = createPermanentVehicle(modelIndex, frontPos, heading, getPlayerInterior(client), getPlayerDimension(client));
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a {vehiclePurple}${getVehicleName(vehicle)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a {vehiclePurple}${getVehicleName(vehicle)}`, true);
}
// ===========================================================================
@@ -396,7 +396,7 @@ function createTemporaryVehicleCommand(command, params, client) {
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
let vehicle = createTemporaryVehicle(modelIndex, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client));
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a temporary {vehiclePurple}${getVehicleName(vehicle)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a temporary {vehiclePurple}${getVehicleName(vehicle)}`, true);
}
// ===========================================================================
@@ -902,7 +902,7 @@ function setVehicleJobCommand(command, params, client) {
getVehicleData(vehicle).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`, true);
}
// ===========================================================================
@@ -933,10 +933,10 @@ function setVehicleRankCommand(command, params, client) {
return false;
}
getVehicleData(vehicle).rank = getClanRankData(getVehicleData(vehicle).ownerId, rankId).databaseId;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name}{MAINCOLOUR} of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name}{MAINCOLOUR} clan!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} minimum rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name}{MAINCOLOUR} of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name}{MAINCOLOUR} clan!`, true);
} else if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_JOB) {
getVehicleData(vehicle).rank = rankId;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rank to {ALTCOLOUR}${rankId}{MAINCOLOUR} of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name}{MAINCOLOUR} job!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} minimum rank to {ALTCOLOUR}${rankId}{MAINCOLOUR} of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name}{MAINCOLOUR} job!`, true);
}
getVehicleData(vehicle).needsSaved = true;
@@ -981,14 +981,18 @@ function setVehicleClanCommand(command, params, client) {
// ===========================================================================
-function setVehicleToBusinessCommand(command, params, client) {
+function setVehicleBusinessCommand(command, params, client) {
if (!isPlayerInAnyVehicle(client)) {
messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle"));
return false;
}
let vehicle = getPlayerVehicle(client);
- let businessId = getPlayerBusiness(client);
+ let businessId = getClosestBusinessEntrance(client);
+
+ if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses")) && !isNull(params)) {
+ businessId = getBusinessFromParams(params);
+ }
if (!getVehicleData(vehicle)) {
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
@@ -1003,7 +1007,7 @@ function setVehicleToBusinessCommand(command, params, client) {
getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_BIZ;
getVehicleData(vehicle).ownerId = getBusinessData(businessId).databaseId;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`, true);
getVehicleData(vehicle).needsSaved = true;
}
@@ -1032,7 +1036,7 @@ function setVehicleOwnerCommand(command, params, client) {
getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_PLAYER;
getVehicleData(vehicle).ownerId = getPlayerCurrentSubAccount(targetClient).databaseId;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`, true);
getVehicleData(vehicle).needsSaved = true;
}
@@ -1055,7 +1059,7 @@ function setVehiclePublicCommand(command, params, client) {
getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_PUBLIC;
getVehicleData(vehicle).ownerId = 0;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to a public vehicle!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to a public vehicle!`, true);
getVehicleData(vehicle).needsSaved = true;
}
@@ -1086,7 +1090,7 @@ function setVehicleRentPriceCommand(command, params, client) {
getVehicleData(vehicle).rentPrice = amount;
getVehicleData(vehicle).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rent price to {ALTCOLOUR}${getCurrencyString(amount)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rent price to {ALTCOLOUR}${getCurrencyString(amount)}`, true);
}
// ===========================================================================
@@ -1115,7 +1119,7 @@ function setVehicleBuyPriceCommand(command, params, client) {
getVehicleData(vehicle).buyPrice = amount;
getVehicleData(vehicle).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}'s{MAINCOLOUR} buy price to {ALTCOLOUR}${getCurrencyString(amount)}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}'s{MAINCOLOUR} buy price to {ALTCOLOUR}${getCurrencyString(amount)}`, true);
}
// ===========================================================================
@@ -1144,7 +1148,7 @@ function removeVehicleOwnerCommand(command, params, client) {
getVehicleData(vehicle).needsSaved = true;
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to nobody!`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to nobody!`, true);
messagePlayerInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`);
}
@@ -1296,7 +1300,7 @@ function toggleVehicleSpawnLockCommand(command, params, client) {
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
}
- messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`);
+ messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`, true);
getVehicleData(vehicle).needsSaved = true;
}
From 0aacfdd818d75e7a2f371f3b744c077e99a39fba Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 17 Oct 2022 15:53:40 -0500
Subject: [PATCH 196/311] GUI fixes
---
scripts/client/gui.js | 48 ++++++++++++++++++++++++
scripts/client/gui/games/5-card-poker.js | 9 -----
scripts/client/gui/games/5cardpoker.js | 40 ++++++++++++++++++++
scripts/client/gui/games/blackjack.js | 4 +-
scripts/client/gui/inventory.js | 45 ++++++++++++++++++++++
scripts/client/gui/inventorybulk.js | 45 ++++++++++++++++++++++
scripts/client/gui/localechooser.js | 5 +--
7 files changed, 181 insertions(+), 15 deletions(-)
delete mode 100644 scripts/client/gui/games/5-card-poker.js
create mode 100644 scripts/client/gui/games/5cardpoker.js
create mode 100644 scripts/client/gui/inventory.js
create mode 100644 scripts/client/gui/inventorybulk.js
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 2093a6d6..f5c4b549 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -62,6 +62,14 @@ function initGUI() {
initResetPasswordGUI();
initChangePasswordGUI();
initLocaleChooserGUI();
+ initInventoryGUI();
+ initInventoryBulkGUI();
+ //initClanManagerGUI();
+ //initBusinessManagerGUI();
+ //initHouseManagerGUI();
+ initFiveCardPokerGUI();
+ initBettingGUI();
+ initBlackJackGUI();
closeAllWindows();
guiReady = true;
@@ -87,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;
@@ -155,6 +171,38 @@ 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 (inventorGUI.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;
}
diff --git a/scripts/client/gui/games/5-card-poker.js b/scripts/client/gui/games/5-card-poker.js
deleted file mode 100644
index d254829b..00000000
--- a/scripts/client/gui/games/5-card-poker.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// ===========================================================================
-// 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)
-// ===========================================================================
\ No newline at end of file
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 ee0e7ad3..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, `[AGRP.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, `[AGRP.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/localechooser.js b/scripts/client/gui/localechooser.js
index dc7dcdb5..db3b26e1 100644
--- a/scripts/client/gui/localechooser.js
+++ b/scripts/client/gui/localechooser.js
@@ -57,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 {
@@ -79,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();
From 583e4c525221b7144376acfc8cdb2b73489ae372 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Mon, 17 Oct 2022 15:53:54 -0500
Subject: [PATCH 197/311] Add GUI stuff to meta.xml
---
meta.xml | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/meta.xml b/meta.xml
index 087714c1..db939fa6 100644
--- a/meta.xml
+++ b/meta.xml
@@ -10,7 +10,7 @@
-
+
@@ -100,13 +100,19 @@
-
+
+
+
+
-
+
+
+
+
From c725852b0b5976d709296f8eaea7bca36ef0cc89 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 18 Oct 2022 17:41:06 -0500
Subject: [PATCH 198/311] Revert "Use full game width for item action bar"
This reverts commit bb6a4713961539a7041d21a7ba85ed8e68108109.
---
scripts/client/item.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/client/item.js b/scripts/client/item.js
index 5f371ee3..30eb6fdb 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -38,8 +38,8 @@ function processItemActionRendering() {
let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
let backgroundColour = toColour(0, 0, 0, 255);
- graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x) - 1, itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 1], [itemActionDelaySize.x + 2, itemActionDelaySize.y + 2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
- graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x), itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x / 2) - 1, itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 1], [itemActionDelaySize.x + 2, itemActionDelaySize.y + 2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
+ graphics.drawRectangle(null, [itemActionDelayPosition.x - (itemActionDelaySize.x / 2), itemActionDelayPosition.y - (itemActionDelaySize.y / 2) - 2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
}
}
}
From 2e2e44566df888219f321b3f0e38e908eb622679 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Tue, 18 Oct 2022 17:43:19 -0500
Subject: [PATCH 199/311] Revert item action bar
---
scripts/client/item.js | 4 ++--
scripts/server/casino.js | 42 +++++++++++++++++++---------------------
2 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/scripts/client/item.js b/scripts/client/item.js
index 30eb6fdb..6513adb9 100644
--- a/scripts/client/item.js
+++ b/scripts/client/item.js
@@ -11,8 +11,8 @@
let itemActionDelayDuration = 0;
let itemActionDelayStart = 0;
let itemActionDelayEnabled = false;
-let itemActionDelayPosition = toVector2(0, game.height - 10);
-let itemActionDelaySize = toVector2(game.width, 10);
+let itemActionDelayPosition = toVector2(game.width / 2 - 100, game.height - 10);
+let itemActionDelaySize = toVector2(200, 5);
// ===========================================================================
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
From 5eb459b3081d44436f57eb3335aa830c01e67577 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 21:40:52 -0500
Subject: [PATCH 200/311] Fix house enter sometimes not working
---
scripts/server/misc.js | 43 +++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 51e4270c..9be429ee 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -211,6 +211,9 @@ function enterExitPropertyCommand(command, params, client) {
return false;
}
+ // The player's currentPickup wasn't always being set. This prevented entering/exiting a property.
+ // Needs further testing and tweaks.
+ /*
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
if (!getPlayerData(client).currentPickup) {
return false;
@@ -248,31 +251,41 @@ function enterExitPropertyCommand(command, params, client) {
return false;
}
} else {
- for (let i in getServerData().businesses) {
- if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
- let businessId = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ */
+
+ // Check business first
+ if (closestProperty == null) {
+ if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
+ let businessIndex = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getBusinessData(businessIndex).entrancePosition, getPlayerPosition(client)) <= 1.5) {
isBusiness = true;
isEntrance = true;
- closestProperty = getServerData().businesses[businessId];
- } else {
- let businessId = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
- isBusiness = true;
+ closestProperty = getServerData().businesses[businessIndex];
+ }
+ } else {
+ let businessIndex = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getBusinessData(businessIndex).exitPosition, getPlayerPosition(client)) <= 1.5) {
+ isBusiness = false;
isEntrance = false;
- closestProperty = getServerData().businesses[businessId];
+ closestProperty = getServerData().businesses[businessIndex];
}
}
+ }
- for (let j in getServerData().houses) {
- if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
- let houseId = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (closestProperty == null) {
+ if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
+ let houseIndex = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getHouseData(houseIndex).entrancePosition, getPlayerPosition(client)) <= 1.5) {
isBusiness = false;
isEntrance = true;
- closestProperty = getServerData().businesses[houseId];
- } else {
- let houseId = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
+ closestProperty = getServerData().houses[houseIndex];
+ }
+ } else {
+ let houseIndex = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getHouseData(houseIndex).exitPosition, getPlayerPosition(client)) <= 1.5) {
isBusiness = false;
isEntrance = false;
- closestProperty = getServerData().businesses[houseId];
+ closestProperty = getServerData().houses[houseIndex];
}
}
}
From 1d00adb7e30f7615510dac887e3a9043f1743e61 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 22:08:54 -0500
Subject: [PATCH 201/311] Use fallback if pickup data not available
---
scripts/server/misc.js | 69 ++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 37 deletions(-)
diff --git a/scripts/server/misc.js b/scripts/server/misc.js
index 9be429ee..f1fc4c4b 100644
--- a/scripts/server/misc.js
+++ b/scripts/server/misc.js
@@ -213,12 +213,7 @@ function enterExitPropertyCommand(command, params, client) {
// The player's currentPickup wasn't always being set. This prevented entering/exiting a property.
// Needs further testing and tweaks.
- /*
- if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
- if (!getPlayerData(client).currentPickup) {
- return false;
- }
-
+ if (!getPlayerData(client).currentPickup) {
let ownerType = getEntityData(getPlayerData(client).currentPickup, "agrp.owner.type");
let ownerId = getEntityData(getPlayerData(client).currentPickup, "agrp.owner.id");
@@ -250,43 +245,43 @@ function enterExitPropertyCommand(command, params, client) {
default:
return false;
}
- } else {
- */
+ }
- // Check business first
+ // Check businesses first
if (closestProperty == null) {
- if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
- let businessIndex = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
- if (getDistance(getBusinessData(businessIndex).entrancePosition, getPlayerPosition(client)) <= 1.5) {
- isBusiness = true;
- isEntrance = true;
- closestProperty = getServerData().businesses[businessIndex];
- }
- } else {
- let businessIndex = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
- if (getDistance(getBusinessData(businessIndex).exitPosition, getPlayerPosition(client)) <= 1.5) {
- isBusiness = false;
- isEntrance = false;
- closestProperty = getServerData().businesses[businessIndex];
- }
+ let businessIndex = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getBusinessData(businessIndex).entrancePosition, getPlayerPosition(client)) <= 1.5) {
+ isBusiness = true;
+ isEntrance = true;
+ closestProperty = getServerData().businesses[businessIndex];
}
}
if (closestProperty == null) {
- if (getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
- let houseIndex = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
- if (getDistance(getHouseData(houseIndex).entrancePosition, getPlayerPosition(client)) <= 1.5) {
- isBusiness = false;
- isEntrance = true;
- closestProperty = getServerData().houses[houseIndex];
- }
- } else {
- let houseIndex = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
- if (getDistance(getHouseData(houseIndex).exitPosition, getPlayerPosition(client)) <= 1.5) {
- isBusiness = false;
- isEntrance = false;
- closestProperty = getServerData().houses[houseIndex];
- }
+ let businessIndex = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getBusinessData(businessIndex).exitPosition, getPlayerPosition(client)) <= 1.5) {
+ isBusiness = true;
+ isEntrance = false;
+ closestProperty = getServerData().businesses[businessIndex];
+ }
+ }
+
+ // Check houses second
+ if (closestProperty == null) {
+ let houseIndex = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getHouseData(houseIndex).entrancePosition, getPlayerPosition(client)) <= 1.5) {
+ isBusiness = false;
+ isEntrance = true;
+ closestProperty = getServerData().houses[houseIndex];
+ }
+ }
+
+ if (closestProperty == null) {
+ let houseIndex = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
+ if (getDistance(getHouseData(houseIndex).exitPosition, getPlayerPosition(client)) <= 1.5) {
+ isBusiness = false;
+ isEntrance = false;
+ closestProperty = getServerData().houses[houseIndex];
}
}
From 8ee9aa23478492ebf28d74360691ce247e7aab4c Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 22:09:05 -0500
Subject: [PATCH 202/311] Disable unfinished GUI for now
---
scripts/client/gui.js | 50 +++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index f5c4b549..f0d06d73 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -62,14 +62,14 @@ function initGUI() {
initResetPasswordGUI();
initChangePasswordGUI();
initLocaleChooserGUI();
- initInventoryGUI();
- initInventoryBulkGUI();
+ //initInventoryGUI();
+ //initInventoryBulkGUI();
//initClanManagerGUI();
//initBusinessManagerGUI();
//initHouseManagerGUI();
- initFiveCardPokerGUI();
- initBettingGUI();
- initBlackJackGUI();
+ //initFiveCardPokerGUI();
+ //initBettingGUI();
+ //initBlackJackGUI();
closeAllWindows();
guiReady = true;
@@ -98,11 +98,11 @@ function closeAllWindows() {
//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;
+ //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;
@@ -183,25 +183,25 @@ function isAnyGUIActive() {
// return true;
//}
- if (inventorGUI.window.shown == true) {
- return true;
- }
+ //if (inventoryGUI.window.shown == true) {
+ // return true;
+ //}
- if (inventoryBulkGUI.window.shown == true) {
- return true;
- }
+ //if (inventoryBulkGUI.window.shown == true) {
+ // return true;
+ //}
- if (bettingGUI.window.shown == true) {
- return true;
- }
+ //if (bettingGUI.window.shown == true) {
+ // return true;
+ //}
- if (blackJackGUI.window.shown == true) {
- return true;
- }
+ //if (blackJackGUI.window.shown == true) {
+ // return true;
+ //}
- if (fiveCardPokerGUI.window.shown == true) {
- return true;
- }
+ //if (fiveCardPokerGUI.window.shown == true) {
+ // return true;
+ //}
return false;
}
From 345b8ba1e981361e19dbbebc302f19339ed571f3 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 23:54:33 -0500
Subject: [PATCH 203/311] Fix colours not showing with timestamps enabled
---
scripts/client/chat.js | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/scripts/client/chat.js b/scripts/client/chat.js
index c85140ce..13bc908d 100644
--- a/scripts/client/chat.js
+++ b/scripts/client/chat.js
@@ -73,8 +73,8 @@ 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}`;
}
@@ -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);
From 18f27dce8ef4059ea1cc325a266530b1ff5459de Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 23:54:45 -0500
Subject: [PATCH 204/311] Use game feature util for scale
---
scripts/client/sync.js | 46 +++++++++++++++++++++++++++++++++++-------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index d66f1cba..34cc7a78 100644
--- a/scripts/client/sync.js
+++ b/scripts/client/sync.js
@@ -111,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);
@@ -146,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;
@@ -165,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;
@@ -238,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;
@@ -356,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");
}
}
@@ -393,6 +421,10 @@ function syncElementProperties(element) {
syncPlayerProperties(element);
break;
+ case ELEMENT_OBJECT:
+ syncObjectProperties(element);
+ break;
+
default:
break;
}
From 5360a46485e1c469d1ce2656a4a5e080418bf223 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 23:54:58 -0500
Subject: [PATCH 205/311] Fix wrong prompt const names
---
scripts/server/business.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/server/business.js b/scripts/server/business.js
index 33da7fec..00731609 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -595,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;
@@ -1670,7 +1671,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;
}
// ===========================================================================
From 08721d1273b4a56c2362c04d4c91cc449b9e2f46 Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 23:55:26 -0500
Subject: [PATCH 206/311] Show admin's title in admin chat
---
scripts/server/chat.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/server/chat.js b/scripts/server/chat.js
index 152c9328..f8381793 100644
--- a/scripts/server/chat.js
+++ b/scripts/server/chat.js
@@ -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}`);
}
// ===========================================================================
From 2d25539036e9bca8a127f3d768df3a3e217bdf5a Mon Sep 17 00:00:00 2001
From: Vortrex <3858226+VortrexFTW@users.noreply.github.com>
Date: Wed, 19 Oct 2022 23:55:38 -0500
Subject: [PATCH 207/311] Add item type drop model command
---
scripts/server/command.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/server/command.js b/scripts/server/command.js
index d05449f8..c4708a4f 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -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, "
-