diff --git a/scripts/server/command.js b/scripts/server/command.js index adb3950c..13259d0a 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -202,6 +202,10 @@ function loadCommandData() { commandData("unfreeze", unFreezeClientCommand, " [reason]", getStaffFlagValue("basicModeration"), true, true), commandData("goto", gotoPlayerCommand, "", getStaffFlagValue("basicModeration"), true, true), commandData("gethere", getPlayerCommand, "", getStaffFlagValue("basicModeration"), true, true), + commandData("gotopos", gotoPositionCommand, " [int] [vw]", getStaffFlagValue("basicModeration"), true, true), + commandData("gotoveh", gotoVehicleCommand, "", getStaffFlagValue("basicModeration"), true, true), + commandData("gotojob", gotoJobLocationCommand, " ", getStaffFlagValue("basicModeration"), true, true), + //commandData("gotoloc", gotoLocationCommand, "", getStaffFlagValue("basicModeration"), true, true), commandData("fr", teleportForwardCommand, "", getStaffFlagValue("basicModeration"), true, true), commandData("ba", teleportBackwardCommand, "", getStaffFlagValue("basicModeration"), true, true), commandData("lt", teleportLeftCommand, "", getStaffFlagValue("basicModeration"), true, true), diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js index caeb41c0..5b43a524 100644 --- a/scripts/server/moderation.js +++ b/scripts/server/moderation.js @@ -210,7 +210,7 @@ function gotoPlayerCommand(command, params, client) { // --------------------------------------------------------------------------- -function teleportToVehicleCommand(command, params, client) { +function gotoVehicleCommand(command, params, client) { if(areParamsEmpty(params)) { messageClientSyntax(client, getCommandSyntaxText(command)); return false; @@ -229,6 +229,63 @@ function teleportToVehicleCommand(command, params, client) { // --------------------------------------------------------------------------- +function gotoJobLocationCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + + let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job; + + if(!getJobData(jobId)) { + messageClientError(client, `That job does not exist!`); + return false; + } + + let jobLocationId = splitParams[1] || 0; + + if(typeof getJobData(jobId).locations[jobLocationId] == "undefined") { + messageClientError(client, `That location ID does not exist!`); + return false; + } + + setPlayerPosition(client, getJobData(jobId).locations[jobLocationId].position); + setPlayerInterior(client, getJobData(jobId).locations[jobLocationId].interior); + setPlayerVirtualWorld(client, getJobData(jobId).locations[jobLocationId].dimension); + + messageClientSuccess(client, `You teleported to location [#AAAAAA]${jobLocationId} [#FFFFFF]for the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`); +} + +// --------------------------------------------------------------------------- + +function gotoPositionCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + let x = splitParams[0] || getPlayerPosition(client).x; + let y = splitParams[1] || getPlayerPosition(client).y; + let z = splitParams[2] || getPlayerPosition(client).z; + let int = splitParams[3] || getPlayerInterior(client).x; + let vw = splitParams[4] || getPlayerVirtualWorld(client); + + let newPosition = toVector3(x, y, z); + + let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job; + + setPlayerPosition(client, newPosition); + setPlayerInterior(client, int); + setPlayerVirtualWorld(client, vw); + + messageClientSuccess(client, `You teleported to coordinates [#AAAAAA]${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`); +} + +// --------------------------------------------------------------------------- + function teleportForwardCommand(command, params, client) { if(areParamsEmpty(params)) { messageClientSyntax(client, getCommandSyntaxText(command));