onPlayerMove

Description

This is called when a player moves on foot or as a passenger.

NameDescription
playerThe pointer of the player
oldXOld X coordinate
oldYOld Y coordinate
oldZOld Z coordinate
newXNew X coordinate
newYNew Y coordinate
newZNew Z coordinate

Example

This example will move the player back to point (0, 0, 0) if they move too far away from it.

function GetPointDistanceToPoint(x1, y1, z1, x2, y2, z2)
{
return Vector(x1-x2, y1-y2, z1-z2).Length();
}
function onPlayerMove(player, oldX, oldY, oldZ, newX, newY, newZ) {
if(GetPointDistanceToPoint(0.0, 0.0, 0.0, newX, newY, newZ) > 50.0) {
player.Pos = Vector(0.0, 0.0, 0.0);
}
}