# Configuration

To ensure you have everything you need, we are constantly updating our config files.

```lua
-- Change the framework to 'QB' or 'ESX':
zr_config.framework = 'QB'

-- If you have custom frameworks names, you can change them here:
zr_config.QB = 'qb-core'
zr_config.ESX = 'es_extended'

-- Set it to true if you want the Logout Button to Open Multicharacter instead of making you leave the server.
zr_config.MulticharacterLogout = false

-- You can change the background blur from here:
zr_config.zr_blur = 'MenuMGIn'

-- Change disconnect message from here:
zr_config.disconnect = '[zr-pausemenu] You have been disconnected from the server'

-- Put here your discord server invite link:
zr_config.discord = 'https://discord.gg/FwedjEV6kY'

-- Here you can add/remove jobs
zr_config.jobs = {
    {id='police', name='police', suivname='officers', color='#00A8FF'},
    {id='taxi', name='taxi', suivname='drivers', color='#FFFF00'},
    {id='ems', name='ems', suivname='doctors', color='#FF5D5D'},
    {id='mechanic', name='mechanic', suivname='technician', color='#00FFCB'},
    {id='realestate', name='realestate', suivname='brokers', color='#FF9900'},
    {id='trucker', name='trucker', suivname='drivers', color='#DB61FF'},
}

-- Here you can translate the script to the language you prefer
zr_trans.discord = 'join our discord.'
zr_trans.maps = 'MAPS'
zr_trans.mapstxt = 'SHOW THE MAP OF THE CITY.'
zr_trans.settings = 'SETTINGS'
zr_trans.settingstxt = 'OPEN GAME SETTINGS MENU.'
zr_trans.rulestitle = 'SERVER RULES'
zr_trans.rules = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker."
zr_trans.back = 'Go back to game.'
zr_trans.disconnect = 'Disconnect from server.'
zr_trans.infostitle = 'Character Information.'
zr_trans.fname = 'First Name'
zr_trans.lname = 'Last Name'
zr_trans.gender = 'Gender'
zr_trans.male = 'MALE'
zr_trans.female = 'FEMALE'
zr_trans.dob = 'Birthdate'
zr_trans.job = 'Job'
zr_trans.cash = 'Cash'
zr_trans.bank = 'Bank'
zr_trans.currency = '$'
```

{% hint style="info" %}
Client Side :
{% endhint %}

```lua
local zr_menu_enabled = true

RegisterKeyMapping("zr-pausemenu:show", "", "keyboard", "ESCAPE")
RegisterCommand('zr-pausemenu:show', function ()
	if not IsPauseMenuActive() and not IsNuiFocused() then
		if not IsEntityDead(GetPlayerPed(-1)) then
			if (zr_menu_enabled) then
				zr_pausemenu_show()
			end
		end
	end
end)

function zr_pausemenu_hide()
    StopScreenEffect(zr_config.zr_blur)
    DisableIdleCamera(false)
	SetNuiFocus(false, false)
	SetNuiFocusKeepInput(false)
	SendNUIMessage({
		type = "zr-pausemenu:hide",
		toggle = false,
	});
end

RegisterNetEvent('zr-pausemenu:hide')
AddEventHandler('zr-pausemenu:hide', function()
	zr_pausemenu_hide()
end)

RegisterNetEvent('zr-pausemenu:disable')
AddEventHandler('zr-pausemenu:disable', function()
	zr_menu_enabled = false
end)

RegisterNetEvent('zr-pausemenu:enable')
AddEventHandler('zr-pausemenu:enable', function()
	zr_menu_enabled = true
end)

-- You can also add custom events to happen when you click on the disconnecting button.
function zr_call_logout()
	TriggerEvent('zr-multicharacter:start') -- Replace this event to whatever you want event you want to be triggered after clicking on the Disconnect Button.
	-- TriggerEvent('qb-multicharacter:client:chooseChar') For default qb-multicharacter
end
```

{% hint style="success" %}
Hide/Disable Pause Menu when Player is dead.
{% endhint %}

{% hint style="warning" %}
Configuration for **QBCore :**&#x20;
{% endhint %}

* **Step 1 :**  Open qb-ambulancejob -> client -> laststand.lua&#x20;
* **Step 2 :** Search for the **SetLastStand** function.

  ```lua
  function SetLaststand(bool)
  ```
* **Step 3 :** Add the following events&#x20;

  ```lua
  TriggerEvent('zr-pausemenu:hide')
  TriggerEvent('zr-pausemenu:disable')

  -----------------------------------------------------------------------------------
                                   How it should be: 
  -----------------------------------------------------------------------------------


  function SetLaststand(bool)
      local ped = PlayerPedId()
      if bool then
          Wait(1000)
          while GetEntitySpeed(ped) > 0.5 or IsPedRagdoll(ped) do Wait(10) end
          local pos = GetEntityCoords(ped)
          local heading = GetEntityHeading(ped)
          TriggerServerEvent("InteractSound_SV:PlayOnSource", "demo", 0.1)
          LaststandTime = Laststand.ReviveInterval
          if IsPedInAnyVehicle(ped) then
              local veh = GetVehiclePedIsIn(ped)
              local vehseats = GetVehicleModelNumberOfSeats(GetHashKey(GetEntityModel(veh)))
              for i = -1, vehseats do
                  local occupant = GetPedInVehicleSeat(veh, i)
                  if occupant == ped then
                      NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
                      SetPedIntoVehicle(ped, veh, i)
                  end
              end
          else
              NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
          end
          SetEntityHealth(ped, 150)
          if IsPedInAnyVehicle(ped, false) then
              LoadAnimation("veh@low@front_ps@idle_duck")
              TaskPlayAnim(ped, "veh@low@front_ps@idle_duck", "sit", 1.0, 8.0, -1, 1, -1, false, false, false)
          else
              LoadAnimation(lastStandDict)
              TaskPlayAnim(ped, lastStandDict, lastStandAnim, 1.0, 8.0, -1, 1, -1, false, false, false)
          end
          InLaststand = true
          TriggerEvent('zr-pausemenu:hide')
          TriggerEvent('zr-pausemenu:disable')
          TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.civ_down'))
          CreateThread(function()
              while InLaststand do
                  ped = PlayerPedId()
                  local player = PlayerId()
                  if LaststandTime - 1 > Laststand.MinimumRevive then
                      LaststandTime = LaststandTime - 1
                      Config.DeathTime = LaststandTime
                  elseif LaststandTime - 1 <= Laststand.MinimumRevive and LaststandTime - 1 ~= 0 then
                      LaststandTime = LaststandTime - 1
                      Config.DeathTime = LaststandTime
                  elseif LaststandTime - 1 <= 0 then
                      QBCore.Functions.Notify(Lang:t('error.bled_out'), "error")
                      SetLaststand(false)
                      local killer_2, killerWeapon = NetworkGetEntityKillerOfPlayer(player)
                      local killer = GetPedSourceOfDeath(ped)
                      if killer_2 ~= 0 and killer_2 ~= -1 then killer = killer_2 end
                      local killerId = NetworkGetPlayerIndexFromPed(killer)
                      local killerName = killerId ~= -1 and GetPlayerName(killerId) .. " " .. "("..GetPlayerServerId(killerId)..")" or Lang:t('info.self_death')
                      local weaponLabel = Lang:t('info.wep_unknown')
                      local weaponName = Lang:t('info.wep_unknown')
                      local weaponItem = QBCore.Shared.Weapons[killerWeapon]
                      if weaponItem then
                          weaponLabel = weaponItem.label
                          weaponName = weaponItem.name
                      end
                      TriggerServerEvent("qb-log:server:CreateLog", "death", Lang:t('logs.death_log_title', {playername = GetPlayerName(-1), playerid = GetPlayerServerId(player)}), "red", Lang:t('logs.death_log_message', {killername = killerName, playername = GetPlayerName(player), weaponlabel = weaponLabel, weaponname = weaponName}))
                      deathTime = 0
                      OnDeath()
                      DeathTimer()
                  end
                  Wait(1000)
              end
          end)
      else
          TaskPlayAnim(ped, lastStandDict, "exit", 1.0, 8.0, -1, 1, -1, false, false, false)
          InLaststand = false
          LaststandTime = 0
      end
      TriggerServerEvent("hospital:server:SetLaststandStatus", bool)
  end
  ```
* **Step 4 :** Open qb-ambulance -> client -> main.lua&#x20;
* **Step 5 :** Go to **'hospital:client:Revive'** event&#x20;

  ```lua
  RegisterNetEvent('hospital:client:Revive', function()
  ```
* **Step 6 :** Add the following Trigger after or before **ResetAll()**

  ```lua
  TriggerEvent('zr-pausemenu:enable')
  ResetAll()

  -----------------------------------------------------------------------------------
                                   How it should be: 
  -----------------------------------------------------------------------------------

  RegisterNetEvent('hospital:client:Revive', function()
      local player = PlayerPedId()

      if isDead or InLaststand then
          local pos = GetEntityCoords(player, true)
          NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z, GetEntityHeading(player), true, false)
          isDead = false
          SetEntityInvincible(player, false)
          SetLaststand(false)
      end

      if isInHospitalBed then
          loadAnimDict(inBedDict)
          TaskPlayAnim(player, inBedDict , inBedAnim, 8.0, 1.0, -1, 1, 0, 0, 0, 0 )
          SetEntityInvincible(player, true)
          canLeaveBed = true
      end

      TriggerServerEvent("hospital:server:RestoreWeaponDamage")
      SetEntityMaxHealth(player, 200)
      SetEntityHealth(player, 200)
      ClearPedBloodDamage(player)
      SetPlayerSprint(PlayerId(), true)
      ResetAll()
      ResetPedMovementClipset(player, 0.0)
      TriggerServerEvent('hud:server:RelieveStress', 100)
      TriggerServerEvent("hospital:server:SetDeathStatus", false)
      TriggerServerEvent("hospital:server:SetLaststandStatus", false)
      TriggerEvent('zr-pausemenu:enable')
      emsNotified = false
      QBCore.Functions.Notify(Lang:t('info.healthy'))
  end)

  ```

{% hint style="info" %}
Configuration for **ESX :**&#x20;
{% endhint %}

* **Step 1 :** Open esx\_ambulancejob > client -> main.lua
* **Step 2 :** Add the following events under **function OnPlayerDeath()**

  ```lua
  TriggerEvent('zr-pausemenu:hide')
  TriggerEvent('zr-pausemenu:disable')

  -----------------------------------------------------------------------------------
                                   How it should be: 
  -----------------------------------------------------------------------------------

  function OnPlayerDeath()
      isDead = true
      ESX.CloseContext()
      ClearTimecycleModifier()
      SetTimecycleModifier("REDMIST_blend")
      SetTimecycleModifierStrength(0.7)
      SetExtraTimecycleModifier("fp_vig_red")
      SetExtraTimecycleModifierStrength(1.0)
      SetPedMotionBlur(PlayerPedId(), true)
      TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
      StartDeathTimer()
      StartDeathCam()
      StartDistressSignal()
      TriggerEvent('zr-pausemenu:hide')
      TriggerEvent('zr-pausemenu:disable')
  end
  ```
* **Step 3 :** Add the following Event in **'esx\_ambulancejob:revive'** event

  ```lua
  TriggerEvent('zr-pausemenu:enable')

  -----------------------------------------------------------------------------------
                                   How it should be: 
  -----------------------------------------------------------------------------------

  RegisterNetEvent('esx_ambulancejob:revive')
  AddEventHandler('esx_ambulancejob:revive', function()
    local playerPed = PlayerPedId()
    local coords = GetEntityCoords(playerPed)
    TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)

    DoScreenFadeOut(800)

    while not IsScreenFadedOut() do
      Wait(50)
    end

    local formattedCoords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1)}

    RespawnPed(playerPed, formattedCoords, 0.0)
    isDead = false
    TriggerEvent('zr-pausemenu:enable')
    ClearTimecycleModifier()
    SetPedMotionBlur(playerPed, false)
    ClearExtraTimecycleModifier()
    EndDeathCam()
    DoScreenFadeIn(800)
  end)

  ```


---

# 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://0bugscripts.gitbook.io/0bugscripts/zbug-scripts/zbug-pausemenu/configuration.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.
