qbx_police

if not GetResourceState('qbx_police') == 'started' then return end

Jail = {
  ---@param author_stateid string
  ---@param target_stateid string
  ---@param jailTime number
  ---@return boolean
  detain = function(author_stateid, target_stateid, jailTime)
    local authorIdentifier = exports.drx_mdt:GetIdentifierByStateId(author_stateid)
    local targetIdentifier = exports.drx_mdt:GetIdentifierByStateId(target_stateid)

    if not authorIdentifier or not targetIdentifier then
      prints.error("Failed to retrieve identifiers for detainment")
      return false
    end

    local playerSource = exports.qbx_core:GetSource(targetIdentifier)
    if not playerSource then
      prints.error("Player source not found for identifier: %s", targetIdentifier)
      return false
    end

    TriggerEvent('police:server:jailPlayer', playerSource, jailTime)
    print("Player jailed successfully:", playerSource, jailTime)
    return true
  end
}

Last updated

Was this helpful?