FiveM Server Key คืออะไร? ใช้ทำอะไร สร้างจากไหน และใส่ตรงไหนใน server.cfg
FiveM Server Key หรือ Server Registration Key / License Key คือ Key ที่ใช้ลงทะเบียน FXServer กับระบบ Cfx.re เพื่อให้ FiveM Server สามารถทำงานในฐานะ Server ที่ได้รับการลงทะเบียนกับบัญชี Cfx ของเจ้าของ Server
ใน server.cfg จะใช้คำสั่ง
sv_licenseKey "YOUR_SERVER_KEY"
โดยนำ Key ที่สร้างจาก Cfx Portal มาใส่แทน YOUR_SERVER_KEY
โครงสร้างง่าย ๆ คือ
Cfx Account
↓
Cfx Portal
↓
Create Server Key
↓
Copy Key
↓
ใส่ใน server.cfg
↓
FXServer ใช้ Key ตอนเปิด Server
Server Key จึงเป็นหนึ่งในค่าพื้นฐานที่ต้องมีเมื่อสร้าง FiveM Server จริง
① FiveM Server Key คืออะไร
Server Key คือรหัสสำหรับลงทะเบียน FiveM Server กับ Cfx.re
ชื่อที่อาจพบในเอกสารหรือระบบ ได้แก่
Server Registration Key
License Key
FiveM Server Key
Cfx Server Key
ทั้งหมดเกี่ยวข้องกับ Key ที่นำมาใช้กับ
sv_licenseKey
② Server Key ใช้ทำอะไร
หน้าที่หลักคือทำให้ FXServer รู้ว่า Server Instance นี้ใช้ License/Registration จากบัญชี Cfx ใด
ตัวอย่าง
FXServer Start
↓
อ่าน sv_licenseKey
↓
ตรวจ Server Registration
↓
ดำเนินการเปิด FiveM Server
ถ้าไม่ได้กำหนด Key ใน Server ที่ต้องใช้ ระบบสามารถแจ้ง Error เกี่ยวกับ License Key ได้
③ FiveM Server Key สร้างจากไหน
สร้างจาก Cfx Portal
ขั้นตอนในคู่มือ Cfx.re ปัจจุบันคือ
Login Cfx Account
↓
เปิด Portal
↓
Create a key
↓
ตั้ง Display Name
↓
Generate
↓
Copy Key
จากนั้นนำ Key ไปใส่ใน txAdmin Recipe หรือ server.cfg
④ ต้องมี Cfx Account ไหม
ต้องมี
Cfx.re ระบุว่า Cfx Account เป็นสิ่งจำเป็นสำหรับการ Setup Server
Account นี้ใช้กับขั้นตอนอย่าง
txAdmin Registration
Server Registration Key
Cfx Portal
Server Management บางส่วน
ควรใช้ Account ที่เจ้าของ Server สามารถควบคุมได้ระยะยาว
⑤ Server Key ฟรีไหม
การสร้าง License Key พื้นฐานสำหรับการตั้ง Server สามารถทำผ่าน Cfx Portal ตามขั้นตอนของ Cfx.re
แต่จำนวน Player Slots หรือ Feature บางประเภทอาจมีเงื่อนไขเกี่ยวกับ FiveM Element Club หรือสิทธิ์ของ Account
ดังนั้นต้องแยก
มี Server Key
≠
ได้ทุก Feature/ทุกจำนวน Slots
⑥ Server Key กับ FiveM Subscription เหมือนกันไหม
ไม่เหมือนกัน
Server Key ใช้ลงทะเบียน Server
ส่วน Subscription/Element Club เกี่ยวข้องกับสิทธิประโยชน์และข้อจำกัดบางอย่างของระบบ FiveM
จึงไม่ควรคิดว่าการมี Key หนึ่งอันทำให้ Server ใช้ Player Slots ได้ไม่จำกัด
⑦ Server Key ใส่ตรงไหน
สำหรับ Vanilla Server ให้ใส่ใน
server.cfg
ตัวอย่าง
sv_licenseKey "YOUR_SERVER_KEY"
เปลี่ยน YOUR_SERVER_KEY เป็น Key จริงจาก Cfx Portal
⑧ ตัวอย่าง server.cfg
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My FiveM Server"
sv_maxclients 32
ensure mapmanager
ensure chat
ensure spawnmanager
sv_licenseKey "YOUR_SERVER_KEY"
นี่เป็นเพียงตัวอย่างโครงสร้างพื้นฐาน
Server จริงอาจมี Configuration เพิ่มมากกว่านี้
⑨ ต้องใส่เครื่องหมาย Quote ไหม
รูปแบบที่อ่านง่ายคือ
sv_licenseKey "YOUR_SERVER_KEY"
ให้ Copy Key โดยไม่เพิ่ม Space หรือ Character แปลก ๆ
ถ้าเกิด Error ควรตรวจว่ามีช่องว่างหรือการ Copy ผิดหรือไม่
⑩ ใช้ sv_licenseKey ไม่ใช่ set ใช่ไหม
Cfx.re ระบุ Server Command เป็น
sv_licenseKey KEY
จึงใช้
sv_licenseKey "..."
โดยตรง
ไม่จำเป็นต้องเขียน
set sv_licenseKey "..."
ตามตัวอย่าง Vanilla ปัจจุบันของ Cfx.re
⑪ txAdmin ใส่ Server Key ให้ได้ไหม
ได้
เมื่อสร้าง Server ด้วย txAdmin Recipe Deployer ระบบจะมีขั้นตอน
Input Parameters
↓
เปิด Cfx Portal
↓
สร้าง Key
↓
Copy
↓
Paste ลง txAdmin
↓
Run Recipe
Recipe สามารถนำ Key ไปใส่ใน Configuration ให้
⑫ ถ้าใช้ CFX Default Recipe ต้องแก้ server.cfg เองไหม
ในขั้นตอน Setup ปกติ txAdmin Recipe จะจัดการ Configuration พื้นฐานให้
หลัง Recipe Deploy สำเร็จ ระบบจะแสดง Config ให้ตรวจและกด
Save & Run Server
จึงง่ายกว่าการสร้าง Config ด้วยมือ
⑬ Display Name ตอนสร้าง Key คืออะไร
Display Name ใช้ช่วยให้เจ้าของ Account แยกได้ว่า Key นั้นใช้กับ Server ใด
ตัวอย่าง
Production FiveM
Development FiveM
Test Server
Khon Kaen RP
ควรตั้งให้ดูแล้วรู้ทันทีว่า Key ใช้กับอะไร
⑭ ไม่ควรตั้งชื่อ Key ว่าอะไร
หลีกเลี่ยง
key1
key2
test
new
final
server
เมื่อมีหลาย Key จะจำไม่ได้ว่าอันไหนใช้กับ Production
ชื่อที่ชัดเจนดีกว่า
FiveM-Production
FiveM-Development
⑮ Key ต้องตรงกับ Server Name ไหม
Display Name ของ Key ไม่จำเป็นต้องเหมือน sv_hostname
ตัวอย่าง
Key Display Name
= FiveM Production
แต่ Server อาจแสดงชื่อ
My Roleplay Community
ได้
Display Name มีไว้ช่วยบริหาร Key มากกว่าเป็นชื่อที่ผู้เล่นเห็น
⑯ Server Key กับ sv_hostname เกี่ยวกันไหม
ไม่ใช่สิ่งเดียวกัน
sv_licenseKey
= ลงทะเบียน Server
sv_hostname
= ชื่อ Server
เปลี่ยน sv_hostname ไม่ได้หมายความว่าต้องสร้าง Key ใหม่ทุกครั้ง
⑰ Server Key กับ Server IP เหมือนกันไหม
ไม่เหมือนกัน
Server Key
= Registration / License
Server IP
= Network Address
ผู้เล่นใช้ IP/Domain ติดต่อ Server
แต่ FXServer ใช้ Key เพื่อ Registration กับ Cfx Platform
⑱ Server Key กับ Port 30120 เกี่ยวกันไหม
เป็นคนละส่วน
sv_licenseKey
= Registration
30120
= Game Endpoint ที่ใช้กันทั่วไป
ถ้า Port ถูก Block ต่อให้ Key ถูก ผู้เล่นก็ยังเข้า Server ไม่ได้
⑲ Server Key กับ txAdmin Port 40120 เกี่ยวกันไหม
ไม่เกี่ยวโดยตรง
40120
= Default txAdmin Web Port
ใช้เข้า Management Panel
ส่วน Server Key ใช้กับ FXServer Registration
การเปลี่ยน txAdmin Port ไม่จำเป็นต้องสร้าง Server Key ใหม่
⑳ Server Key กับ txAdmin Password เหมือนกันไหม
ไม่เหมือนกัน
Server Key
= FXServer Registration
txAdmin Password
= Admin Authentication
ห้ามนำ Server Key ไปใช้เป็น Password ของ Admin
㉑ Server Key กับ Cfx Password เหมือนกันไหม
ไม่เหมือนกันเช่นกัน
Cfx Password ใช้ Login Account
Server Key เป็น Credential สำหรับ Server Configuration
ถ้า Key หลุด ไม่จำเป็นต้องเปลี่ยน Password Cfx โดยอัตโนมัติ แต่ควรตรวจ Security และจัดการ Key ที่เกี่ยวข้อง
㉒ Server Key กับ Steam Web API Key เหมือนกันไหม
ไม่เหมือนกัน
ใน Vanilla server.cfg อาจพบ
set steam_webApiKey ""
กับ
sv_licenseKey "..."
สอง Key มีคนละผู้ให้บริการและคนละหน้าที่
อย่าเอา Steam Web API Key มาใส่ใน sv_licenseKey
㉓ Steam Web API Key จำเป็นสำหรับ Server Key ไหม
ไม่ใช่ Key เดียวกัน
Cfx.re Vanilla Config ระบุ Steam Web API Key เป็น Optional สำหรับ Steam Authentication ในบริบทที่ต้องใช้
Server Registration Key ของ Cfx ยังคงเป็นคนละค่า
㉔ Server Key ต้องเป็นความลับไหม
ควรถือเป็น Secret
ไม่ควรเปิดเผยต่อสาธารณะ
โดยเฉพาะใน
GitHub Public
Discord Public
Facebook
YouTube Description
Screenshot
Forum Post
Pastebin Public
ก่อนแชร์ Config ต้องซ่อน Key
㉕ ตัวอย่างการซ่อน Key
จาก
sv_licenseKey "abcdef123456_REAL_KEY"
เปลี่ยนเป็น
sv_licenseKey "REDACTED"
หรือ
sv_licenseKey "YOUR_SERVER_KEY"
ก่อนโพสต์ถามปัญหา
㉖ ทำไมไม่ควรโพสต์ server.cfg ทั้งไฟล์
เพราะนอกจาก Server Key แล้ว อาจมี
Database Password
API Keys
Discord Tokens
Webhook URLs
RCON Password
Private Convars
ควร Review ทุกบรรทัดก่อนแชร์
㉗ GitHub Public ต้องระวังมาก
หากเก็บ Config ใน Git ควรแยก Secrets ออกจาก Source Code
อย่า Commit Production Config ที่มี
sv_licenseKey "REAL_KEY"
ลง Public Repository
แม้ลบใน Commit ล่าสุดแล้ว ข้อมูลอาจยังอยู่ใน Git History
㉘ Server Key หลุดควรทำอย่างไร
ถ้าสงสัยว่า Key ถูกเปิดเผย ควรเข้า Cfx Portal ตรวจ Key ที่เกี่ยวข้องและใช้ช่องทางบริหารของ Portal เพื่อเปลี่ยน/ยกเลิก Key ตามตัวเลือกที่ระบบปัจจุบันให้
จากนั้น
สร้าง/ใช้ Key ที่ปลอดภัย
↓
อัปเดต server.cfg
↓
Restart Server
↓
ตรวจ Console
และตรวจด้วยว่า Secret อื่นในไฟล์เดียวกันหลุดหรือไม่
㉙ อย่าแชร์ Key ให้คนรับทำ Script โดยไม่จำเป็น
Developer ที่เขียน Resource ไม่จำเป็นต้องรู้ Server Key ในหลายกรณี
ถ้าต้องส่ง server.cfg ให้ตรวจ สามารถเปลี่ยน Key เป็น
REDACTED
ก่อนส่ง
ใช้หลักเปิดเผยข้อมูลเท่าที่จำเป็น
㉚ Server Key เก็บใน Backup ด้วยไหม
ถ้า Backup server.cfg ทั้งไฟล์ Key จะอยู่ใน Backup ด้วย
ดังนั้น Backup ต้องได้รับการป้องกันเหมือน Production Configuration
ไม่ควรเก็บ Full Backup ในพื้นที่ Public
㉛ Server Key ใช้กับ Development Server ได้ไหม
Development Server ก็ควรมี Server Registration ที่ถูกต้องตามระบบ
ถ้ามีหลาย Environment ควรตั้ง Display Name ของ Key ให้แยกได้ง่าย
เช่น
Production
Staging
Development
จะช่วยลดการใช้ Key ผิด Server
㉜ Key หนึ่งอันควรใช้มั่วกับหลาย Server ไหม
ไม่ควรออกแบบระบบโดย Copy Key เดียวไปทุก Server แบบไม่ตรวจข้อกำหนดของ Cfx Platform
วิธีบริหารที่ดีกว่าคือสร้างและตั้งชื่อ Registration ให้สัมพันธ์กับ Server Instance ตามที่ Portal รองรับ
ทำให้ตรวจสอบง่ายเมื่อย้ายหรือปิด Server
㉝ ย้าย VPS ต้องสร้าง Key ใหม่ไหม
ไม่ควรสรุปว่าต้องสร้างใหม่ทุกครั้ง
ให้ตรวจ Server Registration และ Configuration ใน Cfx Portal ก่อน เพราะสิ่งที่ต้องเปลี่ยนอาจขึ้นอยู่กับรูปแบบ Registration และ Environment ที่ใช้งานอยู่
หลังย้ายควรตรวจ
Server Key
Public IP
Port
Firewall
server.cfg
Cfx Portal
ทั้งหมดร่วมกัน
㉞ เปลี่ยน Public IP แล้ว Server เปิดไม่ได้เกี่ยวกับ Key ไหม
มีหลายสาเหตุที่เป็นไปได้
อย่าเห็นว่าเพิ่งย้าย IP แล้วสร้าง Key ใหม่ทันที
ให้ดู Console ก่อนว่า Error เกี่ยวกับ
License
Endpoint
Network
Firewall
Server List
อะไรจริง
แก้ตาม Error จะตรงจุดกว่า
㉟ Error no license key was specified คืออะไร
ข้อความลักษณะ
no license key was specified
หมายความว่า FXServer ไม่ได้รับ sv_licenseKey ตามที่คาด
Cfx.re ระบุว่าสาเหตุหนึ่งอาจมาจาก
server.cfgไม่ถูกโหลดเปิด Server จาก Working Directory ผิด
ไม่ได้ใช้
+exec server.cfgใน Vanilla SetupConfig ไม่มี
sv_licenseKey
ต้องตรวจ Config Loading ก่อน
㊱ อย่ารีบสร้าง Key ใหม่เมื่อขึ้น no license key
เพราะ Key เดิมอาจถูกต้อง แต่ FXServer ไม่ได้อ่านไฟล์
ตรวจ
server.cfg ถูกตัวไหม
+exec ถูกไหม
Working Directory ถูกไหม
sv_licenseKey มีอยู่ไหม
ก่อน
㊲ ใช้ txAdmin แล้วขึ้น Key Error ทำอย่างไร
เปิด
Live Console
แล้วดู Error จริง
ตรวจ Server Profile และ CFG ที่ txAdmin ใช้งานอยู่
ถ้ามี Production/Test หลายตัว คุณอาจแก้ server.cfg ผิดชุด
㊳ Key ผิดแล้ว Resource ยัง Start ไหม
Server Startup มีหลายขั้นตอน
บาง Resource อาจเริ่มโหลดก่อนที่คุณจะสังเกตปัญหา Registration
จึงไม่ควรดูเพียงว่า Resource Start แล้วสรุปว่า Key ถูก
ให้ตรวจ Server Status และ Console ทั้งหมด
㊴ Key ถูกแต่ Server ไม่ขึ้น Server List
ยังมีสาเหตุอื่น เช่น
Network
Firewall
Endpoint
Server Visibility
sv_lanPort Forwarding
Provider Firewall
Server Key เป็นเพียงหนึ่งองค์ประกอบ
ไม่ใช่ตัวแก้ Server List ทุกกรณี
㊵ sv_lan มีผลอย่างไร
ถ้า
sv_lan true
Cfx.re ระบุว่า Server จะเป็น LAN-only และไม่ปรากฏใน Public Server List
ดังนั้นหาก Key ถูกแต่ Server ไม่ขึ้น List ให้ตรวจ sv_lan ด้วย
㊶ LAN Server ต้องมี Key ไหม
เอกสาร Server Commands ปัจจุบันระบุว่าเมื่อ sv_lan เป็น true Server จะเป็น LAN-only และ License Key Checks ถูก Skip
แต่สำหรับ Server ปกติที่เปิดใช้งานออนไลน์ ให้ใช้ Registration Key ตามขั้นตอนมาตรฐานของ Cfx.re
㊷ Server Key มีผลกับ Player Slots ไหม
Key ทำหน้าที่ Registration แต่จำนวน Slots ที่ใช้ได้มีข้อกำหนดแยก
Cfx.re ระบุว่าหากต้องการมากกว่า 48 Slots อาจต้องมี FiveM Element Club ระดับที่รองรับ
ดังนั้น
Key ถูก
ไม่ได้แปลว่า
ตั้ง sv_maxclients เท่าไรก็ได้
㊸ Server Key หมดอายุไหม
ไม่ควรเดาอายุ Key จาก Tutorial เก่า
ให้ตรวจสถานะของ Registration จาก Cfx Portal ซึ่งเป็น Source ปัจจุบันของ Account
หาก Server มี License Error ให้ดู Portal และ Console ประกอบกัน
㊹ ลบ Key เก่าได้ไหม
การบริหาร Registration ควรทำผ่าน Cfx Portal ตามตัวเลือกที่ระบบแสดง
หาก Server เก่าเลิกใช้งานแล้ว ควรจัดการ Key/Registration ให้เป็นระเบียบ
ไม่ควรปล่อย Key จำนวนมากโดยไม่รู้ว่าแต่ละอันใช้งานกับ Server ใด
㊺ ควรตั้งชื่อ Key ตาม Environment
แนวทางที่ดี
COMSIAM-FIVEM-PROD
COMSIAM-FIVEM-DEV
COMSIAM-FIVEM-TEST
หรือชื่อ Server จริงของคุณ
ช่วยลดการนำ Production Key ไปใส่ Development Server โดยไม่ตั้งใจ
㊻ Backup รายการ Key อย่างไร
ไม่จำเป็นต้องเขียน Key จริงลง Spreadsheet ที่แชร์ทั้งทีม
สามารถจดเพียง
Display Name
Server
Environment
Owner Account
Created Date
Purpose
ส่วน Secret จริงให้เก็บในระบบที่ปลอดภัยกว่า
㊼ Checklist ก่อนเปิด Server
ตรวจ
Cfx Account ใช้งานได้
Key สร้างจาก Cfx Portal
Key ของ Server ถูกตัว
sv_licenseKey อยู่ใน server.cfg
ไม่มี Space แปลก ๆ
server.cfg ถูกโหลด
ไม่ได้เปิดเผย Key
Game Endpoint ถูก
Firewall ถูก
OneSync/Slots ถูก
Live Console ไม่มี License Error
เมื่อครบแล้วจึงไล่ปัญหาส่วนอื่นต่อ
㊽ Checklist เมื่อ Server Key มีปัญหา
ใช้ลำดับนี้
1. เปิด Live Console
2. อ่าน License Error จริง
3. ตรวจ server.cfg
4. ตรวจ sv_licenseKey
5. ตรวจว่า Config ถูกโหลด
6. ตรวจ Server Profile
7. ตรวจ Cfx Portal
8. ตรวจว่าใช้ Key ถูก Environment
9. ตรวจ Network หาก Error ไม่ใช่ License
10. Restart หลังแก้ Config
อย่าสร้าง Key ใหม่หลายอันโดยไม่รู้ Root Cause
㊾ ตัวอย่าง Configuration ที่ถูกหลัก
# Network
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# Server information
sv_hostname "My FiveM Server"
sets sv_projectName "My Community"
# Players
set onesync on
sv_maxclients 48
# Resources
ensure mapmanager
ensure chat
ensure spawnmanager
# Registration
sv_licenseKey "YOUR_SERVER_KEY"
ก่อนนำไปใช้จริงต้องเปลี่ยน Key และ Configuration ให้ตรงกับ Server ของคุณ
㊿ สรุป FiveM Server Key คืออะไร
FiveM Server Key คือ Server Registration Key ของ Cfx.re ที่ใช้กับ FXServer ผ่านคำสั่ง
sv_licenseKey "YOUR_SERVER_KEY"
ขั้นตอนพื้นฐานคือ
1. มี Cfx Account
2. เข้า Cfx Portal
3. Create a key
4. ตั้ง Display Name
5. Generate
6. Copy Key
7. ใส่ใน txAdmin Recipe หรือ server.cfg
8. เปิด Server
9. ตรวจ Live Console
10. เก็บ Key เป็นความลับ
ต้องแยก Server Key ออกจาก
txAdmin Password
Steam Web API Key
Database Password
Discord Token
Game Port
txAdmin Port
เพราะทั้งหมดทำหน้าที่คนละอย่าง
สำหรับ Production Server comsiam แนะนำให้ตั้งชื่อ Key ตาม Environment เช่น Production, Development และ Test เพื่อให้รู้ทันทีว่า Key ใดใช้กับ Server ใด และไม่ควรส่ง Server Key จริงให้ Staff หรือ Developer ที่ไม่จำเป็นต้องใช้
ก่อนแชร์ server.cfg, Backup หรือ Screenshot ต้องปิดบัง Key รวมถึง Database Credentials และ Tokens อื่นเสมอ
เมื่อจัดการ Cfx Account, Server Registration และ sv_licenseKey อย่างเป็นระบบ ผู้ดูแล FiveM Server ของ comsiam จะลดปัญหา Key สับสนระหว่างหลาย Server และสามารถวิเคราะห์ License Error ได้ตรงจุดโดยไม่ต้องสร้าง Key ใหม่แบบสุ่มทุกครั้ง
Comments
Post a Comment