# Player functions

If you are a developer, you can add custom player functions to our admin menu. You can do that in `bridge/[your framework]/player_actions/actions_list.lua` file.

### Example

<div align="left"><figure><img src="/files/cIT56JtLf7peOApTOWKc" alt="" width="375"><figcaption></figcaption></figure></div>

{% code title="bridge/\[your framework]/player\_actions/actions\_list.lua" %}

```lua
---@class PlayerAction
---@field label string
---@field permission? string
---@field args? PlayerActionArgument[]
---@field onClick fun(player, args)

---@class PlayerActionArgument
---@field label? string
---@field placeholder? string Only for "text" inputs
---@field type 'text' | 'number' | 'range'
---@field value? string | number You can set default value
---@field min? number
---@field max? number
---@field step? number Only for "range" inputs

---@type PlayerAction[]
return {
  ...,
  {
    label = 'Give Item',
    permission = 'give_item',
    args = {
      {
        label = 'Item name',
        placeholder = 'bread',
        type = 'text'
      },
      {
        label = 'Amount',
        type = 'range',
        value = 1,
        min = 1,
        max = 250
      }
    },
    onClick = function(player, args)
      --[[
        args[1] - Item name
        args[2] - Amount
      ]]
    
      if #args[1] == 0 then
        return false, 'Invalid item name'
      end

      local attempt_give_item = lib.callback.await('lc_admin:player_actions:esx:attemptGiveItem', 100, player.source, args[1], args[2])
      if not attempt_give_item then
        return false, 'Invalid item name'
      end

      return true
    end
  },
  {
    label = 'Custom action',
    onClick = function(player)
      print(json.encode(player, {indent=true}))
      TriggerServerEvent('example:customAction', player)
    end
  }
}
```

{% endcode %}


---

# 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://libertycode.gitbook.io/docs/lc_adminmenu/player-functions.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.
