natives.createChar: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
(Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.createChar |parameters = int pedType, int modelHash, Vec3 position, bool networked |parameter1 = int pedType The ped type (see Ped Defines) |parameter2 = int modelHash The model hash |parameter3 = Vec3 position The spawn position |parameter4 = bool networked Whether the ped is networked |usage = Create a ped |return1 = Ped |returnFail1 = void |exampleJS = addC...")
(No difference)

Revision as of 19:52, 3 December 2025

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

Ped 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

Ped Documentation Missing: Description for return 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.