πŸ“±GCPhone

Should work by default!

πŸ“± if you use gcphone

Everything should works native, without anychanges!

Still not closed when battery is empty?

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

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:

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)

t

Last updated