Перейти к содержанию

Player::taskLookAt

Материал из RAGE MP Wiki Archive
Версия от 13:22, 7 февраля 2024; imported>Koprawiki (Page update)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

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

Syntax

<syntaxhighlight lang="javascript">player.taskLookAt(lookAt, duration, flags, priority);</syntaxhighlight>

Required Arguments

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

Return value

  • Undefined

Example

<syntaxhighlight lang="javascript"> /**

* 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);

} </syntaxhighlight>

See also