# Server

### isStaff

Check if a player is part of the staff or not.\
If the player's staff returnGroup manages to return the group with the status or not

{% code fullWidth="false" %}

```lua
local result = exports.HRAdminMenu:isStaff(playerId: integer, returnGroup: boolean?): boolean, string?
```

{% endcode %}

### doesGroupExist

Check if group exists

{% code fullWidth="false" %}

```lua
local result = exports.HRAdminMenu:doesGroupExist(group: string?): boolean
```

{% endcode %}

### setStaff

Set someone as a staff member\
It returns 'playerFoundInStaff' if the player is already a staff member\
It returns 'invalidGroup' if the delivered staff group does not exist\
It returns 'idDoesNotExist' if the delivered player server Id does not exist

<pre class="language-lua" data-full-width="false"><code class="lang-lua"><strong>local result = exports.HRAdminMenu:setStaff(playerId: integer, group: string): 'playerFoundInStaff'|'invalidGroup'|'idDoesNotExist'?
</strong></code></pre>

### removeStaff

Remove someone from the staff\
It returns the group if everything's fine and player is already not a part of the staff\
It returns 'playerIsNotStaff' if the player was not part of the staff in the time, the export was executed\
It returns 'idDoesNotExist' if the delivered player server Id does not exist

{% code fullWidth="false" %}

```lua
local result = exports.HRAdminMenu:removeStaff(playerId: integer): 'playerIsNotStaff'|'idDoesNotExist'|string

-- Example

local result = exports.HRAdminMenu:removeStaff(1)
if result == 'playerIsNotStaff' then
    HRLib.Notify(source, 'This player is not part of the staff!', 'error')
elseif result == 'idDoesNotExist' then
    HRLib.Notify(source, 'Invalid player server id!', 'error')
else
    HRLib.Notify(source, ('You successfully removed player %s from the staff with group %s'):format(1, result)
end
```

{% endcode %}

### getPlayerGroup

Get someone's staff group

{% code fullWidth="false" %}

```lua
local result = exports.HRAdminMenu:getPlayerGroup(playerId: integer): string|'idDoesNotExist'?
```

{% endcode %}

### getStaff

Get all the registered staff members

<pre class="language-lua" data-full-width="false"><code class="lang-lua"><strong>local result = exports.HRAdminMenu:getStaff(): table[]
</strong>
--[[ Result format:
{
    {
        name = 'Henry', -- steam/fivem name
        steamHex = 'steam:00000',
        license = 'license:00000',
        discordId = 'discord:00000',
        group = 'mod'
    },
    {
        name = 'Ann',
        steamHex = 'steam:00000',
        license = 'license:00000',
        discordId = 'discord:00000',
        group = 'admin'
    }
}
]]
</code></pre>

### getActiveStaff

Get all the staff members in the server

<pre class="language-lua"><code class="lang-lua"><strong>local result = exports.HRAdminMenu:getActiveStaff(): table[]
</strong>
--[[ Result format:
{
    {
        id = 1,
        name = 'Henry', -- steam/fivem name
        steamHex = 'steam:00000',
        license = 'license:00000',
        discordId = 'discord:00000',
        group = 'mod'
    },
    {
        id = 2,
        name = 'Ann',
        steamHex = 'steam:00000',
        license = 'license:00000',
        discordId = 'discord:00000',
        group = 'admin'
    }
}
]]
</code></pre>


---

# 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://hrscripts.gitbook.io/hrscripts-documentation/resources/hradminmenu/exports/server.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.
