onPlayerMove
Description
This is called when a player moves on foot or as a passenger.
| Name | Description |
|---|---|
| player | The pointer of the player |
| oldX | Old X coordinate |
| oldY | Old Y coordinate |
| oldZ | Old Z coordinate |
| newX | New X coordinate |
| newY | New Y coordinate |
| newZ | New 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); }}