Peds

CLIENT SIDE ONLY

A standalone ped manager system for dynamically managing ped creation and behaviors. It allows for creating, customizing, and removing peds with optional animations, scenarios, and weapon configurations. This system operates independently of any framework.

Functions

create_ped

Creates a ped based on provided data.

--- Define ped data
local ped_data = {
    base_data = {
        model = "a_m_m_business_01", -- Model of the ped
        coords = vector3(-254.09, -971.48, 31.22), -- Coordinates where the ped will be spawned
        scenario = "WORLD_HUMAN_AA_COFFEE", -- Scenario the ped will be using (optional)
        networked = false -- Whether the ped is networked or not
    },
    animation_data = { -- Optional
        dict = "amb@world_human_aa_coffee@base", -- Animation dictionary
        anim = "base", -- Animation name
        blend_in = 8.0, -- Blend in speed
        blend_out = -8.0, -- Blend out speed
        duration = -1, -- Duration of the animation
        flag = 49, -- Animation flag
        playback_rate = 1.0 -- Playback rate of the animation
    },
    weapon_data = { -- Optional
        weapon_name = "WEAPON_PISTOL", -- Weapon to give to the ped
        ammo = 100, -- Amount of ammo
        equip_now = true, -- Equip the weapon immediately
        is_hidden = false, -- Weapon is hidden or not
        accuracy = 100.0, -- Accuracy of the ped with the weapon
        invincible = true -- Ped is invincible or not
    }
}

--- Utils object
local your_ped = utils.peds.create_ped(ped_data)

--- Direct export
local your_ped = exports.boii_utils:create_ped(ped_data)

create_peds

Creates multiple peds from a table of ped data.

--- Define peds
local peds = {
    {
        base_data = {
            model = "a_f_y_hipster_01",
            coords = vector4(-250.00, -970.00, 31.22, 0.0),
            scenario = "WORLD_HUMAN_SMOKING",
            networked = false
        }
    },
    {
        base_data = {
            model = "a_m_m_beach_01",
            coords = vector4(-260.00, -975.00, 31.22, 0.0),
            scenario = "WORLD_HUMAN_MUSCLE_FLEX",
            networked = false
        },
        weapon_data = {
            weapon_name = "WEAPON_BAT",
            equip_now = true
        }
    }
}

--- Utils object
utils.peds.create_peds(peds)

--- Direct export
exports.boii_utils:create_peds(peds)

remove_ped

Removes a single ped.

--- Specify ped to remove
local ped_to_remove = ped

--- Utils object
utils.peds.remove_ped(ped_to_remove)

--- Direct export
exports.boii_utils:remove_ped(ped_to_remove)

remove_all_peds

Removes all created peds.

--- Utils object
utils.peds.remove_all_peds()

--- Direct export
exports.boii_utils:remove_all_peds()

remove_peds_by_categories

Removes peds by specified categories. Useful for resource clean up.

--- Specify categories
local categories_to_remove = { 'garage_peds', 'hospital_peds' }

--- Utils object
utils.peds.remove_peds_by_categories(categories_to_remove)

--- Direct export
exports.boii_utils:remove_peds_by_categories(categories_to_remove)

Last updated