From f877235bf86a7d2e8a0325eb14f4333203f45568 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Fri, 25 Mar 2022 02:21:50 -0500 Subject: [PATCH] Add JSDoc + use locale strings for admin announce --- scripts/server/business.js | 368 ++++++++++++++++++++- scripts/server/client.js | 7 - scripts/server/command.js | 40 ++- scripts/server/config.js | 30 +- scripts/server/developer.js | 6 +- scripts/server/economy.js | 2 +- scripts/server/house.js | 57 +++- scripts/server/item.js | 216 +++++++++++++ scripts/server/job.js | 2 +- scripts/server/messaging.js | 2 +- scripts/server/native/connected.js | 7 + scripts/server/radio.js | 38 ++- scripts/server/staff.js | 493 ++++++++++++++++++++++++++++- scripts/server/subaccount.js | 39 --- scripts/server/vehicle.js | 18 +- 15 files changed, 1198 insertions(+), 127 deletions(-) diff --git a/scripts/server/business.js b/scripts/server/business.js index 35ca8d37..911a4c9a 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -136,6 +136,15 @@ function loadBusinessGameScriptsFromDatabase(businessId) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function createBusinessCommand(command, params, client) { let tempBusinessData = createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].Business, getGameConfig().blipSprites[getServerGame()].Business, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorCutscene); tempBusinessData.needsSaved = true; @@ -154,6 +163,15 @@ function createBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function createBusinessLocationCommand(command, params, client) { if(!isPlayerSpawned(client)) { messagePlayerError(client, "You must be spawned to use this command!"); @@ -204,6 +222,15 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteBusinessCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -222,6 +249,15 @@ function deleteBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteBusinessLocationCommand(command, params, client) { //let businessId = toInteger(getParam(params, " ", 2)); //deleteBusinessLocation(businessId); @@ -230,6 +266,15 @@ function deleteBusinessLocationCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessNameCommand(command, params, client) { let newBusinessName = toString(params); @@ -241,7 +286,7 @@ function setBusinessNameCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change the name of this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -254,6 +299,15 @@ function setBusinessNameCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessOwnerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -274,7 +328,7 @@ function setBusinessOwnerCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change the owner of this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -287,6 +341,15 @@ function setBusinessOwnerCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessJobCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -307,7 +370,7 @@ function setBusinessJobCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change the owner of this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -320,6 +383,15 @@ function setBusinessJobCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessClanCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -336,7 +408,7 @@ function setBusinessClanCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't give this business to a clan!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -349,6 +421,15 @@ function setBusinessClanCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessRankCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -360,7 +441,7 @@ function setBusinessRankCommand(command, params, client) { let rankId = params; if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change this business rank level!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -420,7 +501,7 @@ function setBusinessRankCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change this business rank!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -437,6 +518,15 @@ function setBusinessRankCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessJobCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -470,6 +560,15 @@ function setBusinessJobCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessPublicCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -491,6 +590,15 @@ function setBusinessPublicCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function removeBusinessOwnerCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -512,6 +620,15 @@ function removeBusinessOwnerCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function lockUnlockBusinessCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -525,7 +642,7 @@ function lockUnlockBusinessCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change this business rank!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -569,6 +686,15 @@ function lockUnlockBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessEntranceFeeCommand(command, params, client) { let entranceFee = toInteger(getParam(params, " ", 1)) || 0; let businessId = getPlayerBusiness(client); @@ -579,7 +705,7 @@ function setBusinessEntranceFeeCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change the entrance fee for this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -590,6 +716,15 @@ function setBusinessEntranceFeeCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getBusinessInfoCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -631,6 +766,15 @@ function getBusinessInfoCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getBusinessFloorItemsCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -648,6 +792,15 @@ function getBusinessFloorItemsCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getBusinessStorageItemsCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -665,6 +818,15 @@ function getBusinessStorageItemsCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessPickupCommand(command, params, client) { let typeParam = getParam(params, " ", 1) || "business"; let businessId = getPlayerBusiness(client); @@ -701,6 +863,15 @@ function setBusinessPickupCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessInteriorTypeCommand(command, params, client) { let typeParam = getParam(params, " ", 1) || "business"; let businessId = getPlayerBusiness(client); @@ -758,6 +929,15 @@ function setBusinessInteriorTypeCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessBlipCommand(command, params, client) { let typeParam = getParam(params, " ", 1) || "business"; let businessId = getPlayerBusiness(client); @@ -794,6 +974,15 @@ function setBusinessBlipCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function giveDefaultItemsToBusinessCommand(command, params, client) { let typeParam = getParam(params, " ", 1) || "business"; let businessId = getPlayerBusiness(client); @@ -836,6 +1025,15 @@ function giveDefaultItemsToBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessEntranceLabelToDealershipCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -851,6 +1049,15 @@ function setBusinessEntranceLabelToDealershipCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteBusinessFloorItemsCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -871,6 +1078,15 @@ function deleteBusinessFloorItemsCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteBusinessStorageItemsCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -891,6 +1107,15 @@ function deleteBusinessStorageItemsCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function withdrawFromBusinessCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -906,7 +1131,7 @@ function withdrawFromBusinessCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't withdraw cash from this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -925,6 +1150,15 @@ function withdrawFromBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessBuyPriceCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -940,7 +1174,7 @@ function setBusinessBuyPriceCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't change the purchase price for this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -958,6 +1192,15 @@ function setBusinessBuyPriceCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function depositIntoBusinessCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -993,6 +1236,15 @@ function depositIntoBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function orderItemForBusinessCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1026,7 +1278,7 @@ function orderItemForBusinessCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't order items for this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -1045,6 +1297,15 @@ function orderItemForBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function orderItemForBusiness(businessId, itemType, amount) { if(getBusinessData(businessId).till < orderTotalCost) { let neededAmount = orderTotalCost-getBusinessData(businessId).till; @@ -1059,6 +1320,15 @@ function orderItemForBusiness(businessId, itemType, amount) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function viewBusinessTillAmountCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -1072,7 +1342,7 @@ function viewBusinessTillAmountCommand(command, params, client) { } if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, "You can't see the till amount for this business!"); + messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); return false; } @@ -1081,6 +1351,15 @@ function viewBusinessTillAmountCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function buyBusinessCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -1111,6 +1390,15 @@ function buyBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function moveBusinessEntranceCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -1142,6 +1430,15 @@ function moveBusinessEntranceCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function moveBusinessExitCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -1615,6 +1912,15 @@ function deleteBusinessExitBlip(businessId) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function reloadAllBusinessesCommand(command, params, client) { let clients = getClients(); for(let i in clients) { @@ -1638,7 +1944,7 @@ function reloadAllBusinessesCommand(command, params, client) { setAllBusinessIndexes(); cacheAllBusinessItems(); - messageAdminAction(`All businesses have been reloaded by an admin!`); + announceAdminAction(`All businesses have been reloaded by an admin!`); } // =========================================================================== @@ -1679,6 +1985,15 @@ function addToBusinessInventory(businessId, itemType, amount, buyPrice) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function buyFromBusinessCommand(command, params, client) { let businessId = getPlayerBusiness(client); @@ -1780,6 +2095,15 @@ function buyFromBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setBusinessItemSellPriceCommand(command, params, client) { let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client); @@ -1814,6 +2138,15 @@ function setBusinessItemSellPriceCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function storeItemInBusinessStorageCommand(command, params, client) { let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client); @@ -1849,6 +2182,15 @@ function storeItemInBusinessStorageCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function stockItemOnBusinessFloorCommand(command, params, client) { let businessId = getPlayerBusiness(client); diff --git a/scripts/server/client.js b/scripts/server/client.js index 93c85b31..5271e7b7 100644 --- a/scripts/server/client.js +++ b/scripts/server/client.js @@ -1068,13 +1068,6 @@ function sendPlayerPedPartsAndProps(client) { // =========================================================================== -function forcePlayerWantedLevel(client, wantedLevel) { - sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel); - return true; -} - -// =========================================================================== - function onPlayerNearPickup(client, pickupId) { getPlayerData(client).currentPickup = getElementFromId(pickupId); } diff --git a/scripts/server/command.js b/scripts/server/command.js index 0b5058f5..eecd5a96 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -432,25 +432,25 @@ function loadCommands() { commandData("dn", teleportDownCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you downward a certain distance in meters."), commandData("int", playerInteriorCommand, " [interior id]", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's game interior."), commandData("vw", playerVirtualWorldCommand, " [virtual world id]", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's virtual world/dimension."), - commandData("addstaffflag", addStaffFlagCommand, " ", getStaffFlagValue("ManageAdmins"), true, true, "Gives a player a staff flag by name (this server only)."), - commandData("delstaffflag", takeStaffFlagCommand, " ", getStaffFlagValue("ManageAdmins"), true, true, "Takes a player's staff flag by name (this server only)."), - commandData("getstaffflags", getStaffFlagsCommand, "", getStaffFlagValue("ManageAdmins"), true, true, "Shows a list of all staff flags a player has (this server only)."), - commandData("clearstaffflags", clearStaffFlagsCommand, "", getStaffFlagValue("ManageAdmins"), true, true, "Removes all staff flags for a player (this server only)."), - commandData("staffflags", allStaffFlagsCommand, "", getStaffFlagValue("ManageAdmins"), true, true, "Shows a list of all valid staff flag names."), + commandData("addstaffflag", addPlayerStaffFlagCommand, " ", getStaffFlagValue("ManageAdmins"), true, true, "Gives a player a staff flag by name (this server only)."), + commandData("delstaffflag", removePlayerStaffFlagCommand, " ", getStaffFlagValue("ManageAdmins"), true, true, "Takes a player's staff flag by name (this server only)."), + commandData("getstaffflags", getPlayerStaffFlagsCommand, "", getStaffFlagValue("ManageAdmins"), true, true, "Shows a list of all staff flags a player has (this server only)."), + commandData("clearstaffflags", removePlayerStaffFlagsCommand, "", getStaffFlagValue("ManageAdmins"), true, true, "Removes all staff flags for a player (this server only)."), + commandData("staffflags", getStaffFlagsCommand, "", getStaffFlagValue("ManageAdmins"), true, true, "Shows a list of all valid staff flag names."), commandData("givemoney", givePlayerMoneyCommand, " ", getStaffFlagValue("serverManager"), true, true), commandData("nonrpname", forceCharacterNameChangeCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Forces a player to change their current character's name."), - commandData("setname", forceCharacterNameCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's name directly."), - commandData("setskin", forcePlayerSkinCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's skin."), - commandData("setaccent", forcePlayerAccentCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's accent."), - commandData("setfightstyle", forceFightStyleCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's fight style."), - commandData("setstars", forcePlayerWantedLevelCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Forces a player to have a wanted level"), + commandData("setname", setCharacterNameCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's name directly."), + commandData("setskin", setPlayerSkinCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's skin."), + commandData("setaccent", setPlayerAccentCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's accent."), + //commandData("setfightstyle", setPlayerFightStyleCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Changes a character's fight style."), + commandData("setstars", setPlayerWantedLevelCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Forces a player to have a wanted level"), commandData("plrinfo", getPlayerInfoCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows basic info about the specified player"), - commandData("getplrhouse", getAllHousesOwnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows a list of all houses owned by the player"), - commandData("getplrbiz", getAllBusinessesOwnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows a list of all businesses owned by the player"), - commandData("getplrveh", getAllVehiclesOwnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows a list of all vehicles owned by the player"), + commandData("getplrhouse", getHousesOwnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows a list of all houses owned by the player"), + commandData("getplrbiz", getBusinessesOwnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows a list of all businesses owned by the player"), + commandData("getplrveh", getVehiclesOwnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Shows a list of all vehicles owned by the player"), commandData("geoip", getPlayerGeoIPInformationCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Retrieves GeoIP information on a player (country & city)"), commandData("ip", getPlayerIPInformationCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Retrieves IP information on a player"), - commandData("plrsync", toggleSyncForElementsSpawnedByPlayer, "", getStaffFlagValue("BasicModeration"), true, true, "Sets whether elements spawned by a player are synced (traffic, peds, etc)"), + commandData("plrsync", toggleSyncForElementsSpawnedByPlayerCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Sets whether elements spawned by a player are synced (traffic, peds, etc)"), commandData("health", setPlayerHealthCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Sets a player's armour"), commandData("infiniterun", setPlayerInfiniteRunCommand, " ", getStaffFlagValue("BasicModeration"), true, true, "Toggles a player's infinite sprint"), @@ -512,10 +512,20 @@ function loadCommands() { commandData("vehrespawn", respawnVehicleCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns your current vehicle"), commandData("vehreloadall", reloadAllVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Deletes and reloads all vehicles from database"), + commandData("carrespawnall", respawnAllVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all vehicles (also respawns all traffic vehicles)"), + commandData("carrespawnempty", respawnEmptyVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all empty/unoccupied vehicles"), + commandData("carrespawnjob", respawnJobVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all job vehicles"), + commandData("carrespawnplr", respawnPlayerVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all player-owned vehicles"), + commandData("carrespawnclan", respawnClanVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all clan-owned vehicles"), + commandData("carrespawnpublic", respawnPublicVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all public vehicles"), + commandData("carrespawnbiz", respawnBusinessVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns all business-owned vehicles"), + commandData("carrespawn", respawnVehicleCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Respawns your current vehicle"), + commandData("carreloadall", reloadAllVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true, "Deletes and reloads all vehicles from database"), + commandData("vehrent", rentVehicleCommand, "", getStaffFlagValue("None"), true, true, "Starts renting your current vehicle (if rentable)"), commandData("vehrentprice", setVehicleRentPriceCommand, "", getStaffFlagValue("None"), true, true, "Sets your vehicle's rent price"), commandData("vehbuyprice", setVehicleBuyPriceCommand, "", getStaffFlagValue("None"), true, true, "Sets your vehicle's rent price"), - commandData("stoprent", stopRentingVehicleCommand, "", getStaffFlagValue("None"), true, true, "Stops renting your vehicle"), + commandData("vehstoprent", stopRentingVehicleCommand, "", getStaffFlagValue("None"), true, true, "Stops renting your vehicle"), commandData("vehbuy", buyVehicleCommand, "", getStaffFlagValue("None"), true, true, "Purchases your vehicle"), commandData("vehcolour", vehicleAdminColourCommand, " ", getStaffFlagValue("None"), true, true, "Sets a vehicle's colour"), commandData("vehlivery", vehicleAdminLiveryCommand, "", getStaffFlagValue("None"), true, true, "Sets your vehicle's livery/paintjob"), diff --git a/scripts/server/config.js b/scripts/server/config.js index 65c45e28..93b4c76a 100644 --- a/scripts/server/config.js +++ b/scripts/server/config.js @@ -300,7 +300,7 @@ function setTimeCommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} set the time to ${makeReadableTime(hour, minute)}`); + announceAdminAction("ServerTimeSet", getPlayerName(client), makeReadableTime(hour, minute)); return true; } @@ -328,7 +328,7 @@ function setMinuteDurationCommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} set the minute duration to ${minuteDuration}ms`); + announceAdminAction("ServerMinuteDurationSet", getPlayerName(client), makeReadableTime(hour, minute)); return true; } @@ -361,7 +361,7 @@ function setWeatherCommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]}`); + announceAdminAction("ServerTimeSet", getPlayerName(client), getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]); updateServerRules(); return true; } @@ -394,7 +394,7 @@ function setSnowingCommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned falling snow ${getBoolRedGreenInlineColour(falling)}${getOnOffFromBool(falling)} {MAINCOLOUR}and ground snow ${getBoolRedGreenInlineColour(ground)}${getOnOffFromBool(ground)}`); + announceAdminAction("ServerSnowSet", getPlayerName(client), `${getBoolRedGreenInlineColour(falling)}${getOnOffFromBool(falling)}`, `${getBoolRedGreenInlineColour(ground)}${getOnOffFromBool(ground)}`); updateServerRules(); return true; } @@ -430,7 +430,7 @@ function setServerGUIColoursCommand(command, params, client) { getServerConfig().needsSaved = true; - //messageAdminAction(`${getPlayerName(client)} ${getInlineChatColourByName("orange")}set the server ${getBoolRedGreenInlineColour(fallingSnow)}${getOnOffFromBool(fallingSnow)} ${getInlineChatColourByName("orange")}and ground snow ${getBoolRedGreenInlineColour(groundSnow)}${getOnOffFromBool(groundSnow)}`); + //announceAdminAction(`${getPlayerName(client)} ${getInlineChatColourByName("orange")}set the server ${getBoolRedGreenInlineColour(fallingSnow)}${getOnOffFromBool(fallingSnow)} ${getInlineChatColourByName("orange")}and ground snow ${getBoolRedGreenInlineColour(groundSnow)}${getOnOffFromBool(groundSnow)}`); //updateServerRules(); return true; } @@ -452,7 +452,7 @@ function toggleServerLogoCommand(command, params, client) { updatePlayerShowLogoState(null, getServerConfig().useLogo); - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`); updateServerRules(); return true; } @@ -472,7 +472,7 @@ function toggleServerLogoCommand(command, params, client) { getServerConfig().createJobBlips = !getServerConfig().createJobBlips; getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`); resetAllJobBlips(); return true; } @@ -492,7 +492,7 @@ function toggleServerLogoCommand(command, params, client) { getServerConfig().createJobPickups = !getServerConfig().createJobPickups; getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`); resetAllJobPickups(); return true; } @@ -512,7 +512,7 @@ function toggleServerLogoCommand(command, params, client) { getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips; getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`); resetAllBusinessBlips(); return true; } @@ -532,7 +532,7 @@ function toggleServerLogoCommand(command, params, client) { getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups; getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`); resetAllBusinessPickups(); return true; } @@ -552,7 +552,7 @@ function toggleServerLogoCommand(command, params, client) { getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips; getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`); resetAllHouseBlips(); return true; } @@ -572,7 +572,7 @@ function toggleServerLogoCommand(command, params, client) { getServerConfig().createHousePickups = !getServerConfig().createHousePickups; getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`); resetAllHousePickups(); return true; } @@ -593,7 +593,7 @@ function toggleServerGUICommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`); updateServerRules(); return true; } @@ -614,7 +614,7 @@ function toggleServerUseRealWorldTimeCommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`); updateServerGameTime(); updateServerRules(); return true; @@ -640,7 +640,7 @@ function setServerRealWorldTimeZoneCommand(command, params, client) { getServerConfig().realTimeZone = toInteger(params); getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}set the time zone for in-game's real-world time to GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)}`); + announceAdminAction(`${getPlayerName(client)} {MAINCOLOUR}set the time zone for in-game's real-world time to GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)}`); updateServerGameTime(); updateServerRules(); return true; diff --git a/scripts/server/developer.js b/scripts/server/developer.js index ac348dcb..7870fd38 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -152,7 +152,7 @@ function addLogLevelCommand(command, params, client) { sendPlayerLogLevel(null, logLevel); - messageAdminAction(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}enabled log level {ALTCOLOUR}${toLowerCase(params)}`); + announceAdminAction(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}enabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -222,7 +222,7 @@ function removeLogLevelCommand(command, params, client) { sendPlayerLogLevel(null, logLevel); - messageAdminAction(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}disabled log level {ALTCOLOUR}${toLowerCase(params)}`); + announceAdminAction(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}disabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -380,7 +380,7 @@ function setPlayerTesterStatusCommand(command, params, client) { let enabled = hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester")); - messageAdminAction(`{ALTCOLOUR}${client.name} ${getBoolRedGreenInlineColour(enabled)}${toUpperCase(getEnabledDisabledFromBool(enabled))} {ALTCOLOUR}${targetClient.name}'s {MAINCOLOUR}tester status`) + announceAdminAction(`{ALTCOLOUR}${client.name} ${getBoolRedGreenInlineColour(enabled)}${toUpperCase(getEnabledDisabledFromBool(enabled))} {ALTCOLOUR}${targetClient.name}'s {MAINCOLOUR}tester status`) return true; } diff --git a/scripts/server/economy.js b/scripts/server/economy.js index 56abfc4b..91b742d5 100644 --- a/scripts/server/economy.js +++ b/scripts/server/economy.js @@ -127,7 +127,7 @@ function setPayDayBonusMultiplier(command, params, client) { getGlobalConfig().economy.grossIncomeMultiplier = newMultiplier; - messageAdminAction(`${client.name} set payday bonus to ${newMultiplier*100}%`); + announceAdminAction(`${client.name} set payday bonus to ${newMultiplier*100}%`); } // =========================================================================== diff --git a/scripts/server/house.js b/scripts/server/house.js index 58ef5721..975ab731 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -219,7 +219,7 @@ function setHouseOwnerCommand(command, params, client) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) { if(getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { - messagePlayerError(client, "You don't own this house!"); + messagePlayerError(client, getLocaleString(client, "CantModifyHouse")); return false; } } @@ -259,7 +259,7 @@ function setHouseClanCommand(command, params, client) { if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) { if(getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { - messagePlayerError(client, "You don't own this house!"); + messagePlayerError(client, getLocaleString(client, "CantModifyHouse")); return false; } } @@ -305,7 +305,7 @@ function setHouseClanCommand(command, params, client) { } if(doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) { - messagePlayerError(client, "You can't set clan house ranks!"); + messagePlayerError(client, getLocaleString(client, "CantModifyHouse")); return false; } @@ -496,7 +496,7 @@ function moveHouseEntranceCommand(command, params, client) { let houseId = getPlayerHouse(client); if(!getHouseData(houseId)) { - messagePlayer(client, "You need to be near or inside a house!"); + messagePlayer(client, getLocaleString(client, "InvalidHouse")); return false; } @@ -532,7 +532,7 @@ function moveHouseExitCommand(command, params, client) { let houseId = getPlayerHouse(client); if(!getHouseData(houseId)) { - messagePlayer(client, "You need to be near or inside a house!"); + messagePlayer(client, getLocaleString(client, "InvalidHouse")); return false; } @@ -994,6 +994,15 @@ function getHouseOwnerTypeText(ownerType) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getHouseInfoCommand(command, params, client) { let houseId = getPlayerHouse(client); @@ -1035,6 +1044,15 @@ function getHouseInfoCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setHouseBuyPriceCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1063,6 +1081,15 @@ function setHouseBuyPriceCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setHouseRentPriceCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1091,6 +1118,15 @@ function setHouseRentPriceCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function buyHouseCommand(command, params, client) { let houseId = getPlayerHouse(client); @@ -1200,6 +1236,15 @@ function deleteHouseExitBlip(houseId) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function reloadAllHousesCommand(command, params, client) { let clients = getClients(); for(let i in clients) { @@ -1220,7 +1265,7 @@ function reloadAllHousesCommand(command, params, client) { createAllHousePickups(); createAllHouseBlips(); - messageAdminAction(`All houses have been reloaded by an admin!`); + announceAdminAction(`All houses have been reloaded by an admin!`); } // =========================================================================== diff --git a/scripts/server/item.js b/scripts/server/item.js index 5707d0ec..daa03222 100644 --- a/scripts/server/item.js +++ b/scripts/server/item.js @@ -132,6 +132,15 @@ function deleteGroundItemObject(itemId) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function createGroundItemCommand(command, params, client) { let splitParams = params.split(" "); let itemType = getItemTypeFromParams(splitParams.slice(0, -1).join(" ")); @@ -154,6 +163,15 @@ function createGroundItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function createItemCommand(command, params, client) { let splitParams = params.split(" "); let itemType = getItemTypeFromParams(splitParams.slice(0, -1).join(" ")); @@ -176,6 +194,15 @@ function createItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function useItemCommand(command, params, client) { clearPlayerItemActionState(client); @@ -230,6 +257,15 @@ function useItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteGroundItemCommand(command, params, client) { let itemId = getClosestItemOnGround(getPlayerPosition(client)); @@ -252,6 +288,15 @@ function deleteGroundItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function pickupItemCommand(command, params, client) { clearPlayerItemActionState(client); @@ -303,6 +348,15 @@ function pickupItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function dropItemCommand(command, params, client) { clearPlayerItemActionState(client); @@ -364,6 +418,15 @@ function dropItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function putItemCommand(command, params, client) { clearPlayerItemActionState(client); @@ -411,6 +474,15 @@ function putItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function takeItemCommand(command, params, client) { clearPlayerItemActionState(client); @@ -458,6 +530,15 @@ function takeItemCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function createItemTypeCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -470,6 +551,15 @@ function createItemTypeCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setItemTypeDropModelCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -490,6 +580,15 @@ function setItemTypeDropModelCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setItemTypeOrderPriceCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -510,6 +609,15 @@ function setItemTypeOrderPriceCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setItemTypeRiskMultiplierCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -530,6 +638,15 @@ function setItemTypeRiskMultiplierCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function toggleItemTypeEnabledCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -549,6 +666,15 @@ function toggleItemTypeEnabledCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setItemTypeUseTypeCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -569,6 +695,15 @@ function setItemTypeUseTypeCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setItemTypeUseValueCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1105,6 +1240,15 @@ function playerSwitchItem(client, newHotBarSlot) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function playerSwitchHotBarSlotCommand(command, params, client) { clearPlayerItemActionState(client); @@ -1394,12 +1538,30 @@ function getBestItemToTake(client, slot) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function listPlayerInventoryCommand(command, params, client) { showPlayerInventoryToPlayer(client, client); } // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function listBusinessStorageInventoryCommand(command, params, client) { let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); @@ -1418,6 +1580,15 @@ function listBusinessStorageInventoryCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function listBusinessFloorInventoryCommand(command, params, client) { let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); @@ -1436,6 +1607,15 @@ function listBusinessFloorInventoryCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function listHouseInventoryCommand(command, params, client) { let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)); @@ -1454,6 +1634,15 @@ function listHouseInventoryCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function listItemInventoryCommand(command, params, client) { let itemId = getClosestItemOnGround(getPlayerPosition(client)); @@ -1797,6 +1986,15 @@ function getPlayerFirstItemSlotByUseType(client, useType) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function toggleItemEnabledCommand(command, params, client) { if(!getPlayerActiveItem(client)) { messagePlayerError(client, `You aren't holding anything!`); @@ -1814,6 +2012,15 @@ function toggleItemEnabledCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteItemInPlayerInventoryCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1855,6 +2062,15 @@ function deleteItemInPlayerInventoryCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function deleteAllItemsInPlayerInventoryCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); diff --git a/scripts/server/job.js b/scripts/server/job.js index 02b35637..91b04311 100644 --- a/scripts/server/job.js +++ b/scripts/server/job.js @@ -942,7 +942,7 @@ function reloadAllJobsCommand(command, params, client) { } } - messageAdminAction(`All server jobs have been reloaded by an admin!`); + announceAdminAction(`All server jobs have been reloaded by an admin!`); } // =========================================================================== diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js index e05b4ff8..e45e5dca 100644 --- a/scripts/server/messaging.js +++ b/scripts/server/messaging.js @@ -14,7 +14,7 @@ function initMessagingScript() { // =========================================================================== -function messageAdminAction(messageText) { +function announceAdminAction(messageText) { messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange")); if(getServerConfig().discordEnabled) { messageDiscord(`:warning: ${messageText}`); diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js index 20522e9c..45102cd0 100644 --- a/scripts/server/native/connected.js +++ b/scripts/server/native/connected.js @@ -1031,4 +1031,11 @@ function givePlayerWeapon(client, weaponId, ammo, active = true) { sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active); } +// =========================================================================== + +function setPlayerWantedLevel(client, wantedLevel) { + sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel); + return true; +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/radio.js b/scripts/server/radio.js index 3a3ca7a4..5a31d128 100644 --- a/scripts/server/radio.js +++ b/scripts/server/radio.js @@ -41,6 +41,15 @@ function loadRadioStationsFromDatabase() { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function playStreamingRadioCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -145,6 +154,15 @@ function playStreamingRadioCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setStreamingRadioVolumeCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -185,6 +203,15 @@ function getPlayerStreamingRadioVolume(client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function showRadioStationListCommand(command, params, client) { let stationList = getServerData().radioStations.map(function(x) { return `{ALTCOLOUR}${toInteger(x.index)+1}: {MAINCOLOUR}${x.name}`; }); @@ -213,13 +240,22 @@ function getRadioStationData(radioStationId) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function reloadAllRadioStationsCommand(command, params, client) { stopRadioStreamForPlayer(null); clearArray(getServerData().radioStations); getServerData().radioStations = loadRadioStationsFromDatabase(); setRadioStationIndexes(); - messageAdminAction(`All radio stations have been reloaded by an admin!`); + announceAdminAction(`All radio stations have been reloaded by an admin!`); } // =========================================================================== diff --git a/scripts/server/staff.js b/scripts/server/staff.js index e25cd017..538383b1 100644 --- a/scripts/server/staff.js +++ b/scripts/server/staff.js @@ -14,6 +14,15 @@ function initStaffScript() { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function kickClientCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -34,12 +43,21 @@ function kickClientCommand(command, params, client) { } } - messageAdminAction(`${getPlayerName(targetClient)} has been kicked from the server.`); + announceAdminAction(`${getPlayerName(targetClient)} has been kicked from the server.`); targetClient.disconnect(); } // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setStaffTitleCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -71,6 +89,15 @@ function setStaffTitleCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function muteClientCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -97,8 +124,16 @@ function muteClientCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function unMuteClientCommand(command, params, client) { - if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -124,6 +159,15 @@ function unMuteClientCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function freezeClientCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -151,6 +195,15 @@ function freezeClientCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function unFreezeClientCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -178,6 +231,15 @@ function unFreezeClientCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -210,6 +272,15 @@ function gotoPlayerCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getPlayerGeoIPInformationCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -231,6 +302,15 @@ function getPlayerGeoIPInformationCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getPlayerIPInformationCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -248,6 +328,15 @@ function getPlayerIPInformationCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoVehicleCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -278,6 +367,15 @@ function gotoVehicleCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getVehicleCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -299,6 +397,15 @@ function getVehicleCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function warpIntoVehicleCommand(command, params, client) { let vehicle = getClosestVehicle(getPlayerPosition(client)); @@ -329,6 +436,15 @@ function warpIntoVehicleCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoBusinessCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -360,6 +476,15 @@ function gotoBusinessCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoGameLocationCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -391,6 +516,15 @@ function gotoGameLocationCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoHouseCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -422,6 +556,15 @@ function gotoHouseCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoJobLocationCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -453,6 +596,15 @@ function gotoJobLocationCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoNewPlayerSpawnCommand(command, params, client) { client.player.velocity = toVector3(0.0, 0.0, 0.0); setPlayerPosition(client, getServerConfig().newCharacter.spawnPosition); @@ -465,6 +617,15 @@ function gotoNewPlayerSpawnCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function gotoPositionCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -489,6 +650,15 @@ function gotoPositionCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function teleportForwardCommand(command, params, client) { let distance = 1.0; if(!areParamsEmpty(params)) { @@ -504,6 +674,15 @@ function teleportForwardCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function teleportBackwardCommand(command, params, client) { let distance = 1.0; if(!areParamsEmpty(params)) { @@ -519,6 +698,15 @@ function teleportBackwardCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function teleportLeftCommand(command, params, client) { let distance = 1.0; if(!areParamsEmpty(params)) { @@ -534,6 +722,15 @@ function teleportLeftCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function teleportUpCommand(command, params, client) { let distance = 1.0; if(!areParamsEmpty(params)) { @@ -549,6 +746,15 @@ function teleportUpCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function teleportDownCommand(command, params, client) { let distance = 1.0; if(!areParamsEmpty(params)) { @@ -579,6 +785,15 @@ function teleportRightCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function playerInteriorCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -603,6 +818,15 @@ function playerInteriorCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function playerVirtualWorldCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -627,6 +851,15 @@ function playerVirtualWorldCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function getPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -667,6 +900,15 @@ function getPlayerCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function returnPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -705,7 +947,16 @@ function returnPlayerCommand(command, params, client) { // =========================================================================== -function addStaffFlagCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function addPlayerStaffFlagCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -738,7 +989,16 @@ function addStaffFlagCommand(command, params, client) { // =========================================================================== -function takeStaffFlagCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function removePlayerStaffFlagCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -771,7 +1031,16 @@ function takeStaffFlagCommand(command, params, client) { // =========================================================================== -function clearStaffFlagsCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function removePlayerStaffFlagsCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -798,7 +1067,16 @@ function clearStaffFlagsCommand(command, params, client) { // =========================================================================== -function getStaffFlagsCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function getPlayerStaffFlagsCommand(command, params, client) { if(getCommand(command).requireLogin) { if(!isPlayerLoggedIn(client)) { messagePlayerError(client, "You must be logged in to use this command!"); @@ -852,7 +1130,16 @@ function getStaffFlagsCommand(command, params, client) { // =========================================================================== -function allStaffFlagsCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function getStaffFlagsCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -876,6 +1163,15 @@ function allStaffFlagsCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function givePlayerMoneyCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -899,7 +1195,16 @@ function givePlayerMoneyCommand(command, params, client) { // =========================================================================== -function forcePlayerAccentCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function setPlayerAccentCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -932,6 +1237,15 @@ function forcePlayerAccentCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function forceCharacterNameChangeCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -953,7 +1267,16 @@ function forceCharacterNameChangeCommand(command, params, client) { // =========================================================================== -function forceCharacterNameCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function setCharacterNameCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -988,7 +1311,16 @@ function forceCharacterNameCommand(command, params, client) { // =========================================================================== -function forcePlayerSkinCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function setPlayerSkinCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -1021,6 +1353,15 @@ function forcePlayerSkinCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setPlayerHealthCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1048,6 +1389,15 @@ function setPlayerHealthCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setPlayerArmourCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1069,6 +1419,15 @@ function setPlayerArmourCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function setPlayerInfiniteRunCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1096,7 +1455,16 @@ function setPlayerInfiniteRunCommand(command, params, client) { // =========================================================================== -function forcePlayerWantedLevelCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function setPlayerWantedLevelCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -1110,14 +1478,23 @@ function forcePlayerWantedLevelCommand(command, params, client) { return false; } - forcePlayerWantedLevel(targetClient, wantedLevel); + setPlayerWantedLevel(targetClient, wantedLevel); //messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`); } // =========================================================================== -function getAllVehiclesOwnedByPlayerCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function getVehiclesOwnedByPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -1140,7 +1517,16 @@ function getAllVehiclesOwnedByPlayerCommand(command, params, client) { // =========================================================================== -function getAllBusinessesOwnedByPlayerCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function getBusinessesOwnedByPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -1163,7 +1549,16 @@ function getAllBusinessesOwnedByPlayerCommand(command, params, client) { // =========================================================================== -function getAllHousesOwnedByPlayerCommand(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function getHousesOwnedByPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -1186,6 +1581,15 @@ function getAllHousesOwnedByPlayerCommand(command, params, client) { // =========================================================================== +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ function forceAccountPasswordResetCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); @@ -1202,7 +1606,16 @@ function forceAccountPasswordResetCommand(command, params, client) { // =========================================================================== -function toggleSyncForElementsSpawnedByPlayer(command, params, client) { +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function toggleSyncForElementsSpawnedByPlayerCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command)); return false; @@ -1263,4 +1676,52 @@ function isPlayerPoliceBanned(client) { return false; } +// =========================================================================== + +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ +function forceFightStyleCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let targetClient = getPlayerFromParams(getParam(params, " ", 1)); + let fightStyleId = getFightStyleFromParams(getParam(params, " ", 2)); + + //if(!targetClient) { + // messagePlayerError(client, `Player not found!`); + // return false; + //} + + //if(!getPlayerData(targetClient)) { + // messagePlayerError(client, `Player not found!`); + // return false; + //} + + //if(!isPlayerSpawned(targetClient)) { + // messagePlayerError(client, `That player isn't spawned`); + // return false; + //} + + if(!fightStyleId) { + messagePlayerError(client, `That fight style doesn't exist!`); + messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`); + return false; + } + + getPlayerCurrentSubAccount(client).fightStyle = fightStyleId; + setPlayerFightStyle(client, fightStyleId); + messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`) + + return true; +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js index aff83af5..fbedad0d 100644 --- a/scripts/server/subaccount.js +++ b/scripts/server/subaccount.js @@ -548,45 +548,6 @@ function setFightStyleCommand(command, params, client) { // =========================================================================== -function forceFightStyleCommand(command, params, client) { - if(areParamsEmpty(params)) { - messagePlayerSyntax(client, getCommandSyntaxText(command)); - return false; - } - - let targetClient = getPlayerFromParams(getParam(params, " ", 1)); - let fightStyleId = getFightStyleFromParams(getParam(params, " ", 2)); - - //if(!targetClient) { - // messagePlayerError(client, `Player not found!`); - // return false; - //} - - //if(!getPlayerData(targetClient)) { - // messagePlayerError(client, `Player not found!`); - // return false; - //} - - //if(!isPlayerSpawned(targetClient)) { - // messagePlayerError(client, `That player isn't spawned`); - // return false; - //} - - if(!fightStyleId) { - messagePlayerError(client, `That fight style doesn't exist!`); - messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`); - return false; - } - - getPlayerCurrentSubAccount(client).fightStyle = fightStyleId; - setPlayerFightStyle(client, fightStyleId); - messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`) - - return true; -} - -// =========================================================================== - function createDefaultSubAccountServerData(databaseId, thisServerSkin) { for(let i = 1 ; i <= 5 ; i++) { if(i == getServerId()) { diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index bdd6b137..19e28737 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -1073,7 +1073,7 @@ function reloadAllVehiclesCommand(command, params, client) { getServerData().vehicles = loadVehiclesFromDatabase(); spawnAllVehicles(); - messageAdminAction(`All server vehicles have been reloaded by an admin!`); + announceAdminAction(`AllVehiclesReloaded`); getVehicleData(vehicle).needsSaved = true; } @@ -1088,7 +1088,7 @@ function respawnVehicleCommand(command, params, client) { setAllVehicleIndexes(); - messagePlayerSuccess(client, `Your vehicle has been respawned`); + messagePlayerSuccess(client, getLocaleString(client, `YourVehicleRespawned`)); } @@ -1106,7 +1106,7 @@ function respawnAllVehiclesCommand(command, params, client) { setAllVehicleIndexes(); - messageAdminAction(`All vehicles have been respawned by an admin!`); + announceAdminAction(`AllVehiclesRespawned`); } // =========================================================================== @@ -1125,7 +1125,7 @@ function respawnEmptyVehiclesCommand(command, params, client) { } } - messageAdminAction(`All empty vehicles have been respawned by an admin!`); + announceAdminAction(`EmptyVehiclesRespawned`); } // =========================================================================== @@ -1137,7 +1137,7 @@ function respawnJobVehiclesCommand(command, params, client) { } } - messageAdminAction(`All job vehicles have been respawned by an admin!`); + announceAdminAction(`JobVehiclesRespawned`); } // =========================================================================== @@ -1149,7 +1149,7 @@ function respawnClanVehiclesCommand(command, params, client) { } } - messageAdminAction(`All clan vehicles have been respawned by an admin!`); + announceAdminAction(`ClanVehiclesRespawned`); } // =========================================================================== @@ -1161,7 +1161,7 @@ function respawnPlayerVehiclesCommand(command, params, client) { } } - messageAdminAction(`All player-owned vehicles have been respawned by an admin!`); + announceAdminAction(`PlayerVehiclesRespawned`); } // =========================================================================== @@ -1173,7 +1173,7 @@ function respawnPublicVehiclesCommand(command, params, client) { } } - messageAdminAction(`All public vehicles have been respawned by an admin!`); + announceAdminAction(`PublicVehiclesRespawned`); } // =========================================================================== @@ -1185,7 +1185,7 @@ function respawnBusinessVehiclesCommand(command, params, client) { } } - messageAdminAction(`All business-owned vehicles have been respawned by an admin!`); + announceAdminAction(`BusinessVehiclesRespawned`); } // ===========================================================================