# GCPhone

### 📱 if you use [gcphone](https://github.com/Re-Ignited-Development/Re-Ignited-Phone/tree/master/resources/gcphone) <a href="#gcphone" id="gcphone"></a>

**Everything should works native, without anychanges!**

<details>

<summary>Still not closed when battery is empty?</summary>

*if you have problems and/or want to block the command-opening without enough battery then change /gcphone/client/client.lua - line 77*

```lua
RegisterCommand('phone', function(source) -- Toggles Phone Via Command. Can coment out.
  TooglePhone()
end, false)

--====================================================================================
--  
--====================================================================================
Citizen.CreateThread(function()
  while true do
    Citizen.Wait(0)
    if not menuIsOpen and isDead then
      DisableControlAction(0, 288, true)
    end
    if takePhoto ~= true then
      if IsControlJustPressed(1, Config.KeyOpenClose) then -- On key press, will open the phone
          TooglePhone()
      end
      if menuIsOpen == true then
        for _, value in ipairs(KeyToucheCloseEvent) do
          if IsControlJustPressed(1, value.code) then
            SendNUIMessage({keyUp = value.event})
          end
        end
        if useMouse == true and hasFocus == ignoreFocus then
          local nuiFocus = not hasFocus
          SetNuiFocus(nuiFocus, nuiFocus)
          hasFocus = nuiFocus
        elseif useMouse == false and hasFocus == true then
          SetNuiFocus(false, false)
          hasFocus = false
        end
      else
        if hasFocus == true then
          SetNuiFocus(false, false)
          hasFocus = false
        end
      end
    end
  end
end)lua
```

to:

```lua
RegisterCommand('phone', function(source) -- Toggles Phone Via Command. Can coment out.
  -- mfp-phonebattery --
   ESX.TriggerServerCallback('mfp_phonebattery:getBatteryStatus', function(result)
       if result then
          TooglePhone()
        else
          ESX.ShowNotification("The phone battery is empty now. Recharge first!")
        end
    end)
    -- mfp-phonebattery --
    -- TooglePhone()
end, false)

--====================================================================================
--  
--====================================================================================
Citizen.CreateThread(function()
  while true do
    Citizen.Wait(0)
    if not menuIsOpen and isDead then
      DisableControlAction(0, 288, true)
    end
    if takePhoto ~= true then
      if IsControlJustPressed(1, Config.KeyOpenClose) then -- On key press, will open the phone
          ESX.TriggerServerCallback('mfp_phonebattery:getBatteryStatus', function(result)
               if result then
                  TooglePhone()
                else
                  ESX.ShowNotification("The phone battery is empty now. Recharge first!")
                end
      end)
    -- mfp-phonebattery --
    -- TooglePhone()
      end
      if menuIsOpen == true then
        for _, value in ipairs(KeyToucheCloseEvent) do
          if IsControlJustPressed(1, value.code) then
            SendNUIMessage({keyUp = value.event})
          end
        end
        if useMouse == true and hasFocus == ignoreFocus then
          local nuiFocus = not hasFocus
          SetNuiFocus(nuiFocus, nuiFocus)
          hasFocus = nuiFocus
        elseif useMouse == false and hasFocus == true then
          SetNuiFocus(false, false)
          hasFocus = false
        end
      else
        if hasFocus == true then
          SetNuiFocus(false, false)
          hasFocus = false
        end
      end
    end
  end
end)
```

</details>

t


---

# 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://maxifaxipaxi-1.gitbook.io/mfpscripts-fivem-discontinued/scripts/phonebattery/phones/gcphone.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.
