Player::taskPlantBomb: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
(Adds description and example of planting bomb task function)
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.


==Syntax==
==Syntax==
Line 10: Line 11:
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
In the example below the player will plant when the X key is pressed:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
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);
 
});
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==

Revision as of 01:14, 29 September 2019

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.

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