Pedestrians
Client

Client

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

createSinglePed

createSinglePed({
  hash: number,
  coords: [number, number, number, number]
  scenario?: {
    name?: string,
    timeToLeave?: number,
    playIntroClip?: boolean
  },
  behavior?: {
    freeze?: boolean,
    oblivious?: boolean,
  }
},
  timeout?: number
): Promise<[number, number] | undefined>

Parameters

  • hash: the hash of the ped model
  • coords: [x, y, z, w]
  • scenario?:
    • name: the name of the scenario, see List of scenario names (opens in a new tab) or visit update/update.rpf/common/data/ai/scenarios.meta
    • timeToLeave: the timeout on the scenario point to the specified time in milliseconds. If less than 0, sets the IdleForever flag
    • playIntroClip: if the ped should play the scenarios enter animation. Sets the SkipEnterClip flag
  • behavior?:
    • freeze?: whether the to completely freeze the ped or not
    • oblivious?: whether to make ped completely oblivious to all events going on around him
  • timeout?: the timeout in milliseconds for both when requesting the model and awaiting for its existing

Returns

  • entityHandle, entityNetId: The entity handle and netId

Examples

import { createSinglePed } from '@trippler/tr_kit/client'
 
const [entityHandle, entityNetId] = await createSinglePed({
  hash: GetHashKey('mp_m_freemode_01'),
  coords: [123.45, 678.90, 123.45, 267.89],
})
 
console.log(entityHandle, entityNetId) /* number, number */

destroyCreatedPed

destroyCreatedPed(netId: number, timeout?: number): boolean

Parameters

  • netId: The ped entity netid
  • timeout?: The timeout in milliseconds to wait for the ped to be destroyed

Returns

  • success: Whether the ped was deleted or not

Examples

import { destroyCreatedPed } from '@trippler/tr_kit/client'
 
const success = await destroyCreatedPed(65023)
 
console.log(success) /* true */

Callouts

  • The module automatically destroys the created peds on the resource stop detection
  • Please be aware that the client handle is different from the server 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.