registerEntityActions

Add a range of possible actions to any given target type. This should be called after `registerEntityInfo`.

-- 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:     itable
--  table
--    description: string
--    chance:      number [0-100]
--    skill:       string
--    level:       number
--    event:       string   (OPTIONAL)
--    callback:    function (OPTIONAL)
--    cooldown:    number

-- RETURNS
-- nil

Example: Ped Entity Type

RegisterCommand("register_entity_actions", function()
    exports.ti_watchDogs:registerEntityActions("ped", "entity_type", "ped", {
        {
            description = "Steal funds from bank account.",
            chance = 100,
            skill = "hack",
            level = 0,
            event = "my_resource:hack_ped",
            cooldown = 1000
        }
    })
end, false)

Example: Ped Entity Model

RegisterCommand("register_entity_actions", function()
    local model = GetHashKey("mp_m_freemode_01")
    
    exports.ti_watchDogs:registerEntityActions("ped", "entity_model", model, {
        {
            description = "Steal funds from bank account.",
            chance = 100,
            skill = "hack",
            level = 0,
            event = "my_resource:hack_ped",
            cooldown = 1000
        }
    })
end, false)

Example: Ped Local Entity

RegisterCommand("register_entity_actions", function()
    local pos = GetEntityCoords(PlayerPedId())  
    local _,ped = GetClosestPed(pos, 20.0, 1, 0, 0, 0, -1)
    
    exports.ti_watchDogs:registerEntityActions("ped", "local_entity", ped, {
        {
            description = "Steal funds from bank account.",
            chance = 100,
            skill = "hack",
            level = 0,
            event = "my_resource:hack_ped",
            cooldown = 1000
        }
    })
end, false)

Last updated