Police

Functions for checking how many police officers are online.


GetCopCount

Returns the number of players currently working a police job.

local count = KOJA.Server.GetCopCount()

Returns number

Also available as an export:

local count = exports['koja-lib']:getCopCount()

Configuration

Which jobs count as police is controlled by Config.PoliceGroups:

-- editable/shared/config.lua
Config.PoliceGroups = {
    ["police"]  = true,
    ["sheriff"] = true,
    ["swat"]    = true,
}

Examples


Callback

The cop count is also exposed as a server callback for client scripts: