สิทธิ์และคำสั่งแอดมิน
คำสั่งแอดมินและการตั้งค่าสิทธิ์ (config_admins.lua)
ไฟล์ config_admins.lua รวมคำสั่งแอดมินทั้งหมดสำหรับจัดการร้านค้า ตรวจสอบข้อมูลผู้เล่น และจัดการสต็อก
การตรวจสอบสิทธิ์แอดมิน
ระบบตรวจสอบว่าผู้เล่นเป็นแอดมินจาก ESX group:
return xPlayer.getGroup() == 'admin' or xPlayer.getGroup() == 'superadmin'แก้ชื่อ group ให้ตรงกับเซิร์ฟเวอร์
แก้ไขชื่อ group (admin, superadmin) ให้ตรงกับ ESX ของเซิร์ฟเวอร์คุณ มิฉะนั้นคำสั่งแอดมินจะใช้งานไม่ได้
คำสั่งแอดมินทั้งหมด
/markethelp
แสดงรายการคำสั่งแอดมินทั้งหมด
/markethelp/marketstock [limit_id]
ดูข้อมูลสต็อกสินค้า
/marketstock pistol_stockผลลัพธ์:
ข้อมูลสต็อก: Pistol Ammo Stock
สต็อกปัจจุบัน: 87
สต็อกสูงสุด: 100
หมวดหมู่: weapon/marketlimit [player_id] [limit_id]
ดูข้อมูลการซื้อของผู้เล่น
/marketlimit 1 pistol_stock/addstock [limit_id] [จำนวน]
เพิ่มสต็อกสินค้า
/addstock pistol_stock 50/resetstock [limit_id]
รีเซ็ตสต็อกเป็นค่าสูงสุด
/resetstock pistol_stock/resetplayer [player_id] [limit_id]
รีเซ็ตการซื้อของผู้เล่นคนเดียว
/resetplayer 1 pistol_stock/resetallplayers [limit_id]
รีเซ็ตการซื้อของผู้เล่นทุกคนสำหรับสินค้านั้น
/resetallplayers pistol_stock/marketlist
แสดงรายการสินค้าทั้งหมดใน console (F8)
/marketlist/checkpoints [player_id]
ตรวจสอบ Point/Coin ของผู้เล่น
/checkpoints 1ผลลัพธ์:
ข้อมูล Point/Coin
ผู้เล่น: John Doe (ID: 1)
Points: 5000
Coins: 50/givepoints [player_id] [จำนวน] [type]
ให้ Point หรือ Coin กับผู้เล่น
/givepoints 1 1000 point
/givepoints 1 10 coinระบบบันทึก Log การกระทำ
ทุกการกระทำของแอดมินจะถูกบันทึกใน console และส่งไปยัง Discord Webhook (ถ้าตั้งค่าไว้ใน config_logger.lua)
ข้อมูลที่บันทึก:
- ชื่อแอดมิน
- Identifier ของแอดมิน
- ประเภทการกระทำ (
ADD_STOCK,RESET_STOCK,RESET_PLAYER,RESET_ALL_PLAYERS) - รายละเอียดการเปลี่ยนแปลง
ความปลอดภัย
มาตรการรักษาความปลอดภัย
- คำสั่งทั้งหมดตรวจสอบสิทธิ์ก่อนทำงาน
- Log event ใช้ internal event เท่านั้น ไม่มี
RegisterServerEventป้องกันการปลอมแปลงจาก client - ตรวจสอบซ้ำว่าเป็น admin จริงก่อนบันทึก log