registerEntityInfo

Add entity info to the target system. This should be called before `registerEntityAction`.

-- ARGUMENTS
-- target_entity_type: string           ["ped", "object", "vehicle"]
-- target_type:        string           ["local_entity", "network_entity", "entity_type", "entity_model"]
-- entity:             string OR number [entity, model_hash, "ped", "object", "vehicle"]
-- target_options:     table
--   chance:        number [0-100]
--   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
--
--   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

Example: Ped Entity Type

RegisterCommand("register_entity_info", function(source, args)    
    exports.ti_watchDogs:registerEntityInfo("ped", "entity_type", "ped", {
        chance = 100,

        text = "Local Citizen",

        interact_dist = 2.0,
        render_dist = 2.0,

        action_progress_color = {
            primary = "#2DA5E6"
        },

        menu = {
            header = {
                title = {
                    icon = "fa-solid fa-bars",
                },
            },
        
            info = {
                color = "#2DA5E6",
                image = "./images/shock.png",
                title = "Local Citizen",
                description = "A citizen local to San Andreas."
            },
        }
    })
end, false)

Example: Ped Entity Model

RegisterCommand("register_entity_info", function(source, args)    
    local model = GetHashKey("mp_m_freemode_01")
    
    exports.ti_watchDogs:registerEntityInfo("ped", "entity_model", model, {
        chance = 100,

        text = "Local Citizen",

        interact_dist = 2.0,
        render_dist = 2.0,

        action_progress_color = {
            primary = "#2DA5E6"
        },

        menu = {
            header = {
                title = {
                    icon = "fa-solid fa-bars",
                },
            },
        
            info = {
                color = "#2DA5E6",
                image = "./images/shock.png",
                title = "Local Citizen",
                description = "A citizen local to San Andreas."
            },
        }
    })
end, false)

Example: Ped Local Entity

RegisterCommand("register_entity_info", function(source, args)  
    local pos = GetEntityCoords(PlayerPedId())  
    local _,ped = GetClosestPed(pos, 20.0, 1, 0, 0, 0, -1)
    
    exports.ti_watchDogs:registerEntityInfo("ped", "local_entity", ped, {
        chance = 100,

        text = "Local Citizen",

        interact_dist = 2.0,
        render_dist = 2.0,

        action_progress_color = {
            primary = "#2DA5E6"
        },

        menu = {
            header = {
                title = {
                    icon = "fa-solid fa-bars",
                },
            },
        
            info = {
                color = "#2DA5E6",
                image = "./images/shock.png",
                title = "Local Citizen",
                description = "A citizen local to San Andreas."
            },
        }
    })
end, false)

Last updated