Modules
Pedestrians
Server

Shared

Create your pedestrians with ease by pushing your args to the functions

createSinglePed

exports.tr_kit.createSinglePed(source, settings, timeout)

Parameters

  • source number: The source of the client.
  • settings object: Options
  • timeout number (optional): The timeout in milliseconds for each operations. lean more about timeout

Returns

  • entityServerHandle number: The entity client handle
  • netId number: The entity netId

Examples

const netId = exports.tr_kit.createSinglePed({
  hash: GetHashKey('mp_m_freemode_01'),
  coords: { x: 100, y: 100, z: 100, w: 0 },
  scenario: {
    name: 'WORLD_HUMAN_JANITOR',
    freeze: true,
    timeToLeave: 1000,
    playIntroClip: true
  },
})

createMultiplePeds

exports.tr_kit.createMultiplePeds(source, peds, defaultSettings, timeout)

Parameters

  • source number: The source of the client.
  • peds array of Options
  • defaultSettings object (optional): Options
  • timeout number (optional): The timeout in milliseconds for each operations. lean more about timeout

Returns

  • entityServerHandles array: The entity client handles
  • netIds array: The created netIds

Examples

const netIds = exports.tr_kit.createMultiplePeds(
  [
    {
      model: GetHashKey('mp_m_freemode_01'),
      coords: { x: 100, y: 100, z: 100, w: 0 },
      scenario: {
          name: 'WORLD_HUMAN_JANITOR',
          freeze: true,
          timeToLeave: 1000,
          playIntroClip: true
      },
    },
    {
      model: GetHashKey('mp_m_freemode_01'),
      coords: { x: 100, y: 100, z: 100, w: 0 },
      scenario: {
          name: 'WORLD_HUMAN_JANITOR',
          freeze: true,
          timeToLeave: 1000,
          playIntroClip: true
      },
    },
    ....
  ],
  {
    model: GetHashKey('mp_m_freemode_01'),
    coords: { x: 100, y: 100, z: 100, w: 0 },
    scenario: {
      name: 'WORLD_HUMAN_JANITOR',
      freeze: true,
      timeToLeave: 1000,
      playIntroClip: true
    },
  }
)

clearCreatedPed

exports.tr_kit.clearCreatedPed(netId, timeout)

Parameters

  • netId number: The ped netId.
  • timeout number (optional): The timeout in milliseconds for each operations. lean more about timeout

Returns

  • success boolean: Whether the ped was deleted or not.

Examples

exports.tr_kit.clearCreatedPed(netId)

clearCreatedPeds

exports.tr_kit.clearCreatedPeds(netIds, timeout)

Parameters

  • netIds array: The ped netIds
  • timeout number (optional): The timeout in milliseconds for each operations. lean more about timeout

Returns

  • success boolean: Whether the peds were deleted or not.

Examples

exports.tr_kit.clearCreatedPeds(netIds)

Options

  • hash number: The hash of the ped model
  • coords object | array: The coordinates of the ped
    • object:
      • x: number
      • y: number
      • z: number
      • w: number or
    • array:
      • number
      • number
      • number
      • number
  • w: number
  • scenario (optional) object: The scenario of the ped
    • name string: The name of the scenario List of scenario names (opens in a new tab)
    • freeze boolean: preventing ped's coordinates to change
    • oblivious boolean: makes the ped oblivious to all events happening around him.
    • timeToLeave number: Sets the timeout on the scenario point to the specified time in milliseconds. If less than 0, sets the IdleForever flag.
    • playIntroClip boolean: If the ped should play the scenarios enter animation. Sets the SkipEnterClip flag.

Callouts

  • The server entity handle is generated automatically from the netId and you will no longer need to worry about it.
  • Please be aware that the server handle is different from the client handle and vice versa.
  • Now we are no longer allowing to pass whether or not the entity should be networked or not since most of the time you are going to clear the entity after use.
  • By adding the timeout parameter we gave you the ability to set the timeout for each operation. such as callbacks timeout, instance existings, and more. you can refer to the source code and see more about it