# qb-ambulancejob

{% hint style="info" %}
**Notification to EMS**

The following code detects the current property, and when a player sends a death message inside the property, it transmits the coordinates of the house entrance.
{% endhint %}

<pre class="language-lua" data-title="qb-ambulancejob/server/main.lua"><code class="lang-lua">RegisterNetEvent('hospital:server:ambulanceAlert', function(text)
    local src = source
    local ped = GetPlayerPed(src)
    local coords = GetEntityCoords(ped)
    local players = QBCore.Functions.GetQBPlayers()
    
<strong>    local playerProperty = exports['vms_housing']:GetPlayerCurrentProperty(source)
</strong><strong>    if playerProperty then
</strong><strong>        local property = exports['vms_housing']:GetProperty(playerProperty)
</strong><strong>        if property.object_id then
</strong><strong>            local building = exports['vms_housing']:GetProperty(property.object_id)
</strong><strong>            if building.type == 'building' then
</strong><strong>                property = building
</strong><strong>            end
</strong><strong>        end
</strong><strong>        if property.metadata?.exit then
</strong><strong>            coords = property.metadata.exit
</strong><strong>        end
</strong><strong>    end
</strong>    
    for _, v in pairs(players) do
        if v.PlayerData.job.name == 'ambulance' and v.PlayerData.job.onduty then
            TriggerClientEvent('hospital:client:ambulanceAlert', v.PlayerData.source, coords, text)
        end
    end
end)
</code></pre>

{% hint style="info" %}
**Kicking a player out of the property after respawning**
{% endhint %}

<pre class="language-lua" data-title="qb-ambulancejob/server/main.lua"><code class="lang-lua">RegisterNetEvent('hospital:server:RespawnAtHospital', function(hospitalIndex)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)

<strong>    exports['vms_housing']:DropPlayerFromProperty(src)
</strong>
    -- Rest of the code
end)
</code></pre>


---

# 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.vames-store.com/assets/vms_housing/guides/ambulance-integration/qb-ambulancejob.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.
