RAHE Racing

Import & overrides

In rahe-racing root directory create a file called imports.lua, in which copy-paste the following code:

    local isServer = IsDuplicityVersion()
    local appId = 'rahe-racing'

    if isServer then
        CreateThread(function()
            while GetResourceState("fd_laptop") ~= "started" do
                Wait(500)
            end

            local added, errorMessage = exports.fd_laptop:addCustomApp({
                id = appId,
                name = "Racing",
                isDefaultApp = true,
                needsUpdate = false,
                icon = 'racing.svg',
                ui = ("https://cfx-nui-%s/resource/tablet/nui/index.html"):format(GetCurrentResourceName()),
                keepAlive = true,
                windowActions = {
                    isResizable = false,
                    isMaximizable = false,
                    isClosable = true,
                    isMinimizable = true,
                    isDraggable = false
                },
                windowDefaultStates = {
                    isMaximized = true,
                    isMinimized = false
                },
                onUseServer = function(source)
                    SetTimeout(500, function()
                        TriggerClientEvent('rahe-racing:client:openTablet', source)
                    end)
                end,
            })

            if not added then
                print("Could not add app:", errorMessage)
            end
        end)
    end

    if not isServer then
        local OriginalSendNUIMessage = SendNUIMessage

        function SetNuiFocus(hasCursor, disableInput) end

        local eventsWithoutPasstrought = {
            ['showLeaderboard'] = true,
            ['hideLeaderboard'] = true,
            ['updateHudGeneral'] = true,
            ['updateHudTime'] = true,
            ['updateHudBestLap'] = true,
            ['updateLeaderboard'] = true,
            ['showTrackCreationHelper'] = true,
            ['hideTrackCreationHelper'] = true
        }

        local eventsForLaptopAndTablet = {
            ['setLocale'] = true,
            ['loadOneTimeData'] = true,
            ['loadSharedData'] = true,
            ['loadRestrictionData'] = true
        }

        function SendNUIMessage(data)
            if data.action == 'showMenu' or data.action == 'hideMenu' then
                return
            end

            if eventsWithoutPasstrought[data.action] then
                return OriginalSendNUIMessage(data)
            end

            if eventsForLaptopAndTablet[data.action] then
                OriginalSendNUIMessage(data)
            end

            exports.fd_laptop:sendAppMessage(appId, data)
        end
    end

Edit fxmanifest.lua

At the root of rahe-racing directory open fxmanifest.lua file with your preferred file editor and add imports.lua to shared_scripts block. After edit, shared_scripts block should look like this:

    shared_scripts {
        '@ox_lib/init.lua',
        'imports.lua',
        'public/**/shared.lua',
        'resource/util/shared.lua'
    }

Restart / Start server

Once you completed steps above, restart or start your server and enjoy RAHE Racing while using our laptop.

Copyright © 2025 Felis Development