Use new AGRP prefix on console msg
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user