Funkcje


Scoreboard:RegisterJobCounter

Pozwala na zarejestrowanie licznika dostępnych osób w danej pracy.

Syntax
--- icon: string
--- name: string
--- generator: function(): string
Scoreboard:RegisterJobCounter(name, icon, generator)
Example
Scoreboard:RegisterJobCounter('LSPD', 'fas fa-user-police', function()
    local displayCount = '0'
    local count = Jobs:GetJobActiveWorkersCount('police')

    if (count >= 4) then
        displayCount = count > 4 and '4+' or '4'
    else
        displayCount = count > 0 and '< 4' or '0'
    end

    if (count >= 8) then
        displayCount = count > 8 and '8+' or '8'
    end

    return displayCount
end)

Scoreboard:GetScoreboardJobsCounter

Pobiera wszystkie liczniki pracowników.

Syntax
local jobCounters = Scoreboard:GetScoreboardJobsCounter()
--- jobCounters: JobCounter[]
Example
Citizen.CreateThread(function()
    while true do
        local fractions = Scoreboard:GetScoreboardJobsCounter()

        for k, v in pairs(fractions) do
            SetConvarServerInfo(k, v.count)
        end

        Citizen.Wait(1000)
    end
end)
Types
JobCounter = {
    icon: string,
    count: string
}