# NPWD

### 📱 If you use [npwd](https://forum.cfx.re/t/free-npwd-standalone-phone/4796066) <a href="#npwd" id="npwd"></a>

*Add to your* npw&#x64;*/*&#x64;ist/gam&#x65;*/client/*&#x63;l\_controls.lu&#x61;*.lua this:*

```lua
------------------------------------
-- MFPSCRIPTS - PhoneBattery-Edit --
------------------------------------

ESX = nil
Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end
end)

-- mfp-phonebattery
CreateThread(function()
    while true do
        Wait(500)
    -- Handle if the phone is already visible and escape menu is opened
        ESX.TriggerServerCallback('mfp_phonebattery:getBatteryStatus', function(result)
            if not result then
                exports.npwd:setPhoneDisabled(true)
            else
                exports.npwd:setPhoneDisabled(false)
            end
        end)
    end
end)

Citizen.CreateThread(function()
    while true do
        if IsControlJustReleased(0, 288) then 
            ESX.TriggerServerCallback('mfp_phonebattery:getBatteryStatus', function(result)
                if not result then
                    ESX.ShowNotification("Your Phone died. Recharge first!")
                end 
            end)
        end
    Citizen.Wait(0)
    end
end)
-- mfp-phonebattery
----------------------------------
```

*Thanks to Grosserkill for helping with this solution!*


---

# 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/npwd.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.
