# Server

### Exports

<mark style="color:blue;">GetInsuredPlayers - Returns all insured players of the job</mark>

{% code fullWidth="false" %}

```lua
-- @param job: insurance job to get insured players from 
exports['gp_InsuranceSystem']:GetInsuredPlayers(job)

-- example usage
local Players = exports['gp_InsuranceSystem_ESX']:GetInsuredPlayers('ambulance')
for identifier,playerData in pairs(Players) do
    print("Identifier: " .. identifier ..
          "\nPlan: " .. playerData.plan .. 
          "\nPlayername: " .. playerData.playername ..
          "\nStartDate: " .. playerData.startDate ..
          "\nNextPaymentDate: " .. playerData.nextPaymentDate)
end
```

{% endcode %}

Variables for the playerData for each player:

| variable        | description                                   |
| --------------- | --------------------------------------------- |
| plan            | Plan name of the insurance/membership         |
| playername      | Name of the player                            |
| startDate       | Start date of the insurance/membership        |
| nextPaymentDate | Next payment date of the insurance/membership |

***

<mark style="color:blue;">GetPlanDetails - Returns the insurance/membership details of the player</mark>

{% hint style="warning" %}
You only need source or identifier! Input nil for the other parameter.
{% endhint %}

{% code fullWidth="false" %}

```lua
-- @param source: source of the player
-- @param identifier: identifier of the player (citizenid for QB)
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetPlanDetails(source, identifier, insurance)
```

{% endcode %}

| variable        | description                    |
| --------------- | ------------------------------ |
| label           | Insurance/Membership plan name |
| coverage        | coverage of the plan           |
| price           | price of the plan              |
| paymentInterval | payment interval of the plan   |
| startingPrice   | startingprice of the plan      |
| cancelPrice     | cancelprice of the plan        |

***

<mark style="color:blue;">GetPrivateInsuranceCoverage - Returns the insurance/membership coverage of the player</mark>

{% hint style="warning" %}
You only need source or identifier! Input nil for the other parameter.
{% endhint %}

```lua
-- @param source: source of the player
-- @param identifier: identifier of the player (citizenid for QB)
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetPrivateInsuranceCoverage(source, identifier, insurance)
```

***

<mark style="color:blue;">GetPlayerBusinessInsuranceCoverage</mark> \ <mark style="color:blue;">- Returns coverage of the players business insurance/membership</mark>

{% hint style="warning" %}
You only need source or identifier! Input nil for the other parameter.
{% endhint %}

```lua
-- @param source: source of the player
-- @param identifier: identifier of the player (citizenid for QB)
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetPlayerBusinessInsuranceCoverage(source, identifier, insurance)
```

***

<mark style="color:blue;">GetBusinessInsuranceDetails - Returns insurance/membership contitions of the business</mark>

```lua
-- @param business: business name to get conditions
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetBusinessInsuranceDetails(business, insurance)
```

| variable        | description       |
| --------------- | ----------------- |
| methode         | "fix" or "member" |
| coverage        | coverage          |
| price           | price             |
| paymentInterval | payment interval  |
| startingPrice   | startingprice     |
| cancelPrice     | cancelprice       |


---

# Agent Instructions: 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:

```
GET https://docs.gpscripts.dev/insurancesystem/developers/server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
