> ## Documentation Index
> Fetch the complete documentation index at: https://docs.r-scripts.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports

> Available exports for R_FFA integration

## Overview

R\_FFA provides exports for checking player status and getting player counts across all FFA arenas.

## Client-Side Exports

### Check if Player is in FFA

Check if the player is currently playing in an FFA arena.

#### Syntax

```lua theme={null}
exports["r_ffa"]:isInFFA()
```

#### Returns

| Type      | Description                                   |
| --------- | --------------------------------------------- |
| `boolean` | `true` if player is in FFA, `false` otherwise |

#### Example Usage

```lua theme={null}
-- Check if player is in FFA
local inFFA = exports["r_ffa"]:isInFFA()

if inFFA then
    print("Player is currently in an FFA arena")
else
    print("Player is not in FFA")
end
```

#### Exsample use cases

<AccordionGroup>
  <Accordion title="Disable Other Scripts" icon="ban">
    Disable certain features while player is in FFA:

    ```lua theme={null}
    -- In another resource
    if exports["r_ffa"]:isInFFA() then
        -- Disable phone, racing, etc.
        return
    end
    ```
  </Accordion>

  <Accordion title="Prevent Actions in FFA" icon="shield">
    Block certain actions while in FFA:

    ```lua theme={null}
    RegisterCommand('buyvehicle', function()
        if exports["r_ffa"]:isInFFA() then
            return
        end

        -- Continue with vehicle purchase
    end)
    ```
  </Accordion>
</AccordionGroup>

***

### Get Current Game Mode

Get the current FFA game mode the player is in.

#### Syntax

```lua theme={null}
exports["r_ffa"]:GetGameMode()
```

#### Returns

| Type              | Description                            |
| ----------------- | -------------------------------------- |
| `string` or `nil` | Game mode name, or `nil` if not in FFA |

#### Possible Values

* `"ffa"` - Free-for-all match
* `"1v1"` - 1v1 duel match
* `nil` - Not in any match

#### Example Usage

```lua theme={null}
-- Get current game mode
local gameMode = exports["r_ffa"]:GetGameMode()

if gameMode == "ffa" then
    print("Player is in FFA match")
elseif gameMode == "1v1" then
    print("Player is in 1v1 match")
else
    print("Player is not in any match")
end
```

#### Exsample use case

<AccordionGroup>
  <Accordion title="Mode-Specific Features" icon="gamepad">
    Enable different features based on game mode:

    ```lua theme={null}
    local gameMode = exports["r_ffa"]:GetGameMode()

    if gameMode == "1v1" then
        -- Show custom 1v1 specific UI
    elseif gameMode == "ffa" then
        -- Show custom FFA leaderboard
    end
    ```
  </Accordion>
</AccordionGroup>

***

## Server-Side Exports

### Get Total Player Count

Get the total number of players across all FFA arenas.

#### Syntax

```lua theme={null}
exports["r_ffa"]:GetTotalPlayerCount()
```

#### Returns

| Type     | Description                     |
| -------- | ------------------------------- |
| `number` | Total players in all FFA arenas |

#### Example Usage

```lua theme={null}
-- Get total player count
local totalPlayers = exports["r_ffa"]:GetTotalPlayerCount()

print("Total players in FFA: " .. totalPlayers)
```

#### Exsample use case

<AccordionGroup>
  <Accordion title="Command to show player count" icon="server">
    Show FFA activity on your server:

    ```lua theme={null}
    RegisterCommand('getffaplayers', function(source)
      local totalPlayers = exports["r_ffa"]:GetTotalPlayerCount() or 0

      TriggerClientEvent('ox_lib:notify', source, {
          title = 'FFA',
          description = ('FFA has %s total players'):format(totalPlayers),
          type = 'inform'
      })
    end, true)
    ```
  </Accordion>
</AccordionGroup>

## Need Help?

<Card title="Common Issues" icon="wrench" href="/r_ffa/common-issues">
  Check troubleshooting guide for more help
</Card>
