π±NPWD
π± If you use npwd
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!
Last updated