> For the complete documentation index, see [llms.txt](https://titans-productions.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titans-productions.gitbook.io/documentation/redm/scripts/clans/development-api/client.md).

# Client

Before reading client and server exports and events, you can also edit specific code through escrow\_ignore.lua files that we provide in client and server directory folders.

### Exports

API Getter Function

```lua
local ClansAPI = exports.tp_clans:getAPI()
```

1. Get player data.

```lua
--- @return table
local PlayerData = ClansAPI.GetPlayerData()

--- @param PlayerData.ClanId return integer
--- @param PlayerData.IsLoaded return boolean
--- @param PlayerData.Clans return table
--- @param PlayerData.Teritories return table
--- @param PlayerData.SourceId return integer
--- @param PlayerData.Identifier return string
--- @param PlayerData.CharIdentifier return integer
--- @param PlayerData.CurrentDay return string
--- @param PlayerData.IsBusy return boolean
```

2. Get player raiding state (If player is raiding)

```lua
--- @return boolean
local isPlayerRaiding = ClansAPI.IsPlayerRaiding()
```

3. Get player raiding clan id.

```lua
--- @return integer
local raidedClanId = ClansAPI.GetRaidingClanId()
```

4. Get player clan leadership state (if the player is the leader of the clan)

```lua
--- @return boolean
local isLeader = ClansAPI.IsPlayerClanLeader()
```

5. Get clan data

```lua
-- @return table
local ClanData = PlayerData.Clans[PlayerData.ClanId]

--- @param ClanData.coords return table
--- @param ClanData.furnitures return table
--- @param ClanData.raids_history return table
--- @param ClanData.members return table
--- @param ClanData.notifications return table
--- @param ClanData.alliances return table
--- @param ClanData.identifier return string
--- @param ClanData.charidentifier return integer
--- @param ClanData.name return string
--- @param ClanData.id return integer
--- @param ClanData.ledger return integer
--- @param ClanData.upgrade return integer
--- @param ClanData.level return integer
--- @param ClanData.level_experience return integer
```

### Events

1. Send an advanced notification to the desired clan.

```lua

-- @param message : requires a string (the notification message)
-- @param notificationType : requires a string (success, info, warning)
-- @param isImportant : requires an integer value (0 = not important, 1 = important )
local data = {
    message = message, 
    type = notificationType, 
    important = isImportant,
}

TriggerServerEvent('tp_clans:server:notifications:send', clanId, data) -- client > server
```

2. Use any desired code when a mission has been successfully finished (weekly missions only). This event is triggered for all the clan members who are online.

```lua
RegisterNetEvent("tp_clans:client:missions:mission_success")
AddEventHandler("tp_clans:client:missions:mission_success", function(missionType)
    -- todo
end)
```

3. This event is triggered exactly once the place dynamite has been exploded.

```lua
-- @param clanId : requires an integer (main clan id)
-- @param targetClanId : requires an integer (enemy clan id)
-- @param coords : returns a table or a vector3 (the coords where the explosion has been made).

RegisterNetEvent('tp_clans:client:raids:on_dynamite_explosion')
AddEventHandler('tp_clans:client:raids:on_dynamite_explosion', function(clanId, targetClanId, coords)
    -- todo
end)
```
