# D-Phone

### 📱 If you use [d-phone](https://store.deun.xyz/package/4865564) <a href="#d-phone" id="d-phone"></a>

**Everything should works fine for you, without anychanges!**

*if not then change /d-phone/client/client.lua - line 176*

```lua
Citizen.CreateThread(function()
    while true do
		Citizen.Wait(0)
		if IsControlJustReleased(0, 288) then
			if firstTime == true then
				TriggerServerEvent("d-phone:server:setvalues", GetPlayerServerId(PlayerId()), Config.backgroundurl, Config.darkbackgroundurl)
				SendNUIMessage({
					setvalues = true,
					backgroundurl = Config.backgroundurl ,
					darkbackgroundurl = Config.darkbackgroundurl ,
				})
				firstTime = false
			end
			
			
			if incall == true and phoneopen == true then 
				SendNUIMessage({
					hidePhone = true
				})
				phoneopen = false 
			else
				if isprogess == false then
					TriggerServerEvent("d-phone:server:checkphone", GetPlayerServerId(PlayerId()))
					isprogess = true
					Wait(100)
					if hasphone == true then
						DoPhoneAnimation('cellphone_text_in')
						if hasnumber == false then
							TriggerServerEvent("d-phone:server:checkphonenumber", GetPlayerServerId(PlayerId()))
						end
						Wait(100)

						TriggerServerEvent("d-phone:server:getphonedata", GetPlayerServerId(PlayerId()))
						TriggerServerEvent("d-phone:server:loadcontact", GetPlayerServerId(PlayerId()))
						newPhoneProp()
						
					else
						isprogess = false
						TriggerEvent("d-notification", _U("needphone"))
					end
				end
			end
		end
    end
end)
```

*to this:*

```lua
Citizen.CreateThread(function()
    while true do
		Citizen.Wait(0)
		if IsControlJustReleased(0, 288) then
		-- mfp-phonebattery --
        ESX.TriggerServerCallback('mfp_phonebattery:getBatteryStatus', function(result)
            if result then
		-- mfp-phonebattery --
			if firstTime == true then
				TriggerServerEvent("d-phone:server:setvalues", GetPlayerServerId(PlayerId()), Config.backgroundurl, Config.darkbackgroundurl)
				SendNUIMessage({
					setvalues = true,
					backgroundurl = Config.backgroundurl ,
					darkbackgroundurl = Config.darkbackgroundurl ,
				})
				firstTime = false
			end
			
			
			if incall == true and phoneopen == true then 
				SendNUIMessage({
					hidePhone = true
				})
				phoneopen = false 
			else
				if isprogess == false then
					TriggerServerEvent("d-phone:server:checkphone", GetPlayerServerId(PlayerId()))
					isprogess = true
					Wait(100)
					if hasphone == true then
						DoPhoneAnimation('cellphone_text_in')
						if hasnumber == false then
							TriggerServerEvent("d-phone:server:checkphonenumber", GetPlayerServerId(PlayerId()))
						end
						Wait(100)

						TriggerServerEvent("d-phone:server:getphonedata", GetPlayerServerId(PlayerId()))
						TriggerServerEvent("d-phone:server:loadcontact", GetPlayerServerId(PlayerId()))
						newPhoneProp()
						
					else
						isprogess = false
						TriggerEvent("d-notification", _U("needphone"))
					end
				end
			end
		-- mfp-phonebattery --
		else
			ESX.ShowNotification("~r~The phone battery is empty now. Recharge first!")
		end
		end)
		-- mfp-phonebattery --
		end -- if pressed
    end
end)
```

But in general everything should work fine without any changes! (tested with older version...)


---

# 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/d-phone.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.
