Editable Files

server/server.lua

local tgiCore = tgiCoreExports:getCore()
local lang = config.langs[config.lang]

if config.command.active then
    if config.framework == "qb" then
        tgiCore.core.Commands.Add(config.command.name, lang.command, {}, false, function(source, args)
            TriggerClientEvent("tgiann-graphic-menu:menu", source)
        end)
    else
        tgiCore.core.RegisterCommand({config.command.name}, 'user', function(xPlayer, args, showError)
            TriggerClientEvent("tgiann-graphic-menu:menu", xPlayer.source)
        end, false, {
            help = lang.command,
        })
    end
end

RegisterServerEvent("tgiann-graphic-menu:save")
AddEventHandler("tgiann-graphic-menu:save", function(data)
    local xPlayer = tgiCore.getPlayer(source)
    insert('INSERT INTO tgiann_graphic_menu (citizenid, graphics) VALUES (:citizenid, :graphics) ON DUPLICATE KEY UPDATE graphics = :graphics', {
        citizenid = tgiCore.getCid(xPlayer),
        graphics = json.encode(data),
    })
end)

tgiCore.cbFunction("tgiann-market:load", function(source, cb)
    local xPlayer = tgiCore.getPlayer(source)
    single('SELECT graphics FROM tgiann_graphic_menu WHERE citizenid = ?', {tgiCore.getCid(xPlayer)}, function(result)
        cb(result and json.decode(result.graphics) or nil)
    end)
end)

language files

config.langs.en = {
    menuHeader = "Graphics Settings",
    pvpGraphics = "PvP Graphics",
    clock = "Clock",
    shadow = "Shadows",
    lowLod = "Low LOD",
    hitFx = "Hit Effects",
    killEffect = "Kill Effect",
    fpsBoost = "FPS Boost (Experimental)",
    normal = "Normal",
    active = "Active",
    passive = "Passive",
    on = "On",
    off = "Off",
    command = "Change PvP Graphics Settings",
}

Last updated