Rope::addRope: Difference between revisions
(→Syntax) |
No edit summary |
||
| (6 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
Creates a rope at the specific position, that extends in the specified direction when not attached to any entities. | __NOTOC__ | ||
{{ClientsideJsFunction}} | |||
Creates a rope at the specific position, that extends in the specified direction when not attached to any entities. | |||
{{JSContainer| | |||
=== Required Params === | |||
*'''x:''' {{RageType|Float}} | |||
*'''y:''' {{RageType|Float}} | |||
*'''z:''' {{RageType|Float}} | |||
*'''rotX:''' {{RageType|Float}} | |||
*'''rotY:''' {{RageType|Float}} | |||
*'''rotZ:''' {{RageType|Float}} | |||
*'''length:''' {{RageType|Number}} | |||
*'''ropeType:''' {{RageType|Number}} | |||
*'''initialLength:''' {{RageType|Number}} | |||
*'''minLength:''' {{RageType|Number}} | |||
*'''changeRate:''' {{RageType|Float}} | |||
*'''populOnly:''' {{RageType|Boolean}} | |||
*'''collision:''' {{RageType|Boolean}} | |||
*'''lockfront:''' {{RageType|Boolean}} | |||
*'''timeMultiplier:''' {{RageType|Float}} | |||
*'''breakable:''' {{RageType|Boolean}} | |||
*'''materialName:''' {{RageType|String}} or {{RageType|Null}} | |||
=== Return Value === | |||
*'''{unkPtr, result}''' {{RageType|{number, handle}}} | |||
==Syntax== | ==Syntax== | ||
< | <pre> | ||
mp.game.physics.addRope(x, y, z, rotX, rotY, rotZ, length, ropeType, initialLen, minLen, changeRate, populOnly, collision, lockFront, timeMultiplier, breakWhenShot, materialName); | |||
</pre> | |||
==Example== | ==Example== | ||
{{ClientsideCode| | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
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}`); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | |||
}} | |||
==See also== | ==See also== | ||
{{ | {{Rope_functions_c}} | ||
[[Category:Clientside API]] | [[Category:Clientside API]] | ||
Latest revision as of 10:54, 12 May 2024
Client-Side Function
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
- mp.game.rope.addRope
- mp.game.rope.applyImpulseToCloth
- mp.game.rope.attachEntitiesToRope
- mp.game.rope.attachRopeToEntity
- mp.game.rope.breakEntityGlass
- mp.game.rope.deleteChildRope
- mp.game.rope.deleteRope
- mp.game.rope.detachRopeFromEntity
- mp.game.rope.doesRopeExist
- mp.game.rope.getCgoffset
- mp.game.rope.getRopeLastVertexCoord
- mp.game.rope.getRopeLength
- mp.game.rope.getRopeVertexCoord
- mp.game.rope.getRopeVertexCount
- mp.game.rope.loadRopeData
- mp.game.rope.pinRopeVertex
- mp.game.rope.ropeConvertToSimple
- mp.game.rope.ropeDrawShadowEnabled
- mp.game.rope.ropeForceLength
- mp.game.rope.ropeResetLength
- mp.game.rope.ropeSetUpdatePinverts
- mp.game.rope.setCgAtBoundcenter
- mp.game.rope.setCgoffset
- mp.game.rope.setDamping
- mp.game.rope.setDisableBreaking
- mp.game.rope.setDisableFragDamage
- mp.game.rope.startRopeUnwindingFront
- mp.game.rope.startRopeWinding
- mp.game.rope.stopRopeUnwindingFront
- mp.game.rope.stopRopeWinding
- mp.game.rope.unpinRopeVertex