CreatePed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Ped Issues)
(missing oop)
 
(8 intermediate revisions by 6 users not shown)
Line 31: Line 31:
*'''rot:''' A floating point number representing the rotation in degrees.  
*'''rot:''' A floating point number representing the rotation in degrees.  
</section>
</section>
{{OOP||[[Ped]]||}}


===Returns===
===Returns===
Line 60: Line 62:
==Issues==
==Issues==
{{Issues|
{{Issues|
{{Issue|7970|Peds with weapons malfunction due to weird totalAmmo and ammoInClip values}}
{{Issue|375|Sync distance of unoccupied vehicles and peds should match stream distance}}
{{Issue|7371|Network troubled players can ruin ped sync}}
{{Issue|605|Ped fireing Projectiles doesn't work}}
{{Issue|6048|Ped weapon isn't synced on join}}
{{Issue|492|Peds shooting incorrectly}}
{{Issue|5113|setPedControlState doesn't work on the control "enter_exit"}}
{{Issue|6287|Sync distance of unoccupied vehicles and peds should match stream distance}}
{{Issue|5715|[Request] giveWeapon for clientside peds}}
{{Issue|5725|Ped fireing Projectiles doesn't work}}
{{Issue|4921|Improve ped synchronization}}
{{Issue|5840|ped position not synced to server after falling through the ground}}
{{Issue|6682|Server doesnt update ped position after warping it to vehicle}}
{{Issue|6506|Ped animation is only visible if it was set while player was in stream distance from source ped}}
{{Issue|4596|Serverside peds have their animations not applied for joining players}}
{{Issue|4504|Peds shooting incorrectly}}
{{Issue|4008|Can't use giveWeapon() directly after createPed()}}
}}
}}


Line 79: Line 70:
==See Also==
==See Also==
{{Ped functions}}
{{Ped functions}}
[[hu:createPed]]
[[pl:createPed]]
[[ru:createPed]]
[[ru:createPed]]

Latest revision as of 05:59, 5 November 2023

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.


OOP Syntax Help! I don't understand this!

Method: Ped(...)


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 )
Click to collapse [-]
Client

This example creates a ped, and makes it damage proof:

thePed = createPed(120, 5540.6654, 1020.55122, 1240.545) -- Creates a ped
function cancelPedDamage()
	cancelEvent() -- Cancels the onClientPedDamage event
end
addEventHandler("onClientPedDamage", thePed, cancelPedDamage) -- When thePed is damaged, cancelPedDamage is called

Issues

Issue ID Description
#375 Sync distance of unoccupied vehicles and peds should match stream distance
#605 Ped fireing Projectiles doesn't work
#492 Peds shooting incorrectly


See Also