# QbCore AmbulanceJob

**Integrating statebag with QBcore Ambulancejob**

This section uses **statebag** to ensure proper handling of the player’s state within the PvP arena. If you are unfamiliar with **statebag** or how to use it, please refer to the dedicated page that explains its usage.

If you're using the **QBcore ambulancejob** script, follow these steps to integrate the arena handling:

1. Open the `dead.lua` file located in the `client` folder.
2. Find the following line:

   <a class="button secondary">Copiar</a>

   ```lua
    if not IsEntityAPed(victim) then return end 
   ```
3. Directly below this line, add the following code:

   <a class="button secondary">Copiar</a>

   ```lua
   if LocalPlayer.state.inArena then return end
   ```
4. This ensures that the script does not handle reviving players inside the arena.

Next, open the `main.lua` file and locate the `ApplyImmediateEffects` function.

Inside this function, find the following line:

<a class="button secondary">Copiar</a>

```lua
local armor = GetPedArmour(ped)
```

1. Directly below it, insert:

   <a class="button secondary">Copiar</a>

   ```lua
   if LocalPlayer.state.inArena then return end
   ```

   This modification prevents the application of any immediate effects if the player is inside the PvP arena.

<figure><img src="https://3165241027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9c0Pe86hIb7L19e6P9Dk%2Fuploads%2Fptggc9xC0G7dAJp9U6PV%2Fimage.png?alt=media&#x26;token=542c8e4d-b76c-4a5e-b9b4-bf485882140d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3165241027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9c0Pe86hIb7L19e6P9Dk%2Fuploads%2FvACyXCqwBs9iZdG7cTnQ%2Fimage.png?alt=media&#x26;token=35688d2a-e273-47a3-a705-eadc8b15c04b" alt=""><figcaption></figcaption></figure>
