Skip to main content

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

exports["r_ffa"]:isInFFA()

Returns

TypeDescription
booleantrue if player is in FFA, false otherwise

Example Usage

-- 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

Disable certain features while player is in FFA:
-- In another resource
if exports["r_ffa"]:isInFFA() then
    -- Disable phone, racing, etc.
    return
end
Block certain actions while in FFA:
RegisterCommand('buyvehicle', function()
    if exports["r_ffa"]:isInFFA() then
        return
    end

    -- Continue with vehicle purchase
end)

Get Current Game Mode

Get the current FFA game mode the player is in.

Syntax

exports["r_ffa"]:GetGameMode()

Returns

TypeDescription
string or nilGame 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

-- 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

Enable different features based on game mode:
local gameMode = exports["r_ffa"]:GetGameMode()

if gameMode == "1v1" then
    -- Show custom 1v1 specific UI
elseif gameMode == "ffa" then
    -- Show custom FFA leaderboard
end

Server-Side Exports

Get Total Player Count

Get the total number of players across all FFA arenas.

Syntax

exports["r_ffa"]:GetTotalPlayerCount()

Returns

TypeDescription
numberTotal players in all FFA arenas

Example Usage

-- Get total player count
local totalPlayers = exports["r_ffa"]:GetTotalPlayerCount()

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

Exsample use case

Show FFA activity on your server:
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)

Need Help?

Common Issues

Check troubleshooting guide for more help