Before it worked for me fine, but when I’ve downloaded today again (and changed only background pic), I can’t close it properly! Nui focus is still there. Only mouse cursor…
Does anybody know what’s with it? It’s not modified in any way. After pressing M, tab opens. Then both escape or middle button does the same thing. Tab closes, but focus prevails -.-
Edit.: SOLVED - problem was in renaming the resource to different name
i made a pull request for animation and prop (that works), sadly i didnt use an “subject” or something… this was my first time using a pull request, sry if i did something wrong.
I’m getting memory usage errors from this now. It sucks because I put my penal code into it and it gets use a LOT. However, I can’t have a script that uses up my memory.
I fixed the high memory issue!
If you are using a command instead of control, use this:
You can’t have RegisterCommand inside Citizen.CreateThread (just learned this by mistake)
RegisterCommand("tablet", function()
OpenTablet()
end)
function OpenTablet()
tabEnabled = not tabEnabled -- Toggle tablet visible state
REQUEST_NUI_FOCUS(tabEnabled)
print("The tablet state is: " .. tostring(tabEnabled))
end
Citizen.CreateThread(
function()
-- Wait for nui to load or just timeout
local l = 0
local timeout = false
while not tabLoaded do
Citizen.Wait(0)
l = l + 1
if l > 500 then
tabLoaded = true --
timeout = true
end
end
if timeout == true then
print("Failed to load tablet nui...")
-- return ---- Quit
end
print("::The client lua for tablet loaded::")
REQUEST_NUI_FOCUS(false) -- This is just in case the resources restarted whilst the NUI is focused.
while true do
if (tabEnabled) then
local ped = GetPlayerPed(-1)
DisableControlAction(0, 1, tabEnabled) -- LookLeftRight
DisableControlAction(0, 2, tabEnabled) -- LookUpDown
DisableControlAction(0, 24, tabEnabled) -- Attack
DisablePlayerFiring(ped, tabEnabled) -- Disable weapon firing
DisableControlAction(0, 142, tabEnabled) -- MeleeAttackAlternate
DisableControlAction(0, 106, tabEnabled) -- VehicleMouseControlOverride
end
Citizen.Wait(0)
end
end
)