From 79893be66f972ccd9fe84a88ff536f3c1daf53db Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 16 Oct 2022 17:11:54 -0500 Subject: [PATCH] Announce more things to discord --- scripts/server/business.js | 32 ++++++++++++++++---------------- scripts/server/command.js | 18 +++++++++--------- scripts/server/developer.js | 12 ++++++------ scripts/server/event.js | 15 +++++++++------ scripts/server/house.js | 16 ++++++++-------- scripts/server/messaging.js | 8 ++++++-- scripts/server/npc.js | 18 ++---------------- scripts/server/staff.js | 6 +++--- scripts/server/vehicle.js | 32 ++++++++++++++++++-------------- 9 files changed, 77 insertions(+), 80 deletions(-) diff --git a/scripts/server/business.js b/scripts/server/business.js index 75b7a0e1..33da7fec 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -327,7 +327,7 @@ function createBusinessCommand(command, params, client) { getPlayerDimension(client), getPlayerData(client).interiorScene); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`, true); } // =========================================================================== @@ -362,7 +362,7 @@ function createBusinessLocationCommand(command, params, client) { let tempBusinessLocationData = createBusinessLocation(locationType, businessId); getServerData().businesses[businessId].push(tempBusinessLocationData); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`, true); } // =========================================================================== @@ -422,7 +422,7 @@ function deleteBusinessCommand(command, params, client) { } deleteBusiness(businessId, getPlayerData(client).accountData.databaseId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`, true); } // =========================================================================== @@ -472,7 +472,7 @@ function setBusinessNameCommand(command, params, client) { getBusinessData(businessId).name = newBusinessName; setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true); getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true); } // =========================================================================== @@ -556,7 +556,7 @@ function setBusinessJobCommand(command, params, client) { getBusinessData(businessId).ownerId = getJobData(jobId).databaseId; getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {jobYellow}${getJobData(jobId).name}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to the {jobYellow}${getJobData(jobId).name}`); } // =========================================================================== @@ -1075,7 +1075,7 @@ function setBusinessPickupCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup display to {ALTCOLOUR}${typeParam}!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup to {ALTCOLOUR}${typeParam}!`, true); } // =========================================================================== @@ -1113,7 +1113,7 @@ function setBusinessInteriorTypeCommand(command, params, client) { getBusinessData(businessId).exitScene = ""; getBusinessData(businessId).exitPickupModel = -1; getBusinessData(businessId).customInterior = false; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`, true); return false; } @@ -1154,7 +1154,7 @@ function setBusinessInteriorTypeCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -1213,7 +1213,7 @@ function addBusinessPropertyTemplateEntities(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} property template to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -1258,7 +1258,7 @@ function setBusinessBlipCommand(command, params, client) { resetBusinessBlips(businessId); getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -1309,7 +1309,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) { cacheBusinessItems(businessId); updateBusinessPickupLabelData(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${typeParam}`, true); } // =========================================================================== @@ -1334,7 +1334,7 @@ function setBusinessDealershipCommand(command, params, client) { getBusinessData(businessId).labelHelpType == AGRP_PROPLABEL_INFO_ENTERVEHICLE; getBusinessData(businessId).type = AGRP_BIZ_TYPE_DEALERSHIP; updateBusinessPickupLabelData(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the business type of {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true); } // =========================================================================== @@ -1363,7 +1363,7 @@ function deleteBusinessFloorItemsCommand(command, params, client) { cacheBusinessItems(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`, true); } // =========================================================================== @@ -1392,7 +1392,7 @@ function deleteBusinessStorageItemsCommand(command, params, client) { cacheBusinessItems(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all storage items for business {businessBlue}${getBusinessData(businessId).name}`, true); } // =========================================================================== @@ -1710,7 +1710,7 @@ function moveBusinessEntranceCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`, true); } // =========================================================================== @@ -1748,7 +1748,7 @@ function moveBusinessExitCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}exit to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} exit to their position`, true); } // =========================================================================== diff --git a/scripts/server/command.js b/scripts/server/command.js index 6b45fe5a..d05449f8 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -634,7 +634,7 @@ function loadCommands() { new CommandData("vehowner", setVehicleOwnerCommand, "", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehpublic", setVehiclePublicCommand, "", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehclan", setVehicleClanCommand, "", getStaffFlagValue(""), true, true), - new CommandData("vehbiz", setVehicleToBusinessCommand, "", getStaffFlagValue(""), true, true), + new CommandData("vehbiz", setVehicleBusinessCommand, "", getStaffFlagValue(""), true, true), new CommandData("vehjob", setVehicleJobCommand, "[job id/name]", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehdelowner", removeVehicleOwnerCommand, "", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehrank", setVehicleRankCommand, "", getStaffFlagValue("None"), true, true), @@ -785,12 +785,12 @@ function disableCommand(command, params, client) { params = toLowerCase(params); if (!getCommand(params)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${params}{MAINCOLOUR} does not exist!`); return false; } getCommand(params).enabled = false; - messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been disabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} disabled the {ALTCOLOUR}${params}{MAINCOLOUR} command!`, true); return true; } @@ -805,12 +805,12 @@ function enableCommand(command, params, client) { params = toLowerCase(params); if (!getCommand(params)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${params}{MAINCOLOUR} does not exist!`); return false; } getCommand(params).enabled = true; - messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been enabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} enabled the {ALTCOLOUR}${params}{MAINCOLOUR} command!`, true); return true; } @@ -825,7 +825,7 @@ function disableAllCommandsByType(command, params, client) { params = toLowerCase(params); if (isNull(getServerData().commands[params])) { - messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`); + messagePlayerError(client, `Command type {ALTCOLOUR}${params}{MAINCOLOUR} does not exist!`); return false; } @@ -833,7 +833,7 @@ function disableAllCommandsByType(command, params, client) { getServerData().commands[params][i].enabled = false; } - messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been disabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} disabled all {ALTCOLOUR}${params}{MAINCOLOUR} commands!`, true); return true; } @@ -848,7 +848,7 @@ function enableAllCommandsByType(command, params, client) { params = toLowerCase(params); if (isNull(getServerData().commands[params])) { - messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`); + messagePlayerError(client, `Command type {ALTCOLOUR}${params}{MAINCOLOUR} does not exist!`); return false; } @@ -856,7 +856,7 @@ function enableAllCommandsByType(command, params, client) { getServerData().commands[params][i].enabled = true; } - messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been enabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} enabled all {ALTCOLOUR}${params}{MAINCOLOUR} commands!`, true); return true; } diff --git a/scripts/server/developer.js b/scripts/server/developer.js index 72734180..7483736f 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -152,7 +152,7 @@ function addLogLevelCommand(command, params, client) { } sendPlayerLogLevel(null, logLevel); - messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}enabled log level {ALTCOLOUR}${toLowerCase(params)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} enabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -219,7 +219,7 @@ function removeLogLevelCommand(command, params, client) { } sendPlayerLogLevel(null, logLevel); - messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}disabled log level {ALTCOLOUR}${toLowerCase(params)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} disabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -254,7 +254,7 @@ function simulateCommandForPlayerCommand(command, params, client) { } if (!getCommand(tempCommand)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} does not exist! Use /help for commands and information.`); return false; } @@ -288,7 +288,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) { let tempParams = splitParams.slice(1).join(" "); if (!getCommand(tempCommand)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} does not exist! Use /help for commands and information.`); return false; } @@ -441,9 +441,9 @@ function testErrorGUICommand(command, params, client) { // =========================================================================== function saveServerDataCommand(command, params, client) { - messageAdmins(`{adminOrange}Vortrex{MAINCOLOUR} has forced a manual save of all data. Initiating ...`); + messageAdmins(`{adminOrange}Vortrex{MAINCOLOUR} has forced a manual save of all data. Initiating ...`, true); saveServerDataToDatabase(); - messageAdmins(`{MAINCOLOUR}All server data saved to database successfully!`); + messageAdmins(`{MAINCOLOUR}All server data saved to database successfully!`, true); return true; } diff --git a/scripts/server/event.js b/scripts/server/event.js index aeb89cc1..7b7a3bc0 100644 --- a/scripts/server/event.js +++ b/scripts/server/event.js @@ -133,7 +133,7 @@ function onPlayerQuit(event, client, quitReasonId) { logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`); //messageDiscordEventChannel(`👋 ${clientName} has left the server (${reasonTextEnglish})`); - messageDiscordEventChannel(getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish)); + messageDiscordEventChannel(`👋 ${getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish)}`); getClients().filter(c => c != client).forEach(forClient => { messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", clientName, getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName))); @@ -218,9 +218,10 @@ function onPedExitingVehicle(event, ped, vehicle) { function onResourceStart(event, resource) { logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`); - //if(resource != thisResource) { - // messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`); - //} + if (resource == thisResource) { + //messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`); + messageDiscordEventChannel(`✅ Server is starting up!`); + } } // =========================================================================== @@ -237,6 +238,8 @@ function onResourceStop(event, resource) { saveServerDataToDatabase(); disconnectFromDatabase(persistentDatabaseConnection, true); collectAllGarbage(); + + messageDiscordEventChannel(`⛔ Server is shutting down!`); } } @@ -731,7 +734,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) { setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true); //vehicle.netFlags.sendSync = getVehicleData(vehicle).engine; - if (getVehicleData(vehicle).buyPrice > 0 && !doesPlayerHaveVehicleKeys(client, vehicle)) { + if (getVehicleData(vehicle).buyPrice > 0) { messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}${getCurrencyString(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`)); resetVehiclePosition(vehicle); } else if (getVehicleData(vehicle).rentPrice > 0) { @@ -763,7 +766,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) { break; case AGRP_VEHOWNER_BIZ: - ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name; + ownerName = getBusinessData(getBusinessIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name; ownerType = getLocaleString(client, "Business"); break; diff --git a/scripts/server/house.js b/scripts/server/house.js index 92e44614..9bb63d24 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -217,7 +217,7 @@ function createHouseCommand(command, params, client) { } createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getGame()].House, -1, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorScene); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created house: {houseGreen}${params}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created house: {houseGreen}${params}`, true); } // =========================================================================== @@ -275,7 +275,7 @@ function setHouseDescriptionCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed house {houseGreen}${oldDescription}{MAINCOLOUR} to {houseGreen}${getHouseData(houseId).description}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed house {houseGreen}${oldDescription}{MAINCOLOUR} to {houseGreen}${getHouseData(houseId).description}`, true); } // =========================================================================== @@ -468,7 +468,7 @@ function setHousePickupCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} pickup display to {ALTCOLOUR}${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} pickup to {ALTCOLOUR}${toLowerCase(typeParam)}`, true); } // =========================================================================== @@ -504,7 +504,7 @@ function setHouseInteriorTypeCommand(command, params, client) { tempHouseLocation.exitInterior = -1; getHouseData(houseId).exitPickupModel = -1; getHouseData(houseId).hasInterior = false; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior`, true); return false; } @@ -534,7 +534,7 @@ function setHouseInteriorTypeCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior type to {ALTCOLOUR}${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -585,7 +585,7 @@ function setHouseBlipCommand(command, params, client) { resetHouseBlips(houseId); getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} blip display to {ALTCOLOUR}${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} blip to {ALTCOLOUR}${toLowerCase(typeParam)}`, true); } // =========================================================================== @@ -621,7 +621,7 @@ function moveHouseEntranceCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} entrance to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} entrance to their position`, true); } // =========================================================================== @@ -661,7 +661,7 @@ function moveHouseExitCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} exit to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} exit to their position`, true); } // =========================================================================== diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js index 483fc1fe..5ab1efa8 100644 --- a/scripts/server/messaging.js +++ b/scripts/server/messaging.js @@ -62,16 +62,20 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) { // =========================================================================== -function messageAdmins(messageText, colour = getColourByName("softRed")) { +function messageAdmins(messageText, announceToEventChannel = false) { let clients = getClients(); for (let i in clients) { if (doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) { - messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour); + messagePlayerNormal(clients[i], `🛡️ ${messageText}`, getColourByName("white")); } } let plainMessage = removeColoursInMessage(messageText); messageDiscordAdminChannel(plainMessage); + + if (announceToEventChannel == true) { + messageDiscordEventChannel(`🛡️ ${plainMessage}`); + } } // =========================================================================== diff --git a/scripts/server/npc.js b/scripts/server/npc.js index e9e4df44..d476607c 100644 --- a/scripts/server/npc.js +++ b/scripts/server/npc.js @@ -515,7 +515,7 @@ function deleteNPCCommand(command, params, client) { let npcName = getNPCData(closestNPC).name; deleteNPC(closestNPC); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted NPC {npcPink}${npcName}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted NPC {npcPink}${npcName}`, true); } // =========================================================================== @@ -619,7 +619,7 @@ function setNPCClanCommand(command, params, client) { getNPCData(closestNPC).ownerId = getClanData(clanId).databaseId; getNPCData(closestNPC).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`, true); } // =========================================================================== @@ -631,25 +631,11 @@ function addNPCTriggerCommand(command, params, client) { } let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client)); - let clanId = getClanFromParams(params); if (!getNPCData(closestNPC)) { messagePlayerError(client, getLocaleString(client, "InvalidNPC")); return false; } - - if (!getClanData(clanId)) { - messagePlayerError(client, getLocaleString(client, "InvalidClan")); - return false; - } - - //let triggerData = new TriggerData(); - - getNPCData(closestNPC).ownerType = AGRP_NPC_OWNER_CLAN; - getNPCData(closestNPC).ownerId = getClanData(clanId).databaseId; - getNPCData(closestNPC).needsSaved = true; - - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`); } // =========================================================================== diff --git a/scripts/server/staff.js b/scripts/server/staff.js index 0c96796c..dff13093 100644 --- a/scripts/server/staff.js +++ b/scripts/server/staff.js @@ -394,7 +394,7 @@ function getVehicleCommand(command, params, client) { setElementInterior(vehicle, getPlayerInterior(client)); setElementDimension(vehicle, getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported a {vehiclePurple}${getVehicleName(vehicle)}{ALTCOLOUR} (ID ${vehicle.id}){MAINCOLOUR} to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported a {vehiclePurple}${getVehicleName(vehicle)}{ALTCOLOUR} (ID ${vehicle.id}){MAINCOLOUR} to their position`, true); } // =========================================================================== @@ -888,7 +888,7 @@ function getPlayerCommand(command, params, client) { setPlayerInterior(targetClient, getPlayerInterior(client)); setPlayerDimension(targetClient, getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their position.`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their position.`, true); messagePlayerAlert(targetClient, `An admin has teleported you to their location`); } @@ -935,7 +935,7 @@ function returnPlayerCommand(command, params, client) { getPlayerData(targetClient).returnToBusiness = null; getPlayerData(targetClient).returnToType = AGRP_RETURNTO_TYPE_NONE; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} returned {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their previous position.`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} returned {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their previous position.`, true); messagePlayerAlert(targetClient, `An admin has returned you to your previous location`); } diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index b7189b92..ebe14652 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -375,7 +375,7 @@ function createVehicleCommand(command, params, client) { let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let vehicle = createPermanentVehicle(modelIndex, frontPos, heading, getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a {vehiclePurple}${getVehicleName(vehicle)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a {vehiclePurple}${getVehicleName(vehicle)}`, true); } // =========================================================================== @@ -396,7 +396,7 @@ function createTemporaryVehicleCommand(command, params, client) { let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let vehicle = createTemporaryVehicle(modelIndex, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a temporary {vehiclePurple}${getVehicleName(vehicle)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a temporary {vehiclePurple}${getVehicleName(vehicle)}`, true); } // =========================================================================== @@ -902,7 +902,7 @@ function setVehicleJobCommand(command, params, client) { getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`, true); } // =========================================================================== @@ -933,10 +933,10 @@ function setVehicleRankCommand(command, params, client) { return false; } getVehicleData(vehicle).rank = getClanRankData(getVehicleData(vehicle).ownerId, rankId).databaseId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name}{MAINCOLOUR} of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name}{MAINCOLOUR} clan!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} minimum rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name}{MAINCOLOUR} of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name}{MAINCOLOUR} clan!`, true); } else if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_JOB) { getVehicleData(vehicle).rank = rankId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rank to {ALTCOLOUR}${rankId}{MAINCOLOUR} of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name}{MAINCOLOUR} job!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} minimum rank to {ALTCOLOUR}${rankId}{MAINCOLOUR} of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name}{MAINCOLOUR} job!`, true); } getVehicleData(vehicle).needsSaved = true; @@ -981,14 +981,18 @@ function setVehicleClanCommand(command, params, client) { // =========================================================================== -function setVehicleToBusinessCommand(command, params, client) { +function setVehicleBusinessCommand(command, params, client) { if (!isPlayerInAnyVehicle(client)) { messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle")); return false; } let vehicle = getPlayerVehicle(client); - let businessId = getPlayerBusiness(client); + let businessId = getClosestBusinessEntrance(client); + + if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses")) && !isNull(params)) { + businessId = getBusinessFromParams(params); + } if (!getVehicleData(vehicle)) { messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled")); @@ -1003,7 +1007,7 @@ function setVehicleToBusinessCommand(command, params, client) { getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_BIZ; getVehicleData(vehicle).ownerId = getBusinessData(businessId).databaseId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`, true); getVehicleData(vehicle).needsSaved = true; } @@ -1032,7 +1036,7 @@ function setVehicleOwnerCommand(command, params, client) { getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_PLAYER; getVehicleData(vehicle).ownerId = getPlayerCurrentSubAccount(targetClient).databaseId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`, true); getVehicleData(vehicle).needsSaved = true; } @@ -1055,7 +1059,7 @@ function setVehiclePublicCommand(command, params, client) { getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_PUBLIC; getVehicleData(vehicle).ownerId = 0; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to a public vehicle!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to a public vehicle!`, true); getVehicleData(vehicle).needsSaved = true; } @@ -1086,7 +1090,7 @@ function setVehicleRentPriceCommand(command, params, client) { getVehicleData(vehicle).rentPrice = amount; getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rent price to {ALTCOLOUR}${getCurrencyString(amount)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rent price to {ALTCOLOUR}${getCurrencyString(amount)}`, true); } // =========================================================================== @@ -1115,7 +1119,7 @@ function setVehicleBuyPriceCommand(command, params, client) { getVehicleData(vehicle).buyPrice = amount; getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}'s{MAINCOLOUR} buy price to {ALTCOLOUR}${getCurrencyString(amount)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}'s{MAINCOLOUR} buy price to {ALTCOLOUR}${getCurrencyString(amount)}`, true); } // =========================================================================== @@ -1144,7 +1148,7 @@ function removeVehicleOwnerCommand(command, params, client) { getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to nobody!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to nobody!`, true); messagePlayerInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`); } @@ -1296,7 +1300,7 @@ function toggleVehicleSpawnLockCommand(command, params, client) { getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle); } - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`, true); getVehicleData(vehicle).needsSaved = true; }