# outsider\_policeman

{% hint style="success" %}
CLIENT SIDE for light checks
{% endhint %}

<details>

<summary>statebags</summary>

{% code lineNumbers="true" %}

```lua
  -- is player on duty
  local isOnDuty = LocalPlayer.state.IsOnDuty
  
  -- is player police (meaning it has permissions as police)
  local isPolice = LocalPlayer.state.IsPolice
  
  -- is player a detective (meaning it can inspect bodies and samples)
  local isDetective = LocalPlayer.state.IsDetective
  
  -- is player in jail (is player currently in jail)
  local isJailed = LocalPlayer.state.IsJailed

  -- is player escaping (usefull to remove propmts to respawn) policeman handles that
  local isEscaping = Localplayer.state.IsEscapingPrison

```

{% endcode %}

</details>

{% hint style="success" %}
SERVER SIDE for light checks
{% endhint %}

<details>

<summary>statebags</summary>

{% code lineNumbers="true" %}

```lua
 -- is player on duty
  local isOnDuty = Player(source).state.IsOnDuty
  
  -- is player police
  local isPolice = Player(source).state.IsPolice
  
  -- is player a detective
  local isDetective = Player(source).state.IsDetective
  
  -- is player in jail
  local isJailed = Player(source).state.IsJailed
```

{% endcode %}

</details>

{% hint style="danger" %}
SERVER SIDE EXPORTS for security checks
{% endhint %}

<details>

<summary>exports</summary>

<pre class="language-lua" data-title=" Sync exports "><code class="lang-lua">---get is player on police duty
---@param source integer
local isOnDuty = exports.outsider_policeman:IsOnPoliceDuty(source)

---get is player in jail
---@param source integer
local isJailed = exports.outsider_policeman:IsPlayerJailed(source)

---get total players on duty
---@return number
local total = exports.outsider_policeman:GetTotalPlayersOnDuty()

---get total players on duty by job
---@param job string
---@return number
local total = exports.outsider_policeman:GetTotalPlayersOnDutyByJob(job)

---get total players on duty by town
---@param town string
---@return number
local total = exports.outsider_policeman:GetTotalPlayersOnDutyByTown(town)

---set player On duty
---@param source number
---@param town string
---@return boolean
<strong>local result = exports.outsider_policeman:SetPlayerOnDuty(source, town)
</strong>
---set player off duty
---@param source number
---@param town string
---@return boolean
local result = exports.outsider_policeman:SetPlayerOffDuty(source, town)

---get player total time on duty
---@param source number
---@return number, number, number
local hours, minutes, seconds = exports.outsider_policeman:GetPlayerTotalTimeOnDuty(source)

---get player total time off duty
---@param source number
---@return number, number, number
local hours, minutes, seconds = exports.outsider_policeman:GetPlayerTotalTimeOffDuty(source)


</code></pre>

</details>
