Add gotopos, gotoveh, gotojob cmds
This commit is contained in:
@@ -202,6 +202,10 @@ function loadCommandData() {
|
||||
commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("basicModeration"), true, true),
|
||||
//commandData("gotoloc", gotoLocationCommand, "<location name>", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
|
||||
commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user