addTarget

Add a target to the system.

-- ARGUMENTS
-- target: table
--   id:            string
--   position:      vector3
--   text:          string
--   interact_dist: number
--   render_dist:   number
--
--   line_color: table (OPTIONAL)
--     r: number
--     g: number
--     b: number
--
--   action_progress_color: table (OPTIONAL)
--     primary:   string
--     secondary: string
--
--   actions: itable        
--     table
--       skill:    string
--       level:    number
--       event:    string    (OPTIONAL)
--       callback: function  (OPTIONAL)
--       cooldown: number    (OPTIONAL)
--
--   menu: table
--     header: table (OPTIONAL)
--       title: table (OPTIONAL)
--         text: string (OPTIONAL)
--         icon: string (OPTIONAL)
--       info: table (OPTIONAL)
--         color: string (OPTIONAL)
--         icon:  string (OPTIONAL)
--         text:  string (OPTIONAL)
--     info: table (OPTIONAL)
--       color:       string (OPTIONAL)
--       image:       string (OPTIONAL)
--       title:       string (OPTIONAL)
--       description: string (OPTIONAL)
--     extra: itable (OPTIONAL)
--       table
--         description: string (OPTIONAL)
--         icon:        string (OPTIONAL)
--         text:        string (OPTIONAL)

-- RETURNS
-- nil

RegisterCommand("add_target", function(source, args)    
    exports.ti_watchDogs:addTarget({
        id = "parking_meter_1",
        position = vector3(111.1, 222.2, 333.3),
        text = "Parking Meter",
        interact_dist = 2.0,
        render_dist = 5.0,
        action_progress_color = {
            primary = "#FF4F4F"
        },
        actions = {
            {
                skill = "hack",
                level = 0,
                event = "my_resource:hack_meter",
                cooldown = 30000
            }
        },
        menu = {
            header = {
                title = {
                    icon = "fa-solid fa-bars",
                },
            },
        
            info = {
                color = "#FF4F4F",
                image = "./images/shock.png",
                title = "Overload Parking Meter",
                description = "Overload this parking meter to electrocute a nearby player."
            },
        }
    })
end, false)

AddEventHandler("my_resource:hack_meter", function(target, action, success)
    print("Hack meter", success)
end)

Last updated