---
description: All available client and server exports for use.
---

# Exports

## Client

### hideUI

***

This function hides the gang-related user interface (UI) elements on the player's screen.

* This function does not require any parameters.

**Usage Example:**

```lua
exports['zat-gangs']:hideUI()
```

In this example:

* The gang UI elements are hidden from the player's screen.



### hideCameraUI

***

This function hides the camera-related user interface (UI) elements from the player's screen.

* This function does not require any parameters.

**Usage Example:**

```lua
exports['zat-gangs']:hideCameraUI()
```

In this example:

* The camera UI elements are hidden from the player's screen.



### GetMyContractIdByResource

***

This  function retrieves the contract ID for the player based on the specified resource name.

```lua
exports['zat-gangs']:GetMyContractIdByResource(resource)
```

1. **`resource`** _(string)_
   * The name of the resource for which the contract ID is being retrieved.

**Returns:**

* **`contractId`** _(number)_
  * The contract ID associated with the specified resource.

**Usage Example:**

```lua
luaCopyEditlocal contractId = exports['zat-gangs']:GetMyContractIdByResource("zat-roofrunning")
print("Your contract ID is: " .. contractId)
```



### AmIMemberOfThisContractById

***

This function checks if the player is a member of a contract based on the provided contract ID.

```lua
exports['zat-gangs']:AmIMemberOfThisContractById(id)
```

1. **`id`** _(number)_
   * The contract ID to check membership for.

**Returns:**

* **`boolean`**
  * Returns `true` if the player is a member of the contract, `false` otherwise.

**Usage Example:**

```lua
local contractId = exports['zat-gangs']:GetMyContractIdByResource("zat-roofrunning")
local isMember = exports['zat-gangs']:AmIMemberOfThisContractById(contractId)

if isMember then
    print("You are a member of this contract.")
else
    print("You are not a member of this contract.")
end
```



### GetContractMembersById

***

This function retrieves the members associated with a specific contract ID

```lua
exports['zat-gangs']:GetContractMembersById(id)
```

1. **`id`** _(number)_
   * The contract ID to retrieve the members for.

**Returns:**

* **`members`** _(table)_
  * A table containing the IDs of members associated with the specified contract.

**Usage Example:**

```lua
luaCopyEditlocal contractId = exports['zat-gangs']:GetMyContractIdByResource("zat-roofrunning")
local contractMembers = exports['zat-gangs']:GetContractMembersById(contractId)

print(json.encode(contractMembers , {indent=true}))
```



### GetContractResourceById

***

This  function retrieves the resource associated with a specific contract ID.

```lua
exports['zat-gangs']:GetContractResourceById(id)
```

1. **`id`** _(number)_
   * The contract ID to retrieve the associated resource for.

**Returns:**

* **`resource`** _(string)_
  * The name of the resource associated with the given contract ID.

**Usage Example:**

```lua
luaCopyEditlocal contractId = 5  -- example contract ID
local contractResource = exports['zat-gangs']:GetContractResourceById(contractId)

print("Contract Resource: " .. contractResource)
```



### DisableContractById

***

This client-side function disables a contract based on the provided contract ID. It is typically used after starting a contract or mission to prevent further abuse or changes.

```lua
exports['zat-gangs']:DisableContractById(id)
```

1. **`id`** _(number)_
   * The contract ID to disable.

**Usage Example:**

```lua
luaCopyEditlocal contractId = exports['zat-gangs']:GetMyContractIdByResource("zat-roofrunning")
exports['zat-gangs']:DisableContractById(contractId)
```



## Server

### SetGang

***

This function sets a player's gang affiliation and rank.

```lua
exports['zat-gangs']:SetGang(source, identifier, gang, grade)
```

1. **`source`** _(number)_
   * The player executing the command. This is the source of the request.
2. **`identifier`** _(number)_
   * The in-game ID of the player whose gang affiliation is being set.
3. **`gang`** _(string)_
   * The name of the gang to assign to the target player.
4. **`grade`** _(number)_
   * The rank or grade within the gang to assign to the player.

**Usage Example:**

```lua
exports['zat-gangs']:SetGang(source, 23, "vagos", 2)
```

In this example:

* The player identified by `source` assigns player with ID `23` to the gang `"Vagos"` with the rank 2.



### GetGang

***

This function retrieves the gang information for a specified player.

```lua
exports['zat-gangs']:GetGang(source)
```

1. **`source`** _(number)_
   * The player whose gang information is being requested.

**Returns:**

* **`data`** _(table)_
  * A table containing the player's gang information:
    * **`data.gang`** _(string)_: The name of the gang the player is affiliated with.
    * **`data.grade`** _(number)_: The player's rank or grade within the gang.

**Usage Example:**

```lua
local data = exports['zat-gangs']:GetGang(source)
print("Gang Name: " .. data.gang)
print("Gang Grade: " .. data.grade)
```

In this example:

* The player's gang name and grade are retrieved and printed to the console.



### RemoveGang

***

This function removes a player's gang affiliation.

```lua
exports['zat-gangs']:RemoveGang(source, targetId)
```

1. **`source`** _(number)_
   * The player executing the command. This is the source of the request.
2. **`targetId`** _(number)_
   * The in-game ID of the player whose gang affiliation is to be removed.

**Usage Example:**

```lua
exports['zat-gangs']:RemoveGang(source, 23)
```

In this example:

* The player identified by `source` removes the gang affiliation of the player with ID `23`.



### AddGangMoney

***

This function adds money to a specified gang's fund.

```lua
exports['zat-gangs']:AddGangMoney(gang, amount, details)
```

1. **`gang`** _(string)_
   * The name of the gang to which the money will be added.
2. **`amount`** _(number)_
   * The amount of money to add to the gang's account.
3. **`details`** _(string)_
   * A text description or note to record under the transaction in the UI.

**Usage Example:**

```lua
exports['zat-gangs']:AddGangMoney("vagos", 5000, 'Gift from anonymous')
```

In this example:

* The gang `"Vagos"` is credited with `5000` units of currency.



### RemoveGangMoney

***

This function deducts money from a specified gang's fund.

```lua
exports['zat-gangs']:RemoveGangMoney(gang, amount, details)
```

1. **`gang`** _(string)_
   * The name of the gang from which the money will be deducted.
2. **`amount`** _(number)_
   * The amount of money to remove from the gang's fund.
3. **`details`** _(string)_
   * A text description or note to record under the transaction in the UI.

**Usage Example:**

```lua
exports['zat-gangs']:RemoveGangMoney("vagos", 2000, 'bills payment')
```

In this example:

* The gang `"Vagos"` has `2000` units of currency deducted from its fund.



### AddPoints

***

This function adds points to a specified gang.

```lua
exports['zat-gangs']:AddPoints(gang, points)
```

1. **`gang`** _(string)_
   * The name of the gang to which the points will be added.
2. **`points`** _(number)_
   * The number of points to add to the gang's total.

**Usage Example:**

```lua
exports['zat-gangs']:AddPoints("ballas", 15)
```

In this example:

* The gang `"Ballas"` is awarded `15` points.



### RemovePoints

***

This function removes points from a specified gang.

```lua
exports['zat-gangs']:RemovePoints(gang, points)
```

1. **`gang`** _(string)_
   * The name of the gang from which the points will be deducted.
2. **`points`** _(number)_
   * The number of points to remove from the gang's total.

**Usage Example:**

```lua
exports['zat-gangs']:RemovePoints("ballas", 10)
```

In this example:

* The gang `"Ballas"` has `10` points deducted from its total.



### SendNotification

***

This function sends a notification to a specified gang with optional location pinging.

```lua
exports['zat-gangs']:SendNotification(title, text, gang, coords
```

1. **`title`** _(string)_
   * The title of the notification.
2. **`text`** _(string)_
   * The body text of the notification.
3. **`gang`** _(string)_
   * The name of the gang that will receive the notification.
4. **`coords`** _(optional, vector3)_
   * A vector3 representing the coordinates of a location. If provided, clicking the notification will show a location ping on the map. If not provided, no location ping will be shown.

**Usage Example:**

```lua
exports['zat-gangs']:SendNotification("Mission Update", "The Vagos have a new mission!", "vagos", vector3(215.5, -1350.3, 30.5))
```

In this example:

* The `"Vagos"` gang receives a notification with the title `"Mission Update"` and the body text `"The Vagos have a new mission!"`.
* The notification also includes a clickable map location at the coordinates `vector3(215.5, -1350.3, 30.5)`.



### AddTrust

***

This function adds trust points to the player's gang's turf.

```lua
exports['zat-gangs']:AddTrust(src, index, amount)
```

1. **`source`**_(number)_
   * The player (source) who is performing the action.
2. **`index`** _(number)_
   * The turf index, which is the turf ID retrieved from the database (SQL).
3. **`amount`** _(number)_
   * The number of trust points to add to the specified turf.

**Usage Example:**

```lua
exports['zat-gangs']:AddTrust(source, 5, 100)
```

In this example:

* The player identified by `source` adds `100` trust points to the turf with ID `5`.



### GetMyContractIdByResource

***

This function retrieves the contract ID for a player based on a specified resource.

```lua
exports['zat-gangs']:GetMyContractIdByResource(source, resource)
```

1. **`source`** _(number)_
   * The player (source) whose contract ID is being requested.
2. **`resource`** _(string)_
   * The name of the resource to fetch the contract ID for. (script name)

**Returns:**

* **`contractId`** _(number)_
  * The contract ID associated with the specified resource and player.

**Usage Example:**

```lua
local contractId = exports['zat-gangs']:GetMyContractIdByResource(source, "zat-roofrunning")
print("Contract ID: " .. contractId)
```

In this example:

* The contract ID for the resource `"zat-roofrunning"` is retrieved for the player identified by `source` and printed to the console.



### GetContractResourceById

***

This function retrieves the resource associated with a specific contract ID.

```lua
exports['zat-gangs']:GetContractResourceById(id)
```

1. **`id`** _(number)_
   * The contract ID for which the resource is being retrieved.

**Returns:**

* **`resource`** _(string)_
  * The name of the resource associated with the given contract ID.

**Usage Example:**

```lua
local contractResource = exports['zat-gangs']:GetContractResourceById(5)
print("Contract Resource: " .. contractResource)
```

In this example:

* The contract ID for the `"zat-roofrunning"` resource is retrieved, and then the associated resource name is printed.



### GetContractMembersById

***

This function retrieves the members associated with a specific contract ID.

```lua
exports['zat-gangs']:GetContractMembersById(id)
```

1. **`id`** _(number)_
   * The contract ID for which the members are being retrieved. This can be obtained by using `GetMyContractIdByResource(source, resource)`.

**Returns:**

* **`members`** _(table)_
  * A table containing the list of members associated with the specified contract ID.

**Usage Example:**

```lua
local contractId = exports['zat-gangs']:GetMyContractIdByResource(source, "zat-roofrunning")
local contractMembers = exports['zat-gangs']:GetContractMembersById(contractId)
print(json.encode(contractMembers, {indent=true}))

```

In this example:

* The contract ID for the `"zat-roofrunning"` resource is first retrieved using `GetMyContractIdByResource`.
* Then, the list of members associated with that contract ID is printed.



### DisableContractById

***

This function disables a contract using the specified contract ID, usually after a contract or mission has started to prevent abuse.

```lua
exports['zat-gangs']:DisableContractById(id)
```

1. **`id`** _(number)_
   * The contract ID to be disabled. This ID can be obtained from functions like `GetMyContractIdByResource(source, resource)`.

**Usage Example:**

```lua
luaCopyEditlocal contractId = exports['zat-gangs']:GetMyContractIdByResource(source, "zat-roofrunning")
exports['zat-gangs']:DisableContractById(contractId)
```

In this example:

* The contract ID for the `"zat-roofrunning"` resource is retrieved and then the contract is disabled to prevent abuse after it has started.
