Use new AGRP prefix on console msg

This commit is contained in:
Vortrex
2022-09-20 02:27:25 -05:00
parent 6ed7cd9bc6
commit 655a784d27
66 changed files with 579 additions and 564 deletions

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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);
}
// ===========================================================================

View File

@@ -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.

View File

@@ -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]);
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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);
}

View File

@@ -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`);
}
// ===========================================================================

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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");

View File

@@ -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();
}

View File

@@ -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`);
}
// ===========================================================================

View File

@@ -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();

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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));
}
}
// ===========================================================================

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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`);
}
// ===========================================================================

View File

@@ -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));

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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;
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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);

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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!`);
}
// ===========================================================================

View File

@@ -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);

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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 "";
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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;
}

View File

@@ -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!");
}
// ===========================================================================

View File

@@ -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();

View File

@@ -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;
}

View File

@@ -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();
}

View File

@@ -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;
}

View File

@@ -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);