Skip to main content

Player::taskLookAt

Not available on SYNC MP yet

This member is part of the RAGE:MP API but SYNC MP does not implement it yet (Client-side JavaScript). Calling it does nothing or throws.

Method to task player to look at another entity. Client-side tasks are synced.

Syntax​

player.taskLookAt(lookAt, duration, flags, priority);

Required Arguments​

  • lookAt: Entity handle or object
  • duration: int
  • flags: int
  • priority: int

Return value​

  • Undefined

Example​

/**
* Function to make local player look at another player
* @param {number} targetRemoteId - Remote(server) id of the player to look at
*/
function localPlayerLookAtPlayer(targetRemoteId) {
// Get target player from the pool by his remote id
const target = mp.players.atRemoteId(targetRemoteId);

// If target player is not found, stop
if (!target || target.handle === 0) return;

// Call the method to look at another entity, in this case player
mp.players.local.taskLookAt(target.handle, -1, 2048, 2);
}