Server exportları
Sağlık
Sağlık uygulamasının Sağlık Kimliği'ni ve sağlık kayıtlarını okuyan ve yazan server export'ları.
Sağlık uygulaması her karakter için bir Sağlık Kimliği ve bir sağlık kayıtları listesi tutar. Bir ambulans mesleği, hastane ya da eczane script'i bunları bu export'larla okur ve yazar. Bkz. Sağlık.
Her export'ta target bir server id'si (sayı), bir karakter identifier'ı ya da bir telefon numarasıdır (string). Identifier ya da numara çevrimdışı karakterler için de çalışır.
#Sağlık Kimliği
#GetMedicalProfile
Bir karakterin Sağlık Kimliği'ndeki her şeyi döndürür.
lua---@class MedicalProfile
---@field name string
---@field birthdate string|nil from the character
---@field age integer|nil
---@field gender string|nil
---@field blood string
---@field bloodLocked boolean true when the framework owns the blood type
---@field height integer|nil cm
---@field weight integer|nil kg
---@field donor boolean
---@field emergencyAccess boolean medics may open it
---@field allergies string[]
---@field conditions string[]
---@field medications string[]
---@field contacts { name: string, number: string, relation?: string }[]
---@field notes string|nil
---@field updatedAt integer
---@param target integer|string
---@return MedicalProfile|nil profile
exports['fx-phone']:GetMedicalProfile(target)
lualocal profile = exports['fx-phone']:GetMedicalProfile(source)
#GetBloodType
Bir karakterin kan grubunu döndürür.
lua---@param target integer|string
---@return string|nil blood one of O+, A+, B+, AB+, O-, A-, B-, AB-
exports['fx-phone']:GetBloodType(target)
lualocal blood = exports['fx-phone']:GetBloodType(source)
- QBCore ve Qbox'ta bu, framework'ün karaktere verdiği kan grubudur. Diğer framework'lerde telefon, ilk sorulduğunda her karaktere bir kan grubu verir ve onu saklar.
#SetBloodType
Bir karakterin kan grubunu değiştirir.
lua---@param target integer|string
---@param blood string
---@return boolean ok
exports['fx-phone']:SetBloodType(target, blood)
luaexports['fx-phone']:SetBloodType(source, 'O-')
- QBCore ve Qbox'ta framework'ün kendi değeri de değiştirilir.
#SetMedicalField
Sağlık Kimliği'nin tek bir alanını değiştirir.
lua---@param target integer|string
---@param key string
---@param value any
---@return boolean ok
exports['fx-phone']:SetMedicalField(target, key, value)
luaexports['fx-phone']:SetMedicalField(source, 'weight', 82)
key |
Değer |
|---|---|
blood |
Bir kan grubu |
height |
100 ile 250 arası (cm) ya da temizlemek için false |
weight |
30 ile 300 arası (kg) ya da temizlemek için false |
donor |
true / false |
emergencyAccess |
true / false |
allergies, conditions, medications |
Her biri en fazla 60 karakter olan en fazla 12 metinden oluşan bir liste. Liste eskisinin yerini alır |
contacts |
En fazla 3 adet { name, number, relation? } |
notes |
En fazla 500 karakter |
#Sağlık kayıtları
#AddMedicalRecord
Bir karakterin sağlık geçmişine bir kayıt yazar. Hasta bunu Sağlık uygulamasında görür ve bir bildirim alır.
lua---@class MedicalRecordInput
---@field kind? 'treatment'|'diagnosis'|'surgery'|'prescription'|'vaccine'|'test'|'checkup'|'injury'|'revive'|'note' default 'treatment'
---@field title string up to 80 characters; the only required field
---@field details? string up to 1000 characters (`description` is accepted too)
---@field doctor? string name shown on the record, up to 80 characters
---@field doctorIdentifier? string the medic's identifier, kept for your own lookups
---@field facility? string up to 80 characters
---@field severity? integer 0 info, 1 minor, 2 moderate, 3 serious, 4 critical
---@field cost? number shown on the record only; no money moves
---@field data? table small table of readings shown as a list, up to 2000 bytes as JSON
---@field days? number for a prescription: how long it is valid
---@field untilAt? integer or the end time in unix seconds
---@field at? integer record time in unix seconds; now by default
---@field notify? boolean false to add it without a notification
---@param target integer|string
---@param record MedicalRecordInput
---@return integer|nil id
---@return string|nil err
exports['fx-phone']:AddMedicalRecord(target, record)
lualocal id = exports['fx-phone']:AddMedicalRecord(patientSource, {
kind = 'prescription', title = 'Painkillers', details = 'Twice a day.', days = 5, doctor = 'Dr. Aras',
})
- Hatalar:
disabled(Config.Health.Enabled = false),invalid(tablo ya da başlık yok),not_found. - Bir karakterin kayıt sayısı
Config.Health.MaxRecords'u (varsayılan 200) aştığında en eskiler silinir. fx-phone:server:medicalRecordAddedserver event'ini tetikler. Bkz. Server event'leri.
#GetMedicalRecords
Bir karakterin kayıtlarını en yeniden başlayarak döndürür.
lua---@param target integer|string
---@param opts? { kind?: string, limit?: integer, since?: integer, active?: boolean } limit 1 to 200, default 60; since in unix seconds; active = true keeps records that have not expired
---@return table[] records
exports['fx-phone']:GetMedicalRecords(target, opts)
lualocal records = exports['fx-phone']:GetMedicalRecords(source, { kind = 'surgery', limit = 20 })
- Her kayıt:
{ id, kind, title, details, doctor, facility, severity, cost, data, untilAt, at }.
#GetActivePrescriptions
Hâlâ geçerli olan reçeteleri döndürür, en fazla 50 tane.
lua---@param target integer|string
---@return table[] prescriptions
exports['fx-phone']:GetActivePrescriptions(target)
luafor _, rx in ipairs(exports['fx-phone']:GetActivePrescriptions(source)) do print(rx.title, rx.untilAt) end
#RemoveMedicalRecord
Bir kaydı siler. Oyuncular kayıtları telefonlarından silemez.
lua---@param id integer the record id
---@return boolean removed
exports['fx-phone']:RemoveMedicalRecord(id)
luaexports['fx-phone']:RemoveMedicalRecord(recordId)
#Ambulans mesleği için
#ShowMedicalId
Bir hastanın Sağlık Kimliği'ni başka birinin telefonunda açar.
lua---@param viewer integer server id of the player who sees it
---@param patient integer server id of the patient
---@return boolean shown
exports['fx-phone']:ShowMedicalId(viewer, patient)
luaexports['fx-phone']:ShowMedicalId(medicSource, patientSource)
- Görüntüleyenin mesleği
Config.Health.MedicJobsiçindeyse hastanın kayıtlarını da görür ve telefondan kayıt ekleyebilir. - Bu, hasta acil erişimi kapatmış olsa bile çalışır: görüntüleyenin bakabileceğine karar veren senin script'indir, bu yüzden çağırmadan önce bunu kendin kontrol et.