From a9007338af496db0960d95da39ff97b379fd5399 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 28 Feb 2023 22:36:42 -0600 Subject: [PATCH] Payphone + locate player commands --- scripts/server/command.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/scripts/server/command.js b/scripts/server/command.js index e223cb7c..ea80a420 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -496,10 +496,17 @@ function loadCommands() { paintball: [], payPhone: [ new CommandData("addpayphone", createPayPhoneCommand, "[number]", getStaffFlagValue("ManagePayPhones"), true, false, "Creates an payphone with optional number (random number if not added)"), + new CommandData("delpayphone", deletePayPhoneCommand, "[number]", getStaffFlagValue("ManagePayPhones"), true, false, "Deleted a payphone with number (optional, will use closest payphone if no number)"), new CommandData("call", callPayPhoneCommand, "", getStaffFlagValue("None"), true, false, "Calls the player (nearest payphone or their cellphone if applicable"), - new CommandData("hangup", hangupPayPhoneCommand, "", getStaffFlagValue("None"), true, false, "Ends a phone call"), - new CommandData("answer", answerPayPhoneCommand, "", getStaffFlagValue("None"), true, false, "Answer's a phone"), + new CommandData("hangup", hangupPayPhoneCommand, "", getStaffFlagValue("None"), true, false, "Ends a payphone call"), + new CommandData("answer", answerPayPhoneCommand, "", getStaffFlagValue("None"), true, false, "Answer's a ringing phone"), new CommandData("givephone", givePayPhoneToPlayerCommand, "", getStaffFlagValue("None"), true, false, "Gives a phone to another player to talk on the call"), + new CommandData("payphone", getPayPhoneNumberCommand, "", getStaffFlagValue("None"), true, false, "Shows a phone's number"), + new CommandData("number", getPayPhoneNumberCommand, "", getStaffFlagValue("None"), true, false, "Shows a phone's number"), + new CommandData("nearpayphone", getNearbyPayPhonesCommand, "[range]", getStaffFlagValue("None"), true, false, "Shows a list of all nearby phones within certain range"), + new CommandData("nearpayphones", getNearbyPayPhonesCommand, "[range]", getStaffFlagValue("None"), true, false, "Shows a list of all nearby phones within certain range"), + new CommandData("payphoneinfo", getPayPhoneInfoCommand, "[number]", getStaffFlagValue("None"), true, false, "Shows info of nearest payphone (or of payphone with number)"), + new CommandData("phoneinfo", getPayPhoneInfoCommand, "[number]", getStaffFlagValue("None"), true, false, "Shows info of nearest payphone (or of payphone with number)"), //new CommandData("callphone", callPhoneNumberCommand, "", getStaffFlagValue("None"), true, false, "Rings the payphone with number"), ], race: [ @@ -607,6 +614,7 @@ function loadCommands() { new CommandData("business", getPlayerCurrentBusinessCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Gets which business a player is at/in"), new CommandData("house", getPlayerCurrentHouseCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Gets which house a player is at/in"), //new CommandData("clearchat", clearChatCommand, "", getStaffFlagValue("None"), true, true, "Clears the chat"), + new CommandData("locate", locatePlayerCommand, "", getStaffFlagValue("None"), true, true, "Shows the distance and direction of another player"), ], startup: [], subAccount: [ @@ -1114,3 +1122,23 @@ function getPlayerAliasForCommand(client, command) { } // =========================================================================== + +/** + * @return {Array.} Array of commands usable by staff flag + */ +function getCommandsUsableByStaffFlag(flagName) { + let usableCommands = []; + + let commands = getCommands(); + for (let i in commands) { + for (let j in commands[i]) { + if (hasBitFlag(commands[i][j].requiredStaffFlags, getStaffFlagValue(flagName))) { + usableCommands.push(commands[i][j]); + } + } + } + + return usableCommands; +} + +// =========================================================================== \ No newline at end of file