> For the complete documentation index, see [llms.txt](https://plug-and-play.gitbook.io/plug-and-play/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://plug-and-play.gitbook.io/plug-and-play/pap_core/modules/props.md).

# Props

## Client

<details>

<summary><strong>Récupération des Props</strong></summary>

<sub>Possible de récupérer les props d'un script en particulier ou tous directement.</sub>

```lua
---comment
---@param resource string|nil
---@return table
local props = exports["PAP_core"]:GetProp("PAP_admin")

--[[
props = {
     "19": { 
        "label": "Inconnue",
        "active": true,
        "distance": 150,
        "model": "prop_barriercrash_04",
        "identifier": "char1:59c016eae7ee9af669606b54753bc0060841fa25",
        "freeze": false,
        "grid": 403140250,
        "by": "51",
        "id": 19,
        "resource": "PAP_admin",
        "hash": 1871573721,
        "coords": {
            "x": 2502.4189453125,
            "y": 3149.76025390625,
            "z": 48.14687347412109
        },
        "rot": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        }
    },
    "20": { 
      ...
    }
}
]]
```

</details>

<details>

<summary><strong>Création du prop en prévisualisation</strong></summary>

<sub>Ceci permet de créer un prop avec la modification directement, cela permet de l'utiliser dans vos scripts pour placer un prop avec une visualisation de son emplacement.</sub>

{% code fullWidth="true" expandable="true" %}

```lua
---@param data table
---@param onTime boolean|nil
---@return boolean
exports["PAP_core"]:CreatePositionProp({
    model = model, -- model du props ex: "prop_tool_blowtorch"
    coords = coords -- mettre un position de 
}, false)
```

{% endcode %}

</details>

<details>

<summary><strong>Création d'un Prop</strong></summary>

<sub>Permet de créer un prop directement dans le système de Prop sans visualisation.</sub>

{% code fullWidth="true" expandable="true" %}

```lua
---comment
---@param data table
---@return boolean
exports["PAP_core"]:CreateProp({
    coords   = vec3(123.50, 521.50, 14.54),
    rot      = vec3(0.0, 0.0, 180.0),
    active   = true, -- Permet d'activer/désactiver un prop pour qu'il apparait ou non
    freeze   = true, -- Permet de rendre le props fixe
    model    = `prop_barrier_work05`, -- Model | site : https://gtahash.ru/
    distance = 50.0, -- Distance d'affichage du prop en fonction du quadrillage (50 recommandé)
    admin    = false, -- Rend le props persistant ou non au redemarrage du serveur
    label    = "Barrière de chantier" -- Affichage du props dans le menu admin
})

```

{% endcode %}

</details>

<details>

<summary><strong>Suppression d'un Prop</strong></summary>

<sub>Suppression d'un prop précis</sub>

```lua
---comment
---@param id string
---@return boolean
exports["PAP_core"]:DeleteProp("51")
```

</details>

<details>

<summary><strong>Modification d'un Prop</strong></summary>

<sub>La modification d'un prop permet de déplacer avec une visualisation et des commandes pour facilité son déplacement utile dans l'utilisation d'un script personnalisé.</sub>\ <sub>**onlyZ :**</sub> <sub></sub><sub>Permet de faire la rotation seulement sur l'axe Z.</sub>\ <sub>**Important :**</sub> <sub></sub><sub>l'utilisation de cette fonction est synchronisé, elle ne s'arrête une fois le prop modifié</sub>

```lua
---comment
---@param entity number
---@param onlyZ boolean|nil
---@return boolean|nil
exports["PAP_core"]:EditPositionMenu(entity, onlyZ)
```

</details>

## Server

<details>

<summary><strong>Récupération des Props</strong></summary>

<sub>Possible de récupérer les props d'un script en particulier ou tous directement.</sub>

```lua
---comment
---@param resource string|nil
---@return table
local props = exports["PAP_core"]:GetProp("PAP_admin")

--[[
props = {
     "19": { 
        "label": "Inconnue",
        "active": true,
        "distance": 150,
        "model": "prop_barriercrash_04",
        "identifier": "char1:59c016eae7ee9af669606b54753bc0060841fa25",
        "freeze": false,
        "grid": 403140250,
        "by": "51",
        "id": 19,
        "resource": "PAP_admin",
        "hash": 1871573721,
        "coords": {
            "x": 2502.4189453125,
            "y": 3149.76025390625,
            "z": 48.14687347412109
        },
        "rot": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        }
    },
    "20": { 
      ...
    }
}
]]
```

</details>

<details>

<summary><strong>Création d'un Prop</strong></summary>

<sub>Permet de créer un prop directement dans le système de Prop sans visualisation.</sub>

{% code fullWidth="true" expandable="true" %}

```lua
---comment
---@param data table
---@return boolean
exports["PAP_core"]:CreateProp({
    coords   = vec3(123.50, 521.50, 14.54),
    rot      = vec3(0.0, 0.0, 180.0),
    active   = true, -- Permet d'activer/désactiver un prop pour qu'il apparait ou non
    freeze   = true, -- Permet de rendre le props fixe
    model    = `prop_barrier_work05`, -- Model | site : https://gtahash.ru/
    distance = 50.0, -- Distance d'affichage du prop en fonction du quadrillage (50 recommandé)
    admin    = false, -- Rend le props persistant ou non au redemarrage du serveur
    label    = "Barrière de chantier" -- Affichage du props dans le menu admin
})

```

{% endcode %}

</details>

<details>

<summary><strong>Suppression d'un Prop</strong></summary>

<sub>Suppression d'un prop précis</sub>

```lua
---comment
---@param id string
---@return boolean
exports["PAP_core"]:DeleteProp("51")
```

</details>
