Use console output utils

This commit is contained in:
Vortrex
2022-05-02 15:30:03 -05:00
parent 05e58874dc
commit 72bf00dfe6
6 changed files with 18 additions and 22 deletions

View File

@@ -20,7 +20,7 @@ function SetStandardControlsEnabled(bEnabled)
if (game.standardControls === undefined)
{
console.warn("game.standardControls not implemented");
logToConsole(LOG_WARN, "game.standardControls not implemented");
return;
}
game.standardControls = bEnabled;
@@ -93,7 +93,7 @@ function GetMouseSensitivity()
{
if (game.getMouseSensitivity === undefined)
{
//console.error("game.getMouseSensitivity not implemented");
//logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
return [0.0025,0.003];
}
let MouseSensitivity = game.getMouseSensitivity();
@@ -124,7 +124,7 @@ function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, v
{
if (game.processLineOfSight === undefined)
{
console.warn("game.processLineOfSight not implemented");
logToConsole(LOG_WARN, "game.processLineOfSight not implemented");
return [null];
}
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);

View File

@@ -1688,10 +1688,6 @@ function createBusinessEntrancePickup(businessId) {
}
if(getBusinessData(businessId).entrancePickupModel != -1) {
console.log(getGameConfig().pickupModels);
console.warn(typeof getGame());
console.warn(typeof VRR_GAME_GTA_VC);
console.warn(Object.keys(getGameConfig().pickupModels))
let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
if(getServerData().businesses[businessId].entrancePickupModel != 0) {

View File

@@ -720,7 +720,7 @@ function processPlayerCommand(command, params, client) {
}
if(!doesCommandExist(toLowerCase(command))) {
console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
logToConsole(LOG_WARN, `[VRR.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)))) {
@@ -732,14 +732,14 @@ function processPlayerCommand(command, params, client) {
}
if(!commandData.enabled) {
console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}is disabled!`);
return false;
}
if(doesCommandRequireLogin(toLowerCase(command))) {
if(!isPlayerLoggedIn(client)) {
console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
messagePlayerError(client, `You must be logged in to use the {ALTCOLOUR}/${command} {MAINCOLOUR}command!`);
return false;
}
@@ -747,7 +747,7 @@ function processPlayerCommand(command, params, client) {
//if(isClientFromDiscord(client)) {
// if(!isCommandAllowedOnDiscord(command)) {
// console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
// logToConsole(LOG_WARN, `[VRR.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;
// }
@@ -755,7 +755,7 @@ function processPlayerCommand(command, params, client) {
if(!isConsole(client)) {
if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
messagePlayerError(client, `You do not have permission to use the {ALTCOLOUR}/${toLowerCase(command)} {MAINCOLOUR}command!`);
return false;
}

View File

@@ -58,7 +58,7 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
function messageAdmins(messageText, colour = getColourByName("softRed")) {
//
//console.warn(`🛡️ ${plainMessage}`);
//logToConsole(LOG_WARN, `🛡️ ${plainMessage}`);
let clients = getClients();
for(let i in clients) {

View File

@@ -93,20 +93,20 @@ function checkForAllRequiredModules() {
logToConsole(LOG_DEBUG, "[VRR.Startup]: Checking for required modules ...");
if(!checkForHashingModule()) {
console.warn("[VRR.Startup]: Hashing module is not loaded!");
console.warn("[VRR.Startup]: This resource will now shutdown.");
logToConsole(LOG_WARN, "[VRR.Startup]: Hashing module is not loaded!");
logToConsole(LOG_WARN, "[VRR.Startup]: This resource will now shutdown.");
thisResource.stop();
}
if(!checkForMySQLModule()) {
console.warn("[VRR.Startup]: MySQL module is not loaded!");
console.warn("[VRR.Startup]: This resource will now shutdown.");
logToConsole(LOG_WARN, "[VRR.Startup]: MySQL module is not loaded!");
logToConsole(LOG_WARN, "[VRR.Startup]: This resource will now shutdown.");
thisResource.stop();
}
if(!checkForSMTPModule()) {
console.warn("[VRR.Startup]: SMTP Email module is not loaded!");
console.warn("[VRR.Startup]: Email features will NOT be available!");
logToConsole(LOG_WARN, "[VRR.Startup]: SMTP Email module is not loaded!");
logToConsole(LOG_WARN, "[VRR.Startup]: Email features will NOT be available!");
}
logToConsole(LOG_DEBUG, "[VRR.Startup]: All required modules loaded!");

View File

@@ -1349,13 +1349,13 @@ function logToConsole(tempLogLevel, text) {
if((logLevel & tempLogLevel)) {
if(tempLogLevel & LOG_ERROR) {
console.error(text);
consoleError(text);
return true;
} else if(tempLogLevel & LOG_WARN) {
console.warn(text);
consoleWarn(text);
return true;
} else {
console.log(text);
consolePrint(text);
return true;
}
}