🌐
MFPSCRIPTS- Documentation
  • πŸ”Documentation
  • 🐌Scripts
    • πŸ“±PhoneBattery
      • βš™οΈInstallation
      • ☎️Addidtional Phones
        • πŸ“±RoadPhone
        • πŸ“±GCPhone
        • πŸ“±HighPhone
        • πŸ“±D-Phone
        • πŸ“±NPWD
    • πŸ’ΈBanking
      • βš™οΈInstallation
    • πŸš”Policejob
      • βš™οΈInstallation
      • πŸ”—Script Intergrations
      • πŸ‘¨β€πŸ’»Developers
    • 🚧Progressbar
    • ℹ️Notification
    • πŸ—‘οΈScrapyard
    • 🎬HUD
    • πŸ“²Dispatches-App for LB-Phone
    • πŸ—ΊοΈMFP_AdvancedBlips
  • πŸ₯©Additional
    • βš™οΈINSTALL SCRIPTS
    • πŸ“΄FiveStatus
  • 🚫General Errors
    • πŸ“€es_extended
Powered by GitBook
On this page
  1. Scripts
  2. PhoneBattery
  3. Addidtional Phones

NPWD

PreviousD-PhoneNextBanking

Last updated 1 year ago

πŸ“± If you use

Add to your npwd/dist/game/client/cl_controls.lua.lua this:

------------------------------------
-- 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!

🐌
πŸ“±
☎️
πŸ“±
npwd