Skip to main content

client/main.lua

Automatisation du client pour les faction (menu boss)

  • Pour commencez vous devrez ajouter ceci tout en haut du fichier :

    local eventName <const> = {
    ['job'] = {
    set = 'setJob',
    get = 'getJob',
    label = 'setJobLabel',
    salary = 'setJobSalary',
    },

    ['faction'] = {
    set = 'setFaction',
    get = 'getFaction',
    label = 'setFactionLabel',
    salary = 'setFactionSalary',
    }
    }
  • Vous devez remplacer entièrement tout les fonctions que vous trouverez ci-dessous :

    ⚠️Attention!

    Vous avez une slider pour naviguer horizontalement en dessous

    📝Liste des fonctions
    function OpenBossMenu(society, close, options)
    options = options or {}
    local elements = {
    {unselectable = true, icon = "fas fa-user", title = TranslateCap('boss_menu')}
    }

    ESX.TriggerServerCallback('esx_society:isBoss', function(isBoss, selected)
    if isBoss then
    local defaultOptions = {
    checkBal = true,
    withdraw = true,
    deposit = true,
    wash = true,
    employees = true,
    salary = true,
    grades = true
    }

    for k,v in pairs(defaultOptions) do
    if options[k] == nil then
    options[k] = v
    end
    end

    if options.checkBal then
    elements[#elements+1] = {icon = "fas fa-wallet", title = TranslateCap('check_society_balance'), value = "check_society_balance"}
    end
    if options.withdraw then
    elements[#elements+1] = {icon = "fas fa-wallet", title = TranslateCap('withdraw_society_money'), value = "withdraw_society_money"}
    end
    if options.deposit then
    elements[#elements+1] = {icon = "fas fa-wallet", title = TranslateCap('deposit_society_money'), value = "deposit_money"}
    end
    if options.wash then
    elements[#elements+1] = {icon = "fas fa-wallet", title = TranslateCap('wash_money'), value = "wash_money"}
    end
    if options.employees then
    elements[#elements+1] = {icon = "fas fa-users", title = TranslateCap('employee_management'), value = "manage_employees"}
    end
    if options.salary then
    elements[#elements+1] = {icon = "fas fa-wallet", title = TranslateCap('salary_management'), value = "manage_salary"}
    end
    if options.grades then
    elements[#elements+1] = {icon = "fas fa-scroll", title = TranslateCap('grade_management'), value = "manage_grades"}
    end

    ESX.OpenContext("right", elements, function(menu,element)
    if element.value == "check_society_balance" then
    TriggerServerEvent('esx_society:checkSocietyBalance', society)
    elseif element.value == "withdraw_society_money" then
    local elements = {
    {unselectable = true, icon = "fas fa-wallet", title = TranslateCap('withdraw_amount'), description = "Withdraw money from the society account"},
    {icon = "fas fa-wallet", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount to withdraw..", inputMin = 1, inputMax = 250000, name = "withdraw"},
    {icon = "fas fa-check", title = "Confirm", value = "confirm"},
    {icon = "fas fa-arrow-left", title = "Return", value = "return"}
    }
    ESX.RefreshContext(elements)
    elseif element.value == "confirm" then
    local amount = tonumber(menu.eles[2].inputValue)
    if amount == nil then
    ESX.ShowNotification(TranslateCap('invalid_amount'))
    else
    TriggerServerEvent('esx_society:withdrawMoney', society, amount)
    ESX.CloseContext()
    end
    elseif element.value == "deposit_money" then
    local elements = {
    {unselectable = true, icon = "fas fa-wallet", title = TranslateCap('deposit_amount'), description = "Deposit some money into the society account"},
    {icon = "fas fa-wallet", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount to deposit..", inputMin = 1, inputMax = 250000, name = "deposit"},
    {icon = "fas fa-check", title = "Confirm", value = "confirm2"},
    {icon = "fas fa-arrow-left", title = "Return", value = "return"}
    }
    ESX.RefreshContext(elements)
    elseif element.value == "confirm2" then
    local amount = tonumber(menu.eles[2].inputValue)
    if amount == nil then
    ESX.ShowNotification(TranslateCap('invalid_amount'))
    else
    TriggerServerEvent('esx_society:depositMoney', society, amount)
    ESX.CloseContext()
    end
    elseif element.value == "wash_money" then
    local elements = {
    {unselectable = true, icon = "fas fa-wallet", title = TranslateCap('wash_money_amount'), description = "Deposit some money into the money wash"},
    {icon = "fas fa-wallet", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount to wash..", inputMin = 1, inputMax = 250000, name = "wash"},
    {icon = "fas fa-check", title = "Confirm", value = "confirm3"},
    {icon = "fas fa-arrow-left", title = "Return", value = "return"}
    }
    ESX.RefreshContext(elements)
    elseif element.value == "confirm3" then
    local amount = tonumber(menu.eles[2].inputValue)
    if amount == nil then
    ESX.ShowNotification(TranslateCap('invalid_amount'))
    else
    TriggerServerEvent('esx_society:washMoney', society, amount)
    ESX.CloseContext()
    end
    elseif element.value == "manage_employees" then
    OpenManageEmployeesMenu(society, options, selected)
    elseif element.value == "manage_salary" then
    OpenManageSalaryMenu(society, options, selected)
    elseif element.value == "manage_grades" then
    OpenManageGradesMenu(society, options, selected)
    elseif element.value == "return" then
    OpenBossMenu(society, nil, options, selected)
    end
    end)
    end
    end, society)
    end