From 3f925a4a442c2ea1ce0c4e8a0ac463cbcf2c63a9 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 1 Mar 2023 01:19:15 -0600 Subject: [PATCH] Locate player command --- scripts/server/misc.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/server/misc.js b/scripts/server/misc.js index ae33a5ed..cebb1de4 100644 --- a/scripts/server/misc.js +++ b/scripts/server/misc.js @@ -1023,4 +1023,32 @@ function scoreBoardCommand(command, params, client) { return false; } +// =========================================================================== + +function locatePlayerCommand(client) { + if (isPlayerSpawned(client)) { + messagePlayerError(client, getLocaleString(client, "MustBeSpawned")); + return false; + } + + if (areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let targetClient = getPlayerFromParams(client); + + if (!targetClient) { + messagePlayerError(client, getLocaleString(client, "InvalidPlayer")); + return false; + } + + if (isPlayerSpawned(targetClient)) { + messagePlayerError(client, getLocaleString(client, "InvalidPlayer")); + return false; + } + + messagePlayerInfo(client, getLocaleString(client, "PlayerLocateDistanceAndDirection", `{ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR}`, `{ALTCOLOUR}${getDistance(getPlayerPosition(client), getPlayerPosition(targetClient))}{MAINCOLOUR}`, `{ALTCOLOUR}${getLocaleString(client, getCardinalDirectionName(getCardinalDirection(getPlayerPosition(client), getPlayerPosition(targetClient))))}`)) +} + // =========================================================================== \ No newline at end of file