OnPlayerMove: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
== Syntax == | == Syntax == | ||
< | <pre>function onPlayerMove( player, oldX, oldY, oldZ, newX, newY, newZ )</pre> | ||
== Parameters == | == Parameters == |
Revision as of 14:34, 8 August 2014
This is called when a player moves on foot or as a passenger.
Syntax
function onPlayerMove( player, oldX, oldY, oldZ, newX, newY, newZ )
Parameters
- 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 onPlayerMove( player, x1, y1, z1, x2, y2, z2 )
{
if ( sqrt( x2*x2 + y2*y2 + z2*z2 ) > 50 ) player.Pos = Vector( 0.0, 0.0, 0.0 );
}
Notes
The function Player.Pos was used in in this example. More info about it in the corresponding page.
Related Events
- onPlayerJoin( player )
- onPlayerPart( player, reason )
- onPlayerRequestClass( player, classID )
- onPlayerRequestSpawn( player )
- onPlayerSpawn( player )
- onPlayerDeath( player, reason )
- onPlayerKill( killer, player, reason, bodypart )
- onPlayerTeamKill( killer, player, reason, bodypart )
- onPlayerChat( player, message )
- onPlayerCommand( player, command, arguments )
- onPlayerPM( player, playerTo, message )
- onPlayerBeginTyping( player )
- onPlayerEndTyping( player )
- onLoginAttempt( playerName, password, ipAddress )
- onNameChangeable( player ) // Currently can't work.
- onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ )
- onPlayerHealthChange( player, lastHP, newHP )
- onPlayerArmourChange( player, lastArmour, newArmour )
- onPlayerWeaponChange( player, oldWep, newWep )
- onKeyDown( player, bindID )
- onKeyUp( player, bindID )
- onPlayerAwayChange( player, newStatus )
- onPlayerSpectate( player, target )
- onPlayerCrashDump( player, crashReport )
- onPlayerNameChange( player, oldName, newName )
- onPlayerActionChange( player, oldAction, newAction )
- onPlayerStateChange( player, oldState, newState )
- onPlayerOnFireChange( player, isOnFireNow )
- onPlayerCrouchChange( player, isCrouchingNow )
- onPlayerGameKeysChange( player, oldKeys, newKeys )