CU Interactions
Exports

Exports

Target Types (obj)

  • entity: number (entity handle) or table<number>
  • model: number (model hash) or table<number>
  • global: string or table<string>; supported values are "vehicle", "ped", "player"
  • point: vector3 or table<vector3>

Full data Structure

local data = {
  hideMarker = false,
  checkVisibility = false,
  distance = 10.0,
  distanceMenu = 2.0,
  bone = nil,
  showInCar = false,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.2 },
    target = { x = 0.0, y = 0.0, z = 0.0 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'unique_option_name',
      label = 'Option Label',
      icon = 'fa-solid fa-user',
      key = 'E',
      time = 1000,
      onSelect = function(entity)
        -- model/global pass entity handle here
        -- entity/point call onSelect with no args
      end,
    }
  }
}

Defaults

If values are omitted:

  • label = "Example Text"
  • icon = cfg.Interaction.default.icon
  • key = cfg.Interaction.default.key (Action only)
  • time = cfg.Interaction.default.time (Action only)
  • onSelect = function() ... end (Action only)
  • hideMarker/checkVisibility/distance/distanceMenu/showInCar/offset come from cfg.Interaction.default

Entity Exports

registerEntityAction

exports['cu_interactions']:registerEntityAction('entity_shop', PlayerPedId(), {
  hideMarker = false,
  checkVisibility = false,
  distance = 10.0,
  distanceMenu = 2.0,
  bone = 31086,
  showInCar = false,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.2 },
    target = { x = 0.0, y = 0.0, z = 0.0 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'talk',
      label = 'Talk',
      icon = 'fa-solid fa-comments',
      key = 'E',
      time = 1200,
      onSelect = function()
        print('entity talk')
      end
    },
    {
      name = 'trade',
      label = 'Trade',
      icon = 'fa-solid fa-coins',
      key = 'F',
      time = 1700,
      onSelect = function()
        print('entity trade')
      end
    }
  }
})

registerEntityLabel

exports['cu_interactions']:registerEntityLabel('entity_label', PlayerPedId(), {
  hideMarker = true,
  checkVisibility = false,
  distance = 12.0,
  distanceMenu = 2.5,
  bone = 31086,
  showInCar = true,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.25 },
    target = { x = 0.0, y = 0.0, z = 0.0 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'status',
      label = 'NPC available',
      icon = 'fa-solid fa-circle-info'
    }
  }
})

unregisterEntityAction

exports['cu_interactions']:unregisterEntityAction(PlayerPedId())
exports['cu_interactions']:unregisterEntityAction(PlayerPedId(), 'entity_shop')
exports['cu_interactions']:unregisterEntityAction(PlayerPedId(), 'entity_shop', 'trade')

concealEntityAction / revealEntityAction

exports['cu_interactions']:concealEntityAction(PlayerPedId(), 'entity_shop')
exports['cu_interactions']:revealEntityAction(PlayerPedId(), 'entity_shop')

Model Exports

registerModelAction

local atmModel = joaat('prop_atm_01')
 
exports['cu_interactions']:registerModelAction('atm_actions', atmModel, {
  hideMarker = false,
  checkVisibility = true,
  distance = 9.0,
  distanceMenu = 1.8,
  bone = nil,
  showInCar = false,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.9 },
    target = { x = 0.0, y = 0.0, z = 0.6 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'withdraw',
      label = 'Withdraw',
      icon = 'fa-solid fa-money-bill-wave',
      key = 'E',
      time = 1000,
      onSelect = function(entity)
        print('ATM entity:', entity)
      end
    }
  }
})

registerModelLabel

exports['cu_interactions']:registerModelLabel('atm_label', joaat('prop_atm_01'), {
  hideMarker = true,
  checkVisibility = false,
  distance = 12.0,
  distanceMenu = 2.0,
  bone = nil,
  showInCar = true,
  offset = {
    text = { x = 0.0, y = 0.0, z = 1.0 },
    target = { x = 0.0, y = 0.0, z = 0.7 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'hint',
      label = 'ATM',
      icon = 'fa-solid fa-building-columns'
    }
  }
})

unregisterModelAction

exports['cu_interactions']:unregisterModelAction(joaat('prop_atm_01'))
exports['cu_interactions']:unregisterModelAction(joaat('prop_atm_01'), 'atm_actions')
exports['cu_interactions']:unregisterModelAction(joaat('prop_atm_01'), 'atm_actions', 'withdraw')

concealModelAction / revealModelAction

exports['cu_interactions']:concealModelAction(joaat('prop_atm_01'), 'atm_actions')
exports['cu_interactions']:revealModelAction(joaat('prop_atm_01'), 'atm_actions')

Global Exports

registerGlobalAction

exports['cu_interactions']:registerGlobalAction('global_vehicle_actions', 'vehicle', {
  hideMarker = false,
  checkVisibility = false,
  distance = 10.0,
  distanceMenu = 2.2,
  bone = 'bonnet',
  showInCar = true,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.4 },
    target = { x = 0.0, y = 0.0, z = 0.2 }
  },
  ignoreModel = {
    joaat('police'),
    joaat('ambulance')
  },
  options = {
    {
      name = 'check_plate',
      label = 'Check Plate',
      icon = 'fa-solid fa-id-card',
      key = 'G',
      time = 1400,
      onSelect = function(entity)
        print('Vehicle entity:', entity)
      end
    }
  }
})

registerGlobalLabel

exports['cu_interactions']:registerGlobalLabel('global_ped_label', 'ped', {
  hideMarker = true,
  checkVisibility = false,
  distance = 12.0,
  distanceMenu = 2.0,
  bone = 31086,
  showInCar = true,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.25 },
    target = { x = 0.0, y = 0.0, z = 0.0 }
  },
  ignoreModel = {
    joaat('s_m_y_cop_01')
  },
  options = {
    {
      name = 'ped_info',
      label = 'Ped nearby',
      icon = 'fa-solid fa-user'
    }
  }
})

unregisterGlobalAction

exports['cu_interactions']:unregisterGlobalAction('vehicle')
exports['cu_interactions']:unregisterGlobalAction('vehicle', 'global_vehicle_actions')
exports['cu_interactions']:unregisterGlobalAction('vehicle', 'global_vehicle_actions', 'check_plate')

concealGlobalAction / revealGlobalAction

exports['cu_interactions']:concealGlobalAction('ped', 'global_ped_label')
exports['cu_interactions']:revealGlobalAction('ped', 'global_ped_label')

Point Exports

registerPointAction

local stashPoint = vector3(-1036.66, -2134.38, 11.71)
 
exports['cu_interactions']:registerPointAction('point_stash', stashPoint, {
  hideMarker = false,
  checkVisibility = false,
  distance = 10.0,
  distanceMenu = 2.0,
  bone = nil,
  showInCar = false,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.15 },
    target = { x = 0.0, y = 0.0, z = 0.0 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'open_stash',
      label = 'Open Stash',
      icon = 'fa-solid fa-box-open',
      key = 'E',
      time = 1300,
      onSelect = function()
        print('stash opened')
      end
    }
  }
})

registerPointLabel

exports['cu_interactions']:registerPointLabel('point_label', vector3(200.0, -900.0, 30.0), {
  hideMarker = true,
  checkVisibility = false,
  distance = 15.0,
  distanceMenu = 2.0,
  bone = nil,
  showInCar = true,
  offset = {
    text = { x = 0.0, y = 0.0, z = 0.2 },
    target = { x = 0.0, y = 0.0, z = 0.0 }
  },
  ignoreModel = {},
  options = {
    {
      name = 'hint',
      label = 'Info point',
      icon = 'fa-solid fa-location-dot'
    }
  }
})

unregisterPointAction

local point = vector3(200.0, -900.0, 30.0)
 
exports['cu_interactions']:unregisterPointAction(point)
exports['cu_interactions']:unregisterPointAction(point, 'point_label')
exports['cu_interactions']:unregisterPointAction(point, 'point_label', 'hint')

concealPointAction / revealPointAction

local point = vector3(200.0, -900.0, 30.0)
 
exports['cu_interactions']:concealPointAction(point, 'point_label')
exports['cu_interactions']:revealPointAction(point, 'point_label')