member.access

GET · api v1

A yes/no answer: may this member use something that belongs to a قطاع? Combines status, rank and hiring ban. Made for armories, garages, doors and uniforms.

جواب نعم أو لا: هل يحق للعضو يستخدم شيء تابع للقطاع؟ يجمع الحالة والرتبة ومنع التوظيف. مخصص للمستودعات والكراجات والأبواب والملابس.

Parameters

NameTypeRequiredDescription
targetTargetrequiredWho to read about: { source = 7 } for an online player, { discord = "..." } or { code = "P-12" }.
factionstringrequiredThe in-game job name linked to the قطاع, e.g. "police".
min_ranknumberoptionalLowest rank index allowed, as shown in Ranks & Promotions.
allow_statusesstring[]optionalDefault { "active" }. Add "on_vacation" to let members on vacation in.

Returns (res.data)

NameTypeDescription
allowedbooleanThe answer.
reasonstring|nilWhy not: not_member | on_vacation | resigned | terminated | retired | rank_too_low | hiring_banned
reason_labelstring|nilArabic text you can show the player.
ranktable|nil{ index, name }

Possible errors

Notes

Example

RegisterNetEvent('armory:open', function()
    local src = source
    local res = exports.OrcaBot_V3:Get('member.access', {
        target = { source = src }, faction = 'police', min_rank = 3,
    })
    if res.ok and res.data.allowed then
        OpenArmory(src)
    elseif res.ok then
        TriggerClientEvent('ox_lib:notify', src, { description = res.data.reason_label, type = 'error' })
    end
end)

Example output

{
  "ok": true,
  "data": {
    "allowed": false,
    "reason": "rank_too_low",
    "reason_label": "رتبتك أقل من المطلوب",
    "rank": {
      "index": 2,
      "name": "جندي"
    }
  },
  "meta": {
    "action": "member.access",
    "method": "GET",
    "api": 1
  }
}