Peds::new: Difference between revisions

From RAGE Multiplayer Wiki
(Added the page for mp.peds.new)
 
(Added the 'client-side' header to the example)
Line 10: Line 10:
*'''Ped handle or object'''
*'''Ped handle or object'''
==Example==
==Example==
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
     let Ped = mp.peds.new(mp.game.joaat('MP_F_Freemode_01'), new mp.Vector3( 100.0, -100.0, 25.0), 270.0, (streamPed) => {
     let Ped = mp.peds.new(mp.game.joaat('MP_F_Freemode_01'), new mp.Vector3( 100.0, -100.0, 25.0), 270.0, (streamPed) => {
Line 16: Line 18:
     }, player.dimension);
     }, player.dimension);
</syntaxhighlight>
</syntaxhighlight>
</div>
==See also==
==See also==
{{Ped_s_function_c}}
{{Ped_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]

Revision as of 19:58, 18 September 2017

Syntax

mp.peds.new(modelHash, position, rotation[, onStream, dimension]);

Required Arguments

  • modelHash: Model hash or name
  • position: Vector3 position
  • rotation: float
  • onStream: 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