👁️Target

These are all the target functions within dirk-core and they will work with the following target systems: ox_target (preferred), qb-target, q-target

AddBoxZone

Core.Target.AddBoxZone("myBoxZone", {
    Position = vector4(0,0,0,0),
    Distance = 1.5, 
    Height   = 2.0, 
    Width    = 2.0, 
    Length   = 1.0, 
    Options  = {
        {
            canInteract = function(entity,distance,data)
                --## return false if you dont want to be able to see this option
              return true
            end,
    
            action = function(entity)
              --## Run my code here on interact with this option
            end,
    
            icon  = 'fa-solid fa-burger',
            label = "My Option Label",
        },
    },
})

DeleteZone

Core.Target.DeleteZone("zoneName") --## Will remove this target zone

AddEntity

--## Entity can be a network entity id or just a regular id
Core.Target.AddEntity(entity, { 
    Distance = 1.0, 
    Local    = false, --## Set to true if this is a network entity/ID
    Options  = {
        {
            canInteract = function(entity,distance,data)
                --## return false if you dont want to be able to see this option
              return true
            end,
    
            action = function(entity)
              --## Run my code here on interact with this option
            end,
    
            icon  = 'fa-solid fa-burger',
            label = "My Option Label",
        },
    },
})

RemoveEntity

Core.Target.RemoveEntity(entity,isNetworkEntity)
--## Will remove target options from this entity

AddGlobalVehicle

  Core.Target.AddGlobalVehicle({
    Distance = 1.5, 
    Options  = { 
      {
        canInteract = function(entity, distance, data,name, bone)
          return true
        end,

        action = function(...)
          local argR = {...}
          local arg = argR[1]
          --## arg.entity etc is accessible like this

        end,
        icon  = "fas fa-box-open",
        label = "Place Object",
      }
    },
  })

AddGlobalPed

  Core.Target.AddGlobalPed({
    Distance = 1.5, 
    Options  = { 
      {
        canInteract = function(entity, distance, data,name, bone)
          return true
        end,

        action = function(...)
          local argR = {...}
          local arg = argR[1]
          --## arg.entity etc is accessible like this

        end,
        icon  = "fas fa-box-open",
        label = "Place Object",
      }
    },
  })

Last updated