Peds::new: Difference between revisions

From RAGE Multiplayer Wiki
Line 1: Line 1:
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.peds.new(modelHash, position, rotation[, onStream, dimension]);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.peds.new(model, position, heading, streamInEventHandler, dimension);;</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''modelHash:''' Model hash
*'''modelHash:''' Model hash
*'''position:''' Vector3 position
*'''position:''' Vector3 position
*'''rotation:''' float
*'''heading:''' float
*'''onStream:''' function (called when the ped is streamed)
*'''streamInEventHandler:''' function (called when the ped is streamed)
*'''dimension:''' int
*'''dimension:''' int
===Return value===
===Return value===
*'''Ped handle or object'''
*'''Ped handle or object'''
==Example==
==Example==
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">

Revision as of 22:24, 13 January 2018

Syntax

mp.peds.new(model, position, heading, streamInEventHandler, dimension);;

Required Arguments

  • modelHash: Model hash
  • position: Vector3 position
  • heading: float
  • streamInEventHandler: function (called when the ped is streamed)
  • dimension: int

Return value

  • Ped handle or object

Example

Client-Side
let Ped = mp.peds.new(mp.game.joaat('MP_F_Freemode_01'), new mp.Vector3( 100.0, -100.0, 25.0), 270.0, (streamPed) => {
    // Ped Streamed
    streamPed.setAlpha(0);
}, player.dimension);

See also