OnEntityStreamIn

From GT-MP
Jump to: navigation, search
OnEntityStreamIn
Client-Side Function
System-users.png Client-Side Javascript.png JavaScript

This event is triggered when an entity is streamed in. (streaming distance is changeable in the settings.xml)

Syntax

In Javascript
Client-Side Function

API.onEntityStreamIn.connect((LocalHandle entity, Number entityType) => {

})
  • entity: parameter should be of LocalHandle type.
  • entityType: parameter should be of Number type. See Entity Types for assistance.

Usage example(s)

API.onEntityStreamIn.connect((ent, entType) => {
  if (entType === 6 || entType === 8) { // Player or ped
    var hairColor = API.getEntitySyncedData(ent, 'GTAO_HAIR_COLOR')
    var highlightColor = API.getEntitySyncedData(ent, 'GTAO_HAIR_HIGHLIGHT_COLOR')

    API.callNative('_SET_PED_HAIR_COLOR', ent, hairColor, highlightColor)
  }
})

References