Skip to content

Client Exports

All client exports can be called from other client-side resources using the exports function.

Get the current player’s squad data.

local squad = exports['senor-squads']:GetSquad()

Returns:

  • table | nil - Squad data table if player is in a squad, nil otherwise

Squad Data Structure:

{
players = table,
name = string,
image = string,
maxplayers = number,
id = number,
owner = number
}

Example:

local squad = exports['senor-squads']:GetSquad()
if squad then
print("Squad name: " .. squad.name)
print("Squad owner: " .. squad.owner)
end

Check if the current player is in a squad.

local inSquad = exports['senor-squads']:IsInSquad()

Returns:

  • boolean - true if player is in a squad, false otherwise

Example:

if exports['senor-squads']:IsInSquad() then
print("Player is in a squad")
end

Open the squad menu for the current player.

exports['senor-squads']:OpenMenu()

Example:

-- Open squad menu from another resource
exports['senor-squads']:OpenMenu()

Check if a specific player is in the current player’s squad.

local isInSquad = exports['senor-squads']:IsPlayerInMySquad(playerId)

Parameters:

  • playerId (number) - The server ID of the player to check

Returns:

  • boolean - true if the player is in the current player’s squad, false otherwise

Example:

local targetPlayer = 2
if exports['senor-squads']:IsPlayerInMySquad(targetPlayer) then
print("Player " .. targetPlayer .. " is in my squad")
end

Get all players in the current player’s squad.

local players = exports['senor-squads']:GetSquadPlayers()

Returns:

  • table | nil - Array of player data if player is in a squad, nil otherwise

Example:

local players = exports['senor-squads']:GetSquadPlayers()
if players then
for _, player in ipairs(players) do
print("Player: " .. player.name .. " (ID: " .. player.serverId .. ")")
end
end

Check if a specific squad setting is enabled.

local isEnabled = exports['senor-squads']:IsSettingEnabled(setting)

Parameters:

  • setting (string) - The setting to check. Valid values: "relations", "blips", "tags", "hud"

Returns:

  • boolean - true if the setting is enabled, false otherwise

Example:

if exports['senor-squads']:IsSettingEnabled("blips") then
print("Blips are enabled")
end

Get the squad owner’s server ID.

local ownerId = exports['senor-squads']:GetSquadOwner()

Returns:

  • number | nil - The squad owner’s server ID if player is in a squad, nil otherwise

Example:

local ownerId = exports['senor-squads']:GetSquadOwner()
if ownerId then
print("Squad owner ID: " .. ownerId)
end

Get the relationship group hash for the current player’s squad.

local groupHash = exports['senor-squads']:GetRelationsGroupHash()

Returns:

  • number | nil - The relationship group hash if player is in a squad and relations are enabled, nil otherwise

Note: This function creates/adds the relationship group if it doesn’t exist. Use this to set relationships between squad members and other entities.

Example:

local groupHash = exports['senor-squads']:GetRelationsGroupHash()
if groupHash then
-- Set relationship between entities
SetPedRelationshipGroupHash(ped, groupHash)
end