editable.lua

local lang = config.langs[config.lang]

function getPlayerName(PlayerData)
    local playerName = tgiCore.getCharacterName()
    if config.framework == "esx" then
        local serverId = GetPlayerServerId(PlayerId())
        return string.format("[%s] %s", serverId, playerName)
    elseif config.framework == "qb" then
        return string.format("[%s] %s", PlayerData.citizenid, playerName)
    end
end

function getPlayerJobName()
    if config.framework == "esx" then
        return PlayerData.job.grade_label
    elseif config.framework == "qb" then
        return PlayerData.job.label
    end
end

function setEngineDamage(vehicle, damage)
    TriggerEvent("qb-customs:setEngineDamage", vehicle, damage)
    SetVehicleEngineHealth(vehicle, damage)
end

function playSound(name, volume)
    if config.useTgiannSound then
        local data = {
            soundFile = name,
            soundMaxVolume = volume,
        }
        TriggerEvent("tgiann-sounds:play-sound", data)
    else
        TriggerEvent('InteractSound_CL:PlayOnOne', name, volume)
    end
end

function playSyncSound(entity, name, maxDistance, volume)
    if config.useTgiannSound then
        local data = {
            entity = entity,
            soundFile = name,
            checkDistance = true,
            maxDistance = maxDistance,
            soundMaxVolume = volume,
            sync = true,
        }
        TriggerEvent("tgiann-sounds:play-sound", data)
    else
        TriggerEvent('InteractSound_CL:PlayOnOne', name, volume)
    end
end

exports("seatbelt", function()
    return anyBeltActive()
end)

exports("inVehicle", function()
    return inVehicle
end)

if config.enableShowMoney then
    RegisterKeyMapping('+showmoney' .. config.showMoneyKey, lang.showMoney, 'keyboard', config.showMoneyKey)
    RegisterCommand('+showmoney' .. config.showMoneyKey, function()
        TriggerEvent("tgiann-lumihud:showmoney", true)
    end)
    RegisterCommand('-showmoney' .. config.showMoneyKey, function()
        TriggerEvent("tgiann-lumihud:showmoney", false)
    end)
end

Last updated