Locate player command

This commit is contained in:
Vortrex
2023-03-01 01:19:15 -06:00
parent b4d8acc07b
commit 3f925a4a44

View File

@@ -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))))}`))
}
// ===========================================================================