# Exports & events

## Client side

<details>

<summary><strong>Opening the skill menu</strong></summary>

```lua
TriggerEvent('pc_skills:client:openSkillMenu')
```

```lua
exports.pc_skills:openSkillMenu()
```

Skills menu will open for player that triggers the export/event. There's also a /nui command

</details>

<details>

<summary><strong>Checking the skill level or xp</strong> </summary>

```lua
exports.pc_skills:getSkill("skillName", "type")
```

• skillName - string - skill name, for example - "skill1" \
• type - string - "xp", "lvl" or "\*" - depending on what you want to check

returns:\
\> An int value when using "xp" or "lvl"\
\> Table containing xp and lvl when using "\*"&#x20;

</details>

For safety reasons, setting lvl/xp or giving xp is possible only on server side.

## Server side

<details>

<summary><strong>Opening the skill menu for given player</strong></summary>

```lua
TriggerEvent('pc_skills:client:openSkillMenu', player)
```

```lua
exports.pc_skills:openSkillMenu(player)
```

• player - playerId -  id of the player you want to open menu for

Skills menu will open for target player

</details>

<details>

<summary><strong>Checking the skill level or xp of given player</strong></summary>

```lua
exports.pc_skills:getSkill(player, "skillName", "type")
```

• player - playerId - id of the player you want to check\
• skillName - string - skill name, for example - "skill1" \
• type - string - "xp", "lvl" or "\*" - depending on what you want to check

returns:\
\> An int value when using "xp" or "lvl"\
\> Table containing xp and lvl when using "\*"&#x20;

</details>

<details>

<summary>Setting xp or level for given player</summary>

```lua
exports.pc_skills:setSkill(player, "skillName", 'type', value)
```

• player - playerId - id of the player you want to set lvl/xp for\
• skillName - string - skill name, for example - "skill1" \
• type - string - "xp" or "lvl" - depending on what you want to set\
• value - int - number you want to set

example:\
exports.pc\_skills:setSkill(1, "skill1", 'lvl', 10) - sets lvl 10 of skill1 for player with id 1

</details>

<details>

<summary>Adding xp for given player</summary>

```lua
exports.pc_skills:giveXP(player, "skillName", value)
```

• player - playerId - id of the player you want to give xp to\
• skillName - string - skill name, for example - "skill1" \
• value - int - xp amount you want to give

example:\
exports.pc\_skills:giveXP(1, "skill1", 10) - gives 10 xp in skill1 to player with id 1

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.poisoncode.com/scripts/pc_skills/exports-and-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
