Client Exports
Client Exports
Section titled “Client Exports”All client exports can be called from other client-side resources using the exports function.
GetSquad
Section titled “GetSquad”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,nilotherwise
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)endIsInSquad
Section titled “IsInSquad”Check if the current player is in a squad.
local inSquad = exports['senor-squads']:IsInSquad()Returns:
boolean-trueif player is in a squad,falseotherwise
Example:
if exports['senor-squads']:IsInSquad() then print("Player is in a squad")endOpenMenu
Section titled “OpenMenu”Open the squad menu for the current player.
exports['senor-squads']:OpenMenu()Example:
-- Open squad menu from another resourceexports['senor-squads']:OpenMenu()IsPlayerInMySquad
Section titled “IsPlayerInMySquad”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-trueif the player is in the current player’s squad,falseotherwise
Example:
local targetPlayer = 2if exports['senor-squads']:IsPlayerInMySquad(targetPlayer) then print("Player " .. targetPlayer .. " is in my squad")endGetSquadPlayers
Section titled “GetSquadPlayers”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,nilotherwise
Example:
local players = exports['senor-squads']:GetSquadPlayers()if players then for _, player in ipairs(players) do print("Player: " .. player.name .. " (ID: " .. player.serverId .. ")") endendIsSettingEnabled
Section titled “IsSettingEnabled”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-trueif the setting is enabled,falseotherwise
Example:
if exports['senor-squads']:IsSettingEnabled("blips") then print("Blips are enabled")endGetSquadOwner
Section titled “GetSquadOwner”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,nilotherwise
Example:
local ownerId = exports['senor-squads']:GetSquadOwner()if ownerId then print("Squad owner ID: " .. ownerId)endGetRelationsGroupHash
Section titled “GetRelationsGroupHash”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,nilotherwise
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