Set velocity to 0 when teleporting
This commit is contained in:
@@ -188,7 +188,7 @@ function gotoPlayerCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//message(`[#996600][ADMIN]: [#FFFFFF]${toString(targetClient.name)} has been un-frozen by an admin!`);
|
//message(`[#996600][ADMIN]: [#FFFFFF]${toString(targetClient.name)} has been un-frozen by an admin!`);
|
||||||
|
client.player.velocity = toVector3(0.0, 0.0, 0.0);
|
||||||
triggerNetworkEvent("ag.position", client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2));
|
triggerNetworkEvent("ag.position", client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2));
|
||||||
triggerNetworkEvent("ag.heading", client, getPlayerHeading(targetClient));
|
triggerNetworkEvent("ag.heading", client, getPlayerHeading(targetClient));
|
||||||
|
|
||||||
@@ -222,6 +222,7 @@ function gotoVehicleCommand(command, params, client) {
|
|||||||
|
|
||||||
let vehicle = getServerData().vehicles[toInteger(params)].vehicle;
|
let vehicle = getServerData().vehicles[toInteger(params)].vehicle;
|
||||||
|
|
||||||
|
client.player.velocity = toVector3(0.0, 0.0, 0.0);
|
||||||
triggerNetworkEvent("ag.position", client, getPosAbovePos(getVehiclePosition(vehicle), 3.0));
|
triggerNetworkEvent("ag.position", client, getPosAbovePos(getVehiclePosition(vehicle), 3.0));
|
||||||
|
|
||||||
messageClientSuccess(client, `You teleported to vehicle [#AAAAAA]${toInteger(params)}`);
|
messageClientSuccess(client, `You teleported to vehicle [#AAAAAA]${toInteger(params)}`);
|
||||||
@@ -251,6 +252,7 @@ function gotoJobLocationCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.player.velocity = toVector3(0.0, 0.0, 0.0);
|
||||||
setPlayerPosition(client, getJobData(jobId).locations[jobLocationId].position);
|
setPlayerPosition(client, getJobData(jobId).locations[jobLocationId].position);
|
||||||
setPlayerInterior(client, getJobData(jobId).locations[jobLocationId].interior);
|
setPlayerInterior(client, getJobData(jobId).locations[jobLocationId].interior);
|
||||||
setPlayerVirtualWorld(client, getJobData(jobId).locations[jobLocationId].dimension);
|
setPlayerVirtualWorld(client, getJobData(jobId).locations[jobLocationId].dimension);
|
||||||
@@ -266,20 +268,21 @@ function gotoPositionCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.replace(",", "").split(" ");
|
||||||
let x = splitParams[0] || getPlayerPosition(client).x;
|
let x = splitParams[0] || getPlayerPosition(client).x;
|
||||||
let y = splitParams[1] || getPlayerPosition(client).y;
|
let y = splitParams[1] || getPlayerPosition(client).y;
|
||||||
let z = splitParams[2] || getPlayerPosition(client).z;
|
let z = splitParams[2] || getPlayerPosition(client).z;
|
||||||
let int = splitParams[3] || getPlayerInterior(client).x;
|
let int = splitParams[3] || getPlayerInterior(client);
|
||||||
let vw = splitParams[4] || getPlayerVirtualWorld(client);
|
let vw = splitParams[4] || getPlayerVirtualWorld(client);
|
||||||
|
|
||||||
let newPosition = toVector3(x, y, z);
|
let newPosition = toVector3(Number(x), Number(y), Number(z));
|
||||||
|
|
||||||
let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job;
|
let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job;
|
||||||
|
|
||||||
|
client.player.velocity = toVector3(0.0, 0.0, 0.0);
|
||||||
setPlayerPosition(client, newPosition);
|
setPlayerPosition(client, newPosition);
|
||||||
setPlayerInterior(client, int);
|
setPlayerInterior(client, Number(int));
|
||||||
setPlayerVirtualWorld(client, vw);
|
setPlayerVirtualWorld(client, Number(vw));
|
||||||
|
|
||||||
messageClientSuccess(client, `You teleported to coordinates [#AAAAAA]${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`);
|
messageClientSuccess(client, `You teleported to coordinates [#AAAAAA]${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`);
|
||||||
}
|
}
|
||||||
@@ -292,7 +295,7 @@ function teleportForwardCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerNetworkEvent("ag.position", client, getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
|
setPlayerPosition(client, getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
|
||||||
|
|
||||||
messageClientSuccess(client, `You teleported forward ${params} meters`);
|
messageClientSuccess(client, `You teleported forward ${params} meters`);
|
||||||
}
|
}
|
||||||
@@ -305,7 +308,7 @@ function teleportBackwardCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerNetworkEvent("ag.position", client, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), params));
|
setPlayerPosition(client, getPosBehindPos(getPlayerPosition(client), getPlayerHeading(client), params));
|
||||||
|
|
||||||
messageClientSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`);
|
messageClientSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||||
}
|
}
|
||||||
@@ -318,7 +321,7 @@ function teleportLeftCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerNetworkEvent("ag.position", client, getPosToLeftOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
|
setPlayerPosition(client, getPosToLeftOfPos(getPlayerPosition(client), getPlayerHeading(client), params));
|
||||||
|
|
||||||
messageClientSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`);
|
messageClientSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||||
}
|
}
|
||||||
@@ -331,7 +334,7 @@ function teleportUpCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerNetworkEvent("ag.position", client, getPosAbovePos(getPlayerPosition(client), params));
|
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), params));
|
||||||
|
|
||||||
messageClientSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`);
|
messageClientSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user