CreatePed

From Multi Theft Auto: Wiki
Revision as of 21:54, 26 August 2012 by -ffs-Sniper (talk | contribs) (Corrected meaning of the servers-side "synced" argument)
Jump to navigation Jump to search

Creates a Ped in the GTA world.

Syntax

Click to collapse [-]
Server
ped createPed ( int modelid, float x, float y, float z [, float rot = 0.0, bool synced = true ] )

Required Arguments

  • modelid: A whole integer specifying the GTASA skin ID.
  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • rot: A floating point number representing the rotation in degrees.
  • synced: A boolean value representing whether or not the ped will be synced. Disabling the sync might be useful for frozen or static peds to increase the server performance.
Click to collapse [-]
Client
ped createPed ( int modelid, float x, float y, float z [, float rot = 0.0 ] )

Required Arguments

  • modelid: A whole integer specifying the GTASA skin ID.
  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • rot: A floating point number representing the rotation in degrees.

Returns

Returns a ped element if it was successfully created.

Example

Click to collapse [-]
Server

This example creates an ped when the resource starts:

function pedLoad ( name )
   createPed ( 120, 5540.6654, 1020.55122, 1240.545 )
end
addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad )

See Also