natives.createChar

From GTA Connected
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.createChar(int pedType, int modelHash, Vec3 position, bool networked)

The natives.createChar function is used to Create a ped.

Parameters

1) int pedType The ped type (see Ped Defines).
2) int modelHash The model hash.
3) Vec3 position The spawn position.
4) bool networked Whether the ped is networked.

Return

void This function doesn't return a value.

Notes

There aren't any notes for this function.

Examples

Example 1 - JavaScript:

addCommandHandler("spawnped", function(command, params, client) {

   const hash = natives.getHashKey("M_Y_COP");
   const pos = localPlayer.position;
   natives.requestModel(hash);
   if (natives.hasModelLoaded(hash)) {
       const ped = natives.createChar(1, hash, pos, true);
       natives.markModelAsNoLongerNeeded(hash);
   }

});

Compatibility

There isn't any compatibility information for this function.