FiveM เสื้อผ้าไม่ขึ้น แก้อย่างไร ตรวจครบตั้งแต่ Resource ถึง Clothing Menu
ปัญหา FiveM เสื้อผ้าไม่ขึ้น เสื้อ Custom หาย Add-on Clothes ไม่เจอ หรือเพิ่ม Clothing Pack แล้วไม่มีเสื้อใหม่ในเมนู ไม่ได้เกิดจากสาเหตุเดียว เพราะระบบเสื้อผ้าของ FiveM มีหลายชั้นตั้งแต่ Resource, Manifest, Streaming Asset, Ped Model, Collection, Component, Drawable, Texture ไปจนถึง Clothing Menu
FiveM โหลด Content ผ่านระบบ Resources และ Resource ต้องมี Manifest ที่ถูกต้อง ขณะที่ระบบ Ped Clothing แยกข้อมูลตาม Ped Model, Component, Drawable และ Texture อีกชั้นหนึ่ง นอกจากนี้ FiveM ปัจจุบันยังมี Collection-based natives สำหรับจัดการ Custom Components และ Props โดย Local Index ภายใน Collection ถูกออกแบบให้คงที่หลัง GTA Title Updates.
บทความนี้จาก comsiam จะไล่ตรวจตั้งแต่กรณี Server หา Resource ไม่เจอ ไปจนถึงกรณี Resource Start สำเร็จแต่ Clothing Menu ยังไม่เห็นเสื้อใหม่
FiveM เสื้อผ้าไม่ขึ้น เกิดจากอะไร
สาเหตุหลักสามารถแบ่งเป็น
① Resource ไม่ถูกค้นพบ
② fxmanifest.lua ผิดหรืออยู่ผิด Folder
③ Resource ไม่ Start
④ Dependency/Policy ไม่ผ่าน
⑤ Clothing Assets ไม่ถูกโหลด
⑥ ใช้ Ped Model ผิด
⑦ Component ผิด
⑧ Drawable ผิด
⑨ Texture ผิด
⑩ Collection ผิด
⑪ Clothing Menu ไม่อ่าน Content ใหม่
⑫ Global Index เปลี่ยนหลัง GTA Update
⑬ Pack เสื้อผ้าชนกัน
⑭ Saved Outfit เก็บ ID แบบเก่า
วิธีแก้ที่เร็วที่สุดจึงไม่ใช่ล้าง Cache ก่อน แต่ต้องหาว่าเสียอยู่ Layer ไหน
① เริ่มจากดูว่า Resource ถูก FiveM มองเห็นหรือไม่
ก่อนตรวจเสื้อในเกม ต้องยืนยันว่า Server มอง Clothing Resource เป็น Resource จริง
โครงสร้างควรมีลักษณะเช่น
resources/
└── [clothes]/
└── police_clothes/
├── fxmanifest.lua
└── stream/
FiveM กำหนดให้ Resource มี Resource Manifest ซึ่งปัจจุบันใช้ fxmanifest.lua สำหรับกำหนด Files, Scripts และ Metadata ของ Resource.
② ตรวจปัญหา Folder ซ้อน
นี่เป็นสาเหตุที่พบได้ง่ายมากหลังแตก ZIP
ตัวอย่าง
police_clothes/
└── police_clothes/
├── fxmanifest.lua
└── stream/
แต่คุณนำ Folder ชั้นนอกไปวางเป็น Resource
สิ่งที่ต้องหาให้เจอคือ Folder ที่มี fxmanifest.lua อยู่จริง
เพราะ Manifest เป็นตัวบอก FXServer ว่า Folder นั้นเป็น Resource และต้องโหลดอะไรบ้าง.
③ อย่า Rename Folder แล้วลืมแก้ ensure
สมมติ Folder จริงชื่อ
pd_clothes
แต่ใน server.cfg เขียน
ensure police_clothes
Server จะไม่ได้ Start Resource ที่ต้องการ
ชื่อที่ใช้กับ ensure ต้องตรงกับ Resource ที่ Server รู้จัก
④ เพิ่งเพิ่มเสื้อใหม่ให้ใช้ refresh
ถ้า Server กำลังเปิดอยู่และเพิ่ง Copy Resource เข้า resources ให้ใช้
refresh
FiveM ระบุว่า refresh ใช้ Rescan Resources และ Manifests เพื่อให้ Resources ใหม่ถูกค้นพบ.
จากนั้นจึง Start Resource
⑤ หลัง refresh ใช้ ensure
ใช้
ensure police_clothes
FiveM ระบุว่า ensure จะ Start Resource หากยังไม่ได้ทำงาน หรือ Restart หาก Resource กำลังทำงานอยู่แล้ว.
ลำดับง่ายที่สุดคือ
refresh
ensure police_clothes
⑥ ถ้า refresh แล้วขึ้นชื่อ Resource แต่เสื้อยังไม่ขึ้น
แปลว่า Server รู้จัก Resource แล้ว
อย่าทำ
refresh
refresh
refresh
refresh
ต่อโดยไม่มีเหตุผล
ให้ย้ายไปตรวจขั้นต่อไป
Resource Started?
↓
Assets ถูกโหลด?
↓
Ped ถูก?
↓
Collection ถูก?
↓
Clothing Menu เห็นหรือไม่?
⑦ ตรวจ Console ตอน ensure
หาก
ensure clothing_pack
แล้วมี Error ต้องแก้ Error นั้นก่อน
โดยเฉพาะ
Missing dependency
Manifest Error
Resource ไม่พบ
Policy Constraint
File Reference ผิด
Resource Manifest รองรับ Dependency Constraints หลายประเภท ดังนั้น Manifest ของ Pack ที่ผู้สร้างเตรียมมาไม่ควรถูกลบหรือเขียนใหม่โดยไม่เข้าใจหน้าที่.
⑧ อย่าเขียน fxmanifest.lua ใหม่ทันที
บางคนเห็น Clothing Pack ไม่ขึ้นแล้วสร้าง
fx_version 'cerulean'
game 'gta5'
ใหม่ทันที
แต่ Manifest เดิมอาจมีข้อมูลสำคัญ เช่น
files
dependencies
dependency
policy constraints
client scripts
Resource Manifest ของ FiveM รองรับข้อมูลเหล่านี้โดยตรง.
ควรเก็บ Manifest ต้นฉบับไว้ก่อน
⑨ subdir_file_mapping เกี่ยวกับเสื้อผ้าอย่างไร
FiveM Resource Manifest มี Policy Constraint
/policy:subdir_file_mapping
และเอกสาร Cfx.re ระบุ subdir_file_mapping ว่าเกี่ยวข้องกับ clothing support.
หาก Clothing Resource ระบุ Dependency/Policy นี้ไว้ อย่าลบออกเพียงเพื่อทำให้ Manifest ดูสั้นลง
ถ้า Dependency ไม่ผ่านควรแก้สาเหตุตามเงื่อนไขของ Resource นั้น
⑩ Resource Start สำเร็จไม่ได้แปลว่าเสื้อพร้อมใช้
นี่เป็นจุดสำคัญมาก
Started resource custom_clothes
แปลว่า Resource เริ่มทำงาน
ไม่ได้ยืนยันว่า
Clothing Menu
สามารถมองเห็นและใช้ Drawables ใหม่ทั้งหมดได้
ระบบ Clothing ยังต้องตรวจ Ped, Components, Collections, Drawables และ Textures ต่อ
⑪ ตรวจ Ped Model ก่อน
FiveM ระบุว่า Component, Drawable และ Texture IDs สัมพันธ์กับ Ped Model.
ดังนั้นเสื้อที่ทำมาสำหรับ Ped หนึ่ง ไม่ควรถูกคาดหวังว่าจะใช้กับ Ped อีก Model ได้อัตโนมัติ
ตัวอย่าง
Asset สำหรับ Ped A
≠
รับประกันว่าจะใช้กับ Ped B
⑫ Male ขึ้น แต่ Female ไม่ขึ้น
กรณีนี้ Resource อาจไม่ได้เสียเลย
ให้ตรวจว่า Pack มี Asset สำหรับ Female หรือไม่ และ Clothing Script กำลัง Query Ped Female อย่างถูกต้องหรือไม่
เพราะ Drawables/Textures ถูกอ่านตาม Ped Model ที่กำลังใช้งาน.
⑬ Female ขึ้น แต่ Male ไม่ขึ้น
ใช้หลักเดียวกัน
อย่า Copy Drawable ID จาก Female ไป Male แล้วคาดว่าจะตรงกัน
ต้องตรวจ Variation ของ Ped Model นั้นโดยเฉพาะ
⑭ Component คืออะไร
FiveM ใช้ Components เพื่อแบ่งส่วนของเครื่องแต่งกาย
Native
SET_PED_COMPONENT_VARIATION
ใช้ componentId, drawableId, textureId และ paletteId เพื่อเปลี่ยน Variation ของ Ped.
ดังนั้นเสื้อไม่ขึ้นอาจเกิดเพราะ Clothing Script เรียกผิด Component
⑮ เสื้ออยู่ผิดหมวดใน Clothing Menu
ถ้า Asset อยู่ Component หนึ่ง แต่ Menu นำไปแสดงอีก Component อาจเกิดอาการ
หาเสื้อใน Tops ไม่เจอ
ทั้งที่ Asset ถูกโหลดแล้ว
จึงต้องตรวจ
Component ID
ของ Item จริงก่อน
⑯ Drawable คืออะไร
Drawable คือ Variation หลักภายใน Component
ตัวอย่างแนวคิด
Tops
├── Drawable 0
├── Drawable 1
├── Drawable 2
└── Drawable 3
FiveM มี GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS สำหรับดูจำนวน Drawable Variations ของ Component บน Ped.
จึงสามารถใช้ตรวจว่า Client มองเห็น Drawable เพิ่มขึ้นจริงหรือไม่
⑰ วิธีดูจำนวน Drawable
ตัวอย่าง
local ped = PlayerPedId()
local count = GetNumberOfPedDrawableVariations(ped, 11)
print("Drawable count:", count)
Native นี้รับ Ped และ Component ID แล้วคืนจำนวน Drawable Variations ของ Component นั้น.
ถ้าติดตั้ง Pack แล้ว Count ไม่เปลี่ยนเลย ควรตรวจ Asset/Collection/Resource ต่อ
⑱ Texture คืออะไร
Drawable หนึ่งตัวสามารถมีหลาย Texture Variations
เช่น
Drawable 50
├── Texture 0 = Black
├── Texture 1 = Blue
├── Texture 2 = Red
└── Texture 3 = Police Logo
FiveM แยก Drawable ID และ Texture ID ใน Ped Component Variation API โดยตรง.
⑲ เสื้อขึ้นแต่สีผิด
ถ้ารูปทรงเสื้อถูกแล้ว แต่สีหรือ Logo ผิด
ให้ตรวจ
textureId
ก่อน
อย่า Reinstall Resource เพราะ Drawable ถูกโหลดแล้ว
ปัญหาอาจเป็นเพียง Clothing Menu หรือ Database กำลังใช้ Texture Variation คนละตัว
⑳ Drawable ถูก แต่ Texture ไม่ขึ้น
ตรวจว่า Texture ID ที่ส่งไปอยู่ใน Range ที่ Drawable นั้นรองรับ
FiveM มี Native สำหรับ Query จำนวน Texture Variations ของ Ped Drawable โดยตรง.
อย่า Hard-code Texture สูง ๆ โดยไม่ตรวจจำนวนจริง
㉑ Collection คืออะไร
FiveM อธิบายว่า Collections คือกลุ่มของ Drawable Components หรือ Props ที่มีให้กับ Ped และ Collection มักสัมพันธ์กับ Base Game หรือ DLC/Content Collection ต่าง ๆ.
Custom Clothes สามารถถูกจัดอยู่ใน Collections เช่นกัน
ภาพรวม
Ped
↓
Collection
↓
Component
↓
Local Drawable
↓
Texture
㉒ วิธีเช็กจำนวน Collections ของ Ped
FiveM มี
GET_PED_COLLECTIONS_COUNT
สำหรับคืนจำนวน Variation Collections ที่มีให้กับ Ped.
ถ้า Clothing Pack ใช้ Collection-based Content การ Query Collections สามารถช่วยตรวจได้ว่า Client เห็น Collection Structure หรือไม่
㉓ Collection-based Clothes คืออะไร
FiveM มี Natives สำหรับเข้าถึง Drawable Components และ Props ผ่าน Collections โดยตรง และ Cfx.re ระบุว่า Collection-based indexes ถูกออกแบบให้ คงที่หลัง Title Updates.
นี่สำคัญมากกับ Add-on Clothes
เพราะปัญหา
GTA Update
↓
Global Index เลื่อน
↓
Outfit เก่าใส่คนละเสื้อ
สามารถลดลงได้เมื่อ Architecture ใช้ Collection + Local Index
㉔ Global Index กับ Local Index ต่างกันอย่างไร
Global Index
นับต่อจาก Collections ต่าง ๆ รวมกัน
Local Index
นับภายใน Collection นั้นเอง
Cfx.re ระบุว่า Global Index ของ Custom Components/Props สามารถเปลี่ยนหลัง Title Update แต่ Collection-relative Index ยังคง Stable.
ดังนั้น Saved Outfit ที่ใช้ Global Index อย่างเดียวมีความเสี่ยงต่อการเลื่อนหลัง Update
㉕ เสื้อไม่ขึ้นหลัง GTA Update
อย่า Reinstall Pack เป็นขั้นแรก
ตรวจก่อนว่า
Global Drawable ID
ที่ Clothing Script หรือ Database ใช้อยู่ยังชี้ไป Item เดิมหรือไม่
Cfx.re สร้าง Collection-based API เพื่อช่วยหลีกเลี่ยงปัญหา Global Index เปลี่ยนหลัง Title Updates โดยเฉพาะ.
㉖ เสื้อกลายเป็นคนละตัวหลัง Update
นี่ต่างจาก
เสื้อไม่โหลด
เพราะ Asset อาจยังอยู่ครบ แต่ Clothing Database กำลังอ้าง ID เดิมที่ตอนนี้หมายถึง Drawable คนละตัว
อาการเช่น
ก่อน Update
Drawable 180 = Police Shirt
หลัง Update
Drawable 180 = Jacket อื่น
ควรตรวจ Index Architecture ก่อนลบ Assets.
㉗ SetPedCollectionComponentVariation คืออะไร
FiveM มี Native
SET_PED_COLLECTION_COMPONENT_VARIATION
เป็นทางเลือกของ SET_PED_COMPONENT_VARIATION ที่ใช้ Local Collection Indexing แทน Global Index.
แนวคิด
SetPedCollectionComponentVariation(
ped,
componentId,
collection,
drawableId,
textureId,
paletteId
)
เหมาะสำหรับระบบ Clothing ที่ต้องการอ้าง Item ภายใน Collection อย่างชัดเจน
㉘ ตรวจว่า Collection Variation ใช้ได้ไหม
FiveM มี
IS_PED_COLLECTION_COMPONENT_VARIATION_VALID
ซึ่งคืน true เมื่อ Component Variation จาก Collection/Drawable/Texture ที่ระบุสามารถใช้ได้.
นี่มีประโยชน์มากในการ Debug
แทนที่จะ Apply ID แบบสุ่มแล้วดูว่าตัวละครหายหรือไม่
㉙ ตัวอย่าง Validate เสื้อก่อนใส่
ตัวอย่างแนวคิด
local valid = IsPedCollectionComponentVariationValid(
ped,
componentId,
collection,
drawableId,
textureId
)
print(valid)
หากเป็น false ให้ตรวจ Ped, Collection, Component, Drawable หรือ Texture ก่อน Apply.
㉚ เช็กจำนวน Drawable ภายใน Collection ได้ไหม
ได้
FiveM มี Collection-specific Native ที่คืนจำนวน Drawable Variations ภายใน Collection เดียว แทนการรวมทุก Collection เข้าด้วยกัน.
สิ่งนี้ช่วยแยกได้ว่า
Custom Collection มีจริง
แต่
Clothing Menu ไม่ได้อ่านมัน
หรือไม่
㉛ Resource ทำงาน แต่ Clothing Menu ไม่มี Item ใหม่
นี่เป็นอาการสำคัญ
ถ้า
Resource Started
+
Collections/Drawables มี
+
Menu ไม่มีรายการ
ให้ตรวจ Clothing Menu
อาจมี Logic เช่น
Max Drawable Hard-coded
Cache รายการเก่า
ไม่ Query Custom Collection
รองรับเฉพาะ Global Index
ปัญหาตอนนี้อยู่ที่ Menu Integration มากกว่าตัว Streaming Resource
㉜ วิธีแยกว่า Menu หรือ Asset มีปัญหา
ใช้ลำดับ
① Resource Start สำเร็จไหม
② Ped เห็น Collection ไหม
③ Drawable Count เพิ่มไหม
④ Variation Valid ไหม
⑤ Apply ผ่าน Native ได้ไหม
⑥ Clothing Menu แสดงไหม
ถ้าข้อ 1–5 ผ่าน แต่ข้อ 6 ไม่ผ่าน
ให้แก้ Clothing Menu
ไม่ใช่ Clothing Pack
㉝ Clothing Menu แสดง Item แต่กดแล้วไม่ขึ้น
ตรวจค่าที่ Menu ส่งไป
Ped
Component
Collection
Drawable
Texture
หาก Item ถูกแสดงจาก Database หนึ่งชุด แต่ตอน Apply ใช้อีก Index System หนึ่ง เช่น
Menu แสดง Local Index
แต่ Apply เป็น Global Index
เสื้ออาจไม่ขึ้นหรือขึ้นผิดตัว
㉞ Menu ใช้ Global Index แต่ Pack ใช้ Collection
สามารถเกิด Compatibility Problem ได้
FiveM รองรับทั้ง Global-style Ped Variation APIs และ Collection-based APIs แยกกัน.
จึงต้องแน่ใจว่า Menu เข้าใจ Index Type ของ Clothing Data ที่กำลังใช้
㉟ เสื้อขึ้นแต่แขนหาย
กรณีนี้ไม่ใช่ “เสื้อไม่โหลด” แล้ว
ให้ตรวจ Combination ของ
Top
Torso
Undershirt
เพราะตัว Drawable ของเสื้อถูกโหลดแล้ว แต่ Components ที่ประกอบ Character อาจไม่สัมพันธ์กัน
อย่าแก้ Manifest หากเสื้อขึ้นอยู่แล้ว
㊱ เสื้อขึ้นแต่ตัวทะลุ
อาจเป็นปัญหา
Mesh
Rigging
Weighting
Torso Combination
Undershirt Combination
Ped Model
ถ้า Asset เดียวมีปัญหากับผู้เล่นทุกคน ให้สงสัย Asset มากกว่า Resource Discovery
㊲ เสื้อโปร่งหรือบางส่วนหาย
ถ้า Drawable ปรากฏแล้วแต่บางส่วน Visual ผิด
ให้แยกปัญหา Asset Rendering ออกจาก Resource/Index
การ refresh หรือ ensure ซ้ำจะไม่ซ่อม Model/Texture ที่สร้างผิด
㊳ หมวกไม่ขึ้นแต่เสื้อขึ้น
เสื้อ Components และ Ped Props เป็นคนละระบบ
FiveM มี Collection-based APIs สำหรับทั้ง Drawable Components และ Props และ SET_PED_PROP_INDEX สำหรับ Prop Variations.
ดังนั้น Clothing Menu ต้องรองรับ Props แยกจาก Components
㊴ แว่นไม่ขึ้น
ใช้แนวคิดเดียวกับหมวก
ตรวจ
Prop Slot
Collection
Drawable
Texture
แทน Component ID ของเสื้อ
เพราะ Prop Variations มี API ของตัวเอง.
㊵ Props หลัง GTA Update ก็เพี้ยนได้ไหม
ได้
Cfx.re ระบุว่า Collection-based system ครอบคลุมทั้ง Drawable Components และ Props และถูกสร้างมาเพื่อลดปัญหา Index Migration หลัง Title Updates.
ดังนั้น Saved Hats/Glasses ก็ควรถูกตรวจเมื่อ Outfit เพี้ยนหลัง Update
㊶ Pack A ทำงาน แต่พอเพิ่ม Pack B แล้วเสื้อหาย
เริ่มทำ A/B Test
Pack A ON
Pack B OFF
จากนั้น
Pack A OFF
Pack B ON
แล้ว
Pack A ON
Pack B ON
ถ้า A และ B เดี่ยว ๆ ปกติ แต่เปิดพร้อมกันแล้วผิด ให้ตรวจ Conflict ระหว่าง Packs
㊷ Clothing Pack Conflict เกิดจากอะไร
อาจเกี่ยวข้องกับ
Asset Name ชน
Resource Merge ผิด
Collection/Index Logic
Files ถูก Replace
Clothing Menu Mapping
Saved Outfit ID
อย่าตัดสินว่าเป็น FiveM Cache โดยไม่ทำ Isolation Test ก่อน
㊸ Merge เสื้อหลาย Pack แล้วบางตัวหาย
ถ้า Original Resources ปกติ แต่หลัง Merge เสีย
ให้สงสัยการ Merge ก่อน
โดยเฉพาะกรณี
ไฟล์ชื่อเดียวกัน
↓
Copy
↓
Replace All
ไฟล์ของ Pack หนึ่งอาจถูกเขียนทับ
กลับไปทดสอบ Original Resources แยกก่อนสร้าง Asset ใหม่
㊹ อย่า Merge เพื่อหวังให้ Server เร็วขึ้น
FiveM Resources สามารถ Start/Stop/Restart แยกกันได้ และ Category Folders สามารถใช้จัด Resources หลายตัวได้.
ดังนั้นจำนวน Folder ที่ลดลงไม่ได้แปลว่า Clothing Performance จะดีขึ้นอัตโนมัติ
การแยก Pack ยังช่วย Debug ได้ง่ายกว่า
㊺ เสื้อไม่ขึ้นหลัง Restart Server
ถ้าตอนทดสอบใช้
refresh
ensure clothes
แล้วทำงาน
แต่ Restart Server แล้วหาย ให้ตรวจ Startup Configuration
เช่น
ensure clothes
ถูกใส่ไว้หรือไม่
FiveM Resource Commands รองรับการ Start Resources ผ่าน ensure โดยตรง.
㊻ Resource หาไม่เจอหลัง Restart
ตรวจ
Resource Path
Folder Name
Category Folder
Manifest
server.cfg
อย่าแก้ Clothing Menu ก่อน เพราะ Resource ยังไม่ขึ้นถึงขั้นนั้น
㊼ Resource Start ไม่ได้เพราะ Dependency
เปิด fxmanifest.lua
ดู
dependency
dependencies
รวมถึง Constraints ที่ Creator ระบุ
Resource Manifest ของ FiveM รองรับ Dependencies และ Constraints เพื่อกำหนดเงื่อนไขที่ Resource ต้องการ.
ถ้า Requirement ไม่ผ่านต้องแก้ Requirement นั้น ไม่ควรลบบรรทัด Dependency ทิ้งโดยอัตโนมัติ
㊽ Resource มี policy dependency
เช่น Manifest อาจระบุ Policy Constraint
FiveM รองรับ
/policy:...
และใน Documentation ระบุ subdir_file_mapping ว่าเกี่ยวข้องกับ clothing support.
หาก Resource ไม่ผ่าน Policy ที่มันประกาศ ต้องตรวจ Server Entitlement/Configuration ตาม Resource Requirements แทนการแก้ Asset Files แบบสุ่ม
㊾ Clothing Pack เก่าใช้ไม่ได้หลังเปลี่ยน Game Build
แยกสองเรื่องก่อน
Asset Compatibility
Asset หรือ Resource Requirements อาจไม่ตรง Environment ใหม่
Outfit Index
Global Index อาจเลื่อนหลัง Title Update
Resource Manifest รองรับ /gameBuild: Constraint และ Collection-based Documentation ระบุปัญหา Global Index หลัง Title Updates.
ต้องตรวจทั้งสองด้าน
㊿ อย่าเปลี่ยน Game Build เพื่อแก้เสื้อหนึ่งตัวทันที
Game Build เป็นเรื่องระดับ Server
หาก Clothing Resource อื่นทั้งหมดทำงาน แต่ Item หนึ่งตัวหาย
ควรตรวจ
Ped
Collection
Drawable
Texture
Asset
ก่อน
เปลี่ยน Game Build ทั้ง Server อาจสร้างปัญหากับ Resources อื่นมากกว่าเดิม
51. เสื้อไม่ขึ้นเฉพาะผู้เล่นคนเดียว
ถ้าผู้เล่นอื่นเห็นเสื้อปกติ ให้แยกเป็น Client-specific Problem
ตรวจ
Ped Model ของผู้เล่น
Saved Character Data
Clothing Menu State
Client Console
Outfit Data
แต่ถ้า ทุกคนไม่เห็นเสื้อชุดเดียวกัน ควรเน้น Resource/Asset/Index ฝั่ง Server Content ก่อน
52. ใช้ F8 ดู Error ได้ไหม
ได้
FiveM Client Console เปิดด้วยปุ่ม
F8
และ Cfx.re ระบุว่า Client Console ใช้สำหรับ Debug Resource Issues และ Developer Commands ต่าง ๆ.
หาก Clothing Script มี Client Error สามารถเห็นเบาะแสจาก Console ได้
53. Clothing Menu มี Error ใน F8
ถ้าเห็น Error จาก Resource เช่น
attempt to index
nil value
invalid drawable
collection not found
ควรแก้ Script/ข้อมูลตาม Error
อย่าล้าง Client Cache ก่อนหาก Console บอก Root Cause ชัดอยู่แล้ว
54. ตรวจ Variation ก่อน Apply ช่วยลด Error
ถ้าพัฒนาระบบ Clothing เอง สามารถ Validate ก่อน Apply ได้
FiveM มี
IS_PED_COLLECTION_COMPONENT_VARIATION_VALID
สำหรับ Collection-based Component Variations.
แนวคิด
Database Outfit
↓
Validate
↓
Valid?
├── Yes → Apply
└── No → Fallback / Log Error
ดีกว่า Apply ID เสียให้ Character โดยตรง
55. ระบบ Clothing ควร Query จำนวน Drawable แทน Hard-code
FiveM มี Native สำหรับดูจำนวน Drawable Variations ของ Component และ Collection โดยตรง.
ดังนั้น Menu ที่พัฒนาเองควรพิจารณา Query ข้อมูลจริง
แทน
for drawable = 0, 500 do
แบบ Hard-code โดยไม่รู้ว่า Ped มี Drawable เท่าไร
56. Collection Name หาได้หรือไม่
FiveM มี Collection APIs สำหรับดึงชื่อ Collection และแปลงระหว่าง Global/Collection-relative Drawable Information.
จึงสามารถสร้าง Debug Tool เพื่อพิมพ์
Collection
Local Drawable
Global Drawable
ของ Item ปัจจุบันได้
มีประโยชน์มากสำหรับ Migration Saved Outfits
57. Outfit Database ควรเก็บอะไร
ถ้าใช้ Collection-based Architecture ควรพิจารณาเก็บอย่างน้อย
Ped Model
Component ID
Collection Name
Local Drawable ID
Texture ID
และ Props แยกตาม Prop Slot
เหตุผลคือ Local Collection Index ถูกออกแบบให้คงที่หลัง GTA Title Updates มากกว่า Global Index.
58. Outfit เก่าควรลบทิ้งไหมถ้าเสื้อเพี้ยน
ไม่ควรลบทิ้งทั้ง Database เป็นขั้นแรก
ถ้าปัญหาเกิดจาก Global Index Shift สามารถออกแบบ Migration ไป Collection + Local Index ได้แทน
FiveM มี Native สำหรับแปลงข้อมูลระหว่าง Global Drawable และ Collection-relative Information ซึ่งช่วยงาน Migration ได้.
59. Resource เสื้อผ้าต้องมี Script ไหม
ไม่จำเป็นเสมอไป
FiveM Resource สามารถเป็น Collection ของ Streaming Assets และ Files ได้ ไม่จำเป็นต้องมี Gameplay Script ทุกตัว.
ดังนั้น Clothing Asset Resource อาจทำงานร่วมกับ Clothing Menu ที่อยู่คนละ Resource
60. ไม่มี SQL แปลว่า Pack เสียไหม
ไม่
Asset-only Clothing Resource ไม่จำเป็นต้องมี Database
SQL มักเป็นหน้าที่ของ Character/Clothing System สำหรับบันทึก
Outfit
Appearance
Shop Purchases
Job Uniforms
อย่า Import SQL จากแหล่งอื่นแบบสุ่มเพื่อแก้ Asset ที่ไม่ขึ้น
61. เสื้อผ้าไม่ขึ้นต้องล้าง Cache ไหม
ไม่ควรเป็นขั้นตอนแรก
ถ้า
ทุก Client
+
เสื้อตัวเดียวกัน
+
ไม่ขึ้นเหมือนกัน
ต้นเหตุมีโอกาสอยู่ที่ Resource/Asset/Index/Menu มากกว่า Client Cache รายเครื่อง
ก่อนล้าง Cache ควรผ่าน
Resource
Manifest
Ped
Collection
Drawable
Texture
Menu
ให้ครบก่อน
62. เสื้อขึ้นช้าเกี่ยวกับ Streaming ไหม
ถ้า Item แสดงใน Menu ถูกต้อง แต่ Visual Asset โหลดช้าหรือมีปัญหาเฉพาะ Client บางเครื่อง จึงค่อยพิจารณา Streaming/Client Asset State เพิ่ม
แต่ถ้า Menu หา Item ไม่เจอเลย ให้แก้ Index/Collection/Resource ก่อน
อย่ารวมปัญหา “ไม่พบ Item” กับ “Asset โหลดช้า” เป็นเรื่องเดียวกัน
63. เสื้อผ้าจำนวนมากทำให้ระบบหา Item ยากขึ้นอย่างไร
เมื่อ Server มี
Base GTA Clothes
+
Official DLC
+
Custom Collection A
+
Custom Collection B
+
Custom Collection C
Global Index Management จะซับซ้อนขึ้น
FiveM จึงมี Collection-based APIs ซึ่งช่วยให้ Developer อ้าง Item จาก Collection โดยตรง และลดผลกระทบของ Title Update ต่อ Custom Index.
64. วิธี Debug FiveM เสื้อผ้าไม่ขึ้นแบบเร็วที่สุด
ใช้ลำดับนี้
ขั้นที่ 1 — ตรวจ Resource Root
หา
fxmanifest.lua
Resource ต้องมี Manifest ที่ถูกต้อง.
ขั้นที่ 2 — ใช้ refresh
refresh
ให้ Server Rescan Resources.
ขั้นที่ 3 — ใช้ ensure
ensure clothes_resource
เพื่อ Start/Restart Resource.
ขั้นที่ 4 — อ่าน Console
แก้ Manifest/Dependency Error ก่อน
ขั้นที่ 5 — ตรวจ Ped Model
Drawable/Texture IDs ขึ้นกับ Ped Model.
ขั้นที่ 6 — ตรวจ Collection Count
ใช้ Collection APIs ดูว่า Ped มี Collections ที่คาดไว้หรือไม่.
ขั้นที่ 7 — ตรวจ Drawable Count
GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS
ช่วยดูจำนวน Drawables ของ Component.
ขั้นที่ 8 — Validate Collection Variation
IS_PED_COLLECTION_COMPONENT_VARIATION_VALID
ตรวจว่า Combination ใช้ได้จริงหรือไม่.
ขั้นที่ 9 — Apply โดยตรงเพื่อแยก Menu
ถ้า Collection Variation Valid และ Apply ผ่าน Native ได้ แต่ Clothing Menu หาไม่เจอ ให้ตรวจ Menu Integration
ขั้นที่ 10 — ตรวจ Global vs Local Index
โดยเฉพาะหลัง GTA Update.
ขั้นที่ 11 — ปิด Clothing Pack อื่น
ทำ A/B Test หา Conflict
ขั้นที่ 12 — ทดสอบ Save/Load Outfit
เพื่อดูว่า Database เก็บ Index ถูกระบบหรือไม่
ตารางสรุป FiveM เสื้อผ้าไม่ขึ้น
| อาการ | จุดที่ควรตรวจ |
|---|---|
| Server หา Clothing Resource ไม่เจอ | Folder / Manifest |
| เพิ่ม Resource แล้วไม่เจอ | refresh |
| Resource ไม่ Start | ensure / Console |
| Manifest Error | fxmanifest.lua |
| Dependency Error | Resource Requirements |
| Resource Start แต่ไม่มีเสื้อ | Ped / Collection / Menu |
| Male ไม่ขึ้น | Male Ped Asset |
| Female ไม่ขึ้น | Female Ped Asset |
| เสื้ออยู่ผิดหมวด | Component |
| เสื้อคนละตัว | Drawable / Index |
| สีหรือ Logo ผิด | Texture ID |
| เสื้อขึ้นแต่แขนหาย | Top/Torso/Undershirt |
| หมวกไม่ขึ้น | Prop System |
| Menu ไม่มี Item แต่ Native ใส่ได้ | Clothing Menu |
| GTA Update แล้ว Outfit เปลี่ยน | Global Index Shift |
| Pack ใหม่ทำ Pack เก่าพัง | Asset/Collection Conflict |
| Merge แล้วเสื้อหาย | Files ถูก Replace |
| Restart Server แล้วหาย | Startup Configuration |
| ผู้เล่นคนเดียวมีปัญหา | Client/Character State |
| ทุกคนมีปัญหาเหมือนกัน | Resource/Asset/Index |
Checklist ก่อนแก้แบบหนัก
ตรวจให้ครบก่อน
☐ Resource Folder ถูก
☐ fxmanifest.lua อยู่ Resource Root
☐ refresh แล้ว
☐ ensure สำเร็จ
☐ Console ไม่มี Resource Error
☐ Dependencies ผ่าน
☐ Ped Model ถูก
☐ Component ถูก
☐ Collection ถูก
☐ Drawable มีจริง
☐ Texture มีจริง
☐ Variation Valid
☐ Clothing Menu Query Item ได้
☐ Global/Local Index ไม่ปนกัน
☐ Saved Outfit ไม่ใช้ ID เก่าผิดตัว
☐ ไม่มี Pack Conflict
☐ server.cfg Start Resource หลัง Restart
การตรวจจาก Resource → Ped → Collection → Variation → Menu จะช่วยลดการแก้แบบสุ่มได้มาก
วิธีแยก Root Cause ภายในไม่กี่ขั้น
จำสูตรนี้
Server หา Resource ไม่เจอ
→ Resource/Manifest
Resource Start แต่ Ped ไม่มี Item
→ Asset/Collection
Ped มี Item แต่ Menu ไม่มี
→ Clothing Menu
Menu มี Item แต่ใส่ไม่ได้
→ Component/Drawable/Texture/Index
ใส่ได้แต่ผิดตัวหลัง Update
→ Global Index
เสื้อขึ้นแต่แขนหาย
→ Clothing Combination
เสื้อขึ้นแต่ Texture ผิด
→ Texture
Pack เดี่ยวปกติ เปิดร่วมแล้วพัง
→ Conflict
นี่เป็นวิธีคิดที่มีประโยชน์กว่าการลง Resource ใหม่ทุกครั้ง
ระบบ Clothing ระยะยาวควรใช้ Collection-based Index หรือไม่
สำหรับ Server ที่ควบคุม Clothing Script เองและมี Add-on Clothes จำนวนมาก ควรพิจารณาอย่างจริงจัง
Cfx.re ระบุว่าการใช้ Collection-based natives ช่วยให้ Collection-relative Index คงที่หลัง Title Updates และลดงาน Migration ของ Custom Clothes/Props ในอนาคต.
โครงสร้างข้อมูลที่เหมาะจึงอาจเป็น
Ped Model
↓
Collection
↓
Component / Prop
↓
Local Drawable
↓
Texture
แทนการบันทึก Global Drawable Number อย่างเดียว
สิ่งที่ไม่ควรทำเมื่อ FiveM เสื้อผ้าไม่ขึ้น
หลีกเลี่ยง
ล้าง Cache ก่อนตรวจ Resource
Reinstall FiveM ทั้งเครื่องทันที
เขียน fxmanifest.lua ใหม่โดยเดา
ลบ Dependency เพื่อให้ Resource Start
เปลี่ยน Game Build ทั้ง Server
ใช้ Male Drawable กับ Female
เพิ่มเลข Drawable แบบสุ่ม
Merge ทุก Pack เป็น Folder เดียว
กด Replace All
ลบ Outfit Database เพราะชุดเพี้ยน
แต่ให้หาก่อนว่าปัญหาอยู่ Resource, Ped, Collection, Index, Asset หรือ Menu
สรุป FiveM เสื้อผ้าไม่ขึ้น แก้อย่างไร
ถ้า FiveM เสื้อผ้า Custom ไม่ขึ้น ให้เริ่มจาก Resource Layer ก่อน
Clothing Pack
↓
Resource Root
↓
fxmanifest.lua
↓
refresh
↓
ensure
FiveM ใช้ Resource Manifest เพื่อกำหนด Resource และมี refresh สำหรับ Rescan Resources ขณะที่ ensure ใช้ Start หรือ Restart Resource.
เมื่อ Resource Start สำเร็จแล้ว ให้ตรวจต่อ
Ped Model
↓
Collection
↓
Component
↓
Drawable
↓
Texture
↓
Clothing Menu
เพราะ FiveM ระบุว่า Component, Drawable และ Texture IDs สัมพันธ์กับ Ped Model และมี Native สำหรับ Query Drawable Counts รวมถึง Validate Collection Variations ได้โดยตรง.
หาก เสื้อขึ้นคนละตัวหลัง GTA Update ให้ตรวจ Global Drawable Index ก่อน เพราะ Cfx.re ระบุว่า Global Custom Component/Prop Index สามารถเปลี่ยนหลัง Title Updates แต่ Collection-based Local Index ถูกออกแบบให้คงที่.
หาก Native ใส่เสื้อได้แต่ Clothing Menu ไม่มีรายการ ปัญหาน่าจะอยู่ที่ Menu/Index Integration มากกว่าตัว Asset
หาก เสื้อขึ้นแต่สีผิด ให้ตรวจ Texture
หาก เสื้อขึ้นแต่แขนหาย ให้ตรวจ Top/Torso/Undershirt Combination
และหาก Pack เดี่ยวทำงานแต่เปิดหลาย Pack แล้วเสีย ให้ทำ A/B Test หา Asset หรือ Collection Conflict ก่อน Merge ใหม่
แนวทางของ comsiam คืออย่าใช้วิธีแก้เสื้อ FiveM ด้วยการลบไฟล์และติดตั้งใหม่แบบสุ่ม แต่ให้ตรวจทีละ Layer เพราะเมื่อรู้ว่า Server มองเห็น Resource หรือไม่ Ped มองเห็น Collection หรือไม่ และ Clothing Menu ใช้ Index ระบบใด ปัญหาที่ดูเหมือนซับซ้อนจะเหลือจุดให้ตรวจเพียงไม่กี่จุดเท่านั้น
Comments
Post a Comment