KUB Trucking
Import & overrides
In kub_trucking root directory create a file called imports.lua, in which copy-paste the following code:
local isServer = IsDuplicityVersion()
local appId = 'kub_trucking'
if isServer then
CreateThread(function()
while GetResourceState("fd_laptop") ~= "started" do
Wait(500)
end
local added, errorMessage = exports.fd_laptop:addCustomApp({
id = appId,
name = "Trucking",
isDefaultApp = true,
needsUpdate = false,
icon = 'trucking.svg',
ui = ("https://cfx-nui-%s/web/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(1000, function()
TriggerClientEvent("kub_trucking: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
function SendNUIMessage(data)
if data.type == 'showUI' or data.type == 'hideUI' then
return
end
exports.fd_laptop:sendAppMessage(appId, data)
OriginalSendNUIMessage(data)
end
end
Edit fxmanifest.lua
At the root of kub_trucking 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',
'config.lua',
} Restart / Start server
Once you completed steps above, restart or start your server and enjoy KUB Trucking while using our laptop.