Rope::addRope: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 28: Line 28:
==Syntax==
==Syntax==
<pre>
<pre>
mp.game.rope.addRope(x, y, z, rotX, rotY, rotZ, length, ropeType, initialLen, minLen, changeRate, populOnly, collision, lockFront, timeMultiplier, breakWhenShot, materialName);
mp.game.physics.addRope(x, y, z, rotX, rotY, rotZ, length, ropeType, initialLen, minLen, changeRate, populOnly, collision, lockFront, timeMultiplier, breakWhenShot, materialName);
</pre>
</pre>


Line 36: Line 36:
const {x, y, z} = mp.players.local.position;
const {x, y, z} = mp.players.local.position;
const forwardPos = mp.players.local.getForwardVector();
const forwardPos = mp.players.local.getForwardVector();
const {result} = mp.game.rope.addRope(x, y, z, forwardPos.x, forwardPos.y, forwardPos.z, 50.0, 1, 50.0, 50.0, 1.2, false, true, true, 10.0, true, null);
const {result} = mp.game.physics.addRope(x, y, z, forwardPos.x, forwardPos.y, forwardPos.z, 50.0, 1, 50.0, 50.0, 1.2, false, true, true, 10.0, true, null);
mp.console.logInfo(`Rope created! Handle: ${result}`);
mp.console.logInfo(`Rope created! Handle: ${result}`);


Line 44: Line 44:


==See also==
==See also==
{{Rope_s_function_c}}
{{Rope_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]

Latest revision as of 10:54, 12 May 2024

Client-Side
Function

 JavaScript



Creates a rope at the specific position, that extends in the specified direction when not attached to any entities.

JavaScript Syntax


Required Params

  • x: Float
  • y: Float
  • z: Float
  • rotX: Float
  • rotY: Float
  • rotZ: Float
  • length: Number
  • ropeType: Number
  • initialLength: Number
  • minLength: Number
  • changeRate: Float
  • populOnly: Boolean
  • collision: Boolean
  • lockfront: Boolean
  • timeMultiplier: Float
  • breakable: Boolean
  • materialName: String or Null

Return Value

  • {unkPtr, result} {number, handle}

Syntax

mp.game.physics.addRope(x, y, z, rotX, rotY, rotZ, length, ropeType, initialLen, minLen, changeRate, populOnly, collision, lockFront, timeMultiplier, breakWhenShot, materialName);

Example

Client-Side
const {x, y, z} = mp.players.local.position;
const forwardPos = mp.players.local.getForwardVector();
const {result} = mp.game.physics.addRope(x, y, z, forwardPos.x, forwardPos.y, forwardPos.z, 50.0, 1, 50.0, 50.0, 1.2, false, true, true, 10.0, true, null);
mp.console.logInfo(`Rope created! Handle: ${result}`);


See also