Player::taskPlantBomb: Difference between revisions

From RAGE Multiplayer Wiki
(Adds description and example of planting bomb task function)
No edit summary
 
Line 1: Line 1:
This function plays a planting bomb animation and plants a selected bomb in heading target location,, you need to have the bomb equiped in your hands to work, otherwise nothing happens.
This function plays a planting bomb animation and plants a bomb in heading target location, you need to have the bomb equiped in your hands to work, otherwise nothing happens.


==Syntax==
==Syntax==

Latest revision as of 01:14, 29 September 2019

This function plays a planting bomb animation and plants a bomb in heading target location, you need to have the bomb equiped in your hands to work, otherwise nothing happens.

Syntax

player.taskPlantBomb(x, y, z, heading);

Required Arguments

  • x: float
  • y: float
  • z: float
  • heading: float

Return value

  • Undefined

Example

In the example below the player will plant when the X key is pressed:

mp.keys.bind(88, false, () => {
  if (mp.players.local.weapon != mp.game.joaat('weapon_stickybomb'))
    return mp.gui.chat.push(`You need a sticky bomb to use planting feature!`);

  const { x, y, z } = mp.players.local.position;

  mp.players.local.taskPlantBomb(x, y, z, mp.players.local.heading);

});

See also