> For the complete documentation index, see [llms.txt](https://veil-development.gitbook.io/veil-development-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://veil-development.gitbook.io/veil-development-documentation/paid-resources/gang-system/available-functions.md).

# Available Functions

**Client Functions**

```lua
Functions.RayCast(dist: number, ignore_entity: entity) -> hit: boolean, endCoords: vector3, entityHit: entity, surfaceNormal: number, materialHash: string
Functions.Reload() --- Reloads the players Gang Data in the UI
Functions.LoadModel(model: strig) -> boolean
Functions.RequestScaleform(scaleform: scaleform]) -> loaded scaleform
Functions.PlacePed(cb: function], model: string]) -> vector4
Functions.GetCurrentGangTurf() -> string
Functions.GetCenterOfTurf(gangid: string) -> vector3
Functions.Get_Gang_Color() -> number
Functions.new_cam(is_spline: boolean) -> camera
Functions.new_player_cam() -> player camera
Functions.Fade() --- Fades and Unfades the screen for transitions
Functions.IsCoordinatesAtZero(coords: vector3 | vector4, is_vector4: boolean) -> boolean
Functions.Get_Heading_Between_Coords(coords1: vector3, coords2: vector3) -> number
Functions.PlaySound(soundName: string, volume: number) -- Plays sound if it is in the web/sounds folder
Functions.Generate_Random_Coordinates_By_Points(points: TerritoryPoints) -> vector3
-- ^ How to get territory points? -> GlobalState.GangData[gangid]?.territory?.points
Sprays.RequestSpray(gang: string, inEnemyTurf: boolean, enemyGang: string) -- Initiates Spraying Feature
-------------------------------------------------------------------------------
-- ^Here is a way to get inEnemyTurf and enemyGang if you need it. See below
local turf = Functions.GetCurrentGangTurf()
local inEnemyTurf, enemyGang
local plygang = QBCore.Functions.GetPlayerData().gang.name
if not (turf == plygang) then
    inEnemyTurf = true
    enemyGang = turf
end
Sprays.RequestSpray(plygang, inEnemyTurf, enemyGang)
-------------------------------------------------------------------------------
```

**Server Functions**

```lua
Territories:isPointInTerritory(coords: vector3, territory_points: TerritoryPoints) -> boolean
GetMembersOnline(gangid: string) -> number
Is_User_Main_Leader(gang: string, cid: string) -> boolean
Is_User_A_Gang_Leader(gang: string, cid: string) -> boolean
AddNotorietyToGang(gang: string, amount: number) -> boolean
Territories:getZone(source: number, coords: vector3 | vector4) -> string
Territories:does_territory_exist(gang: string, terid: string) -> boolean
TrapHouse:Fetch(id: string) -> table, class
TrapHouse:HasFunds(gang: string, amount: number) -> boolean
TrapHouse:GetStatus(id: string) -> number
Server.GetRandomSource() -> source
Server.GetRandomSourceNearCoords(coords: vector3) -> source 
-------- Trap House Class Functions ----------
# To use these you need to get the class, see below
local _, traphouse = TrapHouse:Fetch(id)
----------------------------------------------
traphouse:getWorth() -> number
traphouse:delete() -> nil -- Deletes the traphouse from the world, not the database
traphouse:getVehicles() -> table: { [1]: { model: string, props: table, parking_spot: number, ter_id: string, stored_by: string, stored_on: string} }
traphouse:status() -> number
traphouse:saveGangData() -> nil -- Saves the traphouse to the database
traphouse:changeStats(status: number) -> boolean -- Changes the status
traphouse:getPlayers(with_data: boolean) -> table -- Returns all players inside the traphouse
traphouse:deregisterAllPlayers() -> nil -- Removes all players out of the traphouse
```

**Server Exports**

```lua
exports['veil-gangs']:AddNotorietyToGang(gang: string, amount: number, source?: number, zone?: string)
exports['veil-gangs']:RemoveNotorietyFromGang(gang: string, amount: number, source?: number, zone: string)
```

For the `zone` variable, please utilize the following function on the server side

* Territories:getZone(source: number, coords: vector3) -> zone: string

If the zone variable is not provided it will use the provided source and use the current coords of that player for the zone notoriety change

For the `source` variable, please utilize either `Server.GetRandomSource` or `Server.GetRandomSourceNearCoords` to fulfill that requirement


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://veil-development.gitbook.io/veil-development-documentation/paid-resources/gang-system/available-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
