local isServer = IsDuplicityVersion()
local OriginalSendNUIMessage = SendNUIMessage
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,
ignoreInternalLoading = 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
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