Config
Server & Client Supported
ภาพรวม
ฟังก์ชันสำหรับดึงข้อมูล Config และข้อมูลอาวุธต่างๆ
ที่อยู่ไฟล์
source/modules/core/config.lua
ฟังก์ชัน
GetConfig
ดึงข้อมูล Config ตาม key ที่ระบุ
key
string|nil
key ของ config ที่ต้องการ (ถ้าไม่ระบุจะดึงทั้งหมด)
ค่าที่ส่งกลับ: Config\|Config[]
- ข้อมูล Config
-- ตัวอย่างการใช้งาน
local notificationsConfig = AFUCore.GetConfig('Notifications')
local allConfig = AFUCore.GetConfig()
GetWeapon
ดึงข้อมูลอาวุธจากชื่ออาวุธ
wpn
string
ชื่ออาวุธ
ค่าที่ส่งกลับ: WeaponTable\|nil
- ข้อมูลอาวุธ หรือ nil ถ้าไม่พบ
-- ตัวอย่างการใช้งาน
local weapon = AFUCore.GetWeapon('WEAPON_PISTOL')
if weapon then
print(string.format('อาวุธ: %s, ความเสียหาย: %d', weapon.label, weapon.damage))
end
GetWeaponList
ดึงรายการอาวุธทั้งหมด
reqObject
boolean|nil
true = ส่งกลับเป็น object, false = ส่งกลับเป็น array
ค่าที่ส่งกลับ:
table<string, WeaponTable>
- ถ้า reqObject = truetable<WeaponTable>
- ถ้า reqObject = false
-- ตัวอย่างการใช้งาน
local weaponList = AFUCore.GetWeaponList(true)
for name, weapon in pairs(weaponList) do
print(string.format('อาวุธ: %s', weapon.label))
end
GetWeaponFromHash
ดึงข้อมูลอาวุธจาก hash
hash
number
hash ของอาวุธ
ค่าที่ส่งกลับ: WeaponTable
- ข้อมูลอาวุธ
-- ตัวอย่างการใช้งาน
local hash = GetHashKey('WEAPON_PISTOL')
local weapon = AFUCore.GetWeaponFromHash(hash)
print(string.format('อาวุธ: %s', weapon.label))
GetWeaponComponent
ดึงข้อมูลส่วนประกอบของอาวุธ
wpn
string
ชื่ออาวุธ
wcmp
string
ชื่อส่วนประกอบ
ค่าที่ส่งกลับ: WeaponComponent\|nil
- ข้อมูลส่วนประกอบ หรือ nil ถ้าไม่พบ
-- ตัวอย่างการใช้งาน
local component = AFUCore.GetWeaponComponent('WEAPON_PISTOL', 'clip_extended')
if component then
print(string.format('ส่วนประกอบ: %s', component.label))
end
GetWeaponLabel
ดึงชื่อแสดงผลของอาวุธ
wpn
string
ชื่ออาวุธ
ค่าที่ส่งกลับ: string
- ชื่อแสดงผลของอาวุธ
-- ตัวอย่างการใช้งาน
local label = AFUCore.GetWeaponLabel('WEAPON_PISTOL')
print('ชื่ออาวุธ:', label)
หมายเหตุ
ใช้สำหรับดึงข้อมูล Config และข้อมูลอาวุธในระบบ
Last updated