[request] html mdt

Here is the tablet i made. I ment to post it sooner.

I try to add the command “tablet” and when I restart any script the game or server is frozen, some solution to this or in that exact place I must place it because it makes me more comfortable to use by keyboard command.

-- Define the variable used to open/close the tab



local tabEnabled = false
local tabLoaded = true --false

function REQUEST_NUI_FOCUS(bool)
    SetNuiFocus(bool, bool) -- focus, cursor
    if bool == true then
        SendNUIMessage({showtab = true})
    else
        SendNUIMessage({hidetab = true})
    end
    return bool
end

 
RegisterNUICallback(
    "tablet-bus",
    function(data)
        -- Do tablet hide shit
        if data.load then
            print("Loaded the tablet")
            tabLoaded = true
        elseif data.hide then
	        DeleteEntity(tab)
	        ClearPedTasks(PlayerPedId())
            print("Hiding the tablet")
            SetNuiFocus(false, false) -- Don't REQUEST_NUI_FOCUS here
            tabEnabled = false
        elseif data.click then
        -- if u need click events
        end
    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
            -- Control ID 20 is the 'Z' key by default
            -- 244 = M
            -- Use https://wiki.fivem.net/wiki/Controls to find a different key
			
   

 RegisterCommand('tablet', function()
 
			 
			TriggerEvent("tabletanim2")
			
			
                tabEnabled = not tabEnabled -- Toggle tablet visible state
                REQUEST_NUI_FOCUS(tabEnabled)
                print("The tablet state is: " .. tostring(tabEnabled))
                Citizen.Wait(0)
           
			
            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
		end, false)	
			
            Citizen.Wait(0)
        end
    end
)



RegisterNetEvent( 'tabletanim2' )
AddEventHandler( 'tabletanim2', function()
    local ped = GetPlayerPed(-1)
    if not IsEntityPlayingAnim(ped, "amb@world_human_seat_wall_tablet@female@base", "base", 3) then
        RequestAnimDict("amb@world_human_seat_wall_tablet@female@base")
	  while not HasAnimDictLoaded("amb@world_human_seat_wall_tablet@female@base") do
      Citizen.Wait(100)
        end
	
        TaskPlayAnim(ped, "amb@world_human_seat_wall_tablet@female@base", "base", 8.0, -8, -1, 49, 0, 0, 0, 0)
         
tab = CreateObject(GetHashKey("prop_cs_tablet"), 0, 0, 0, true, true, true)
AttachEntityToEntity(tab, GetPlayerPed(-1), GetPedBoneIndex(GetPlayerPed(-1), 57005), 0.17, 0.10, -0.13, 20.0, 180.0, 180.0, true, true, false, true, 1, true)
          
		  Wait(2000)
		  
	  
                SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
 
		
		while IsEntityPlayingAnim(ped, "amb@world_human_seat_wall_tablet@female@base", "base", 3) do

		   Wait(1)
                
		
		if (IsControlPressed(0, 32) or IsControlPressed(1, 323) or IsControlJustPressed(1, 19) or IsControlPressed(0, 33) or IsControlPressed(0, 34) or IsControlPressed(0, 35)   ) then
 
				
                SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
                DeleteObject(tab)
                break
            end
        end
    end
end)





I know this post is old but the concept would be very nice have the outerbox be the tough-book screen then have the website boxed into it & use a command like /mdt or /cad !

Excuse me, did you grab a base to do that CAD or MDT?