From 35ec13850d948d9da9c46b72c3a533270c099a74 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 15 Mar 2021 12:32:15 -0500 Subject: [PATCH] Add gotoloc cmd handler --- scripts/server/moderation.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js index 17175927..2dde2084 100644 --- a/scripts/server/moderation.js +++ b/scripts/server/moderation.js @@ -249,6 +249,31 @@ function gotoBusinessCommand(command, params, client) { // --------------------------------------------------------------------------- +function gotoGameLocationCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let gameLocationId = getGameLocationFromParams(params) + + if(!gameLocationId) { + messagePlayerError(client, "That game location doesn't exist!"); + return false; + } + + setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0)); + setTimeout(function() { + setPlayerPosition(client, getGameData().locations[businessId][1]); + setPlayerInterior(client, 0); + setPlayerDimension(client, 0); + }, 500); + + messagePlayerSuccess(client, `You teleported to game location [#AAAAAA]${getGameData().locations[businessId][0]}`); +} + +// --------------------------------------------------------------------------- + function gotoHouseCommand(command, params, client) { if(areParamsEmpty(params)) { messagePlayerSyntax(client, getCommandSyntaxText(command));