ควรจะมีความรู้ขั้นพื้นฐานการเขียนสคริปต์ Lua และการใช้งานฟังก์ชันต่างๆ ก่อน
เหมาะกับผู้พัฒนาเท่านั้น
errorism.dcl
ระบบการส่งข้อมูลไปยัง Discord โดยมีการแยกประเภทและความสำคัญ ทำให้สามารถอ่านข้อมูลได้ง่ายขึ้น
Features
Export
สำหรับดึงค่า Player Identifier (Steam,Discord,License,Name,Avatar,Token,etc)
Export
ส่ง Log Discord ที่เกิดมาเพื่อแก้ปัญหาการอ่านยาก
- Log เริ่มต้นที่มีมาให้ onPlayerConnect(เข้าเซิฟ), onPlayerDroped(ออกเซิฟ), onPlayerDied(สาเหตุการตาย)
- Message สามารถส่งมาเป็น table หรือ string เดี่ยวๆได้
- มี Prefix ที่ทำให้ Message อ่านง่านขึ้นเช่น -,+ และ --- (ตามรูปแนบ)
- Preset (Configurable)
- Priority (Configurable)
- Webhook Shorthand (Configurable) ใช้แทนตัวย่อในการใส่ Webhook
- สามารถใช้แทนสคริป
azael_dc-serverlogs
ได้โดยไม่ต้องแก้ไขใดๆ
- ป้องกันการเกิด rate limit ของ Discord
- ถ้า log ส่งยังไม่ครบขณะเซิฟจะรีสตาร์ท จะทำการ save เป็น file .json เพื่อไม่ให้มีข้อมูลตกหล่น
API Reference [ใช้ได้ทั้งฝั่ง client และ server]
ดึงข้อมูลผู้เล่น (ไม่จำเป็นต้องใช้ก่อนส่ง log)
exports['errorism.dcl']:getInfo(source)
Parameter | Type | Description |
---|
source | int | Required. Player Server Id |
return | table | steam,steamDec,ip,discord,license,license2,xbl,live,fivem,name,avatar,url,token |
ส่ง Log ไปยัง Discord
exports['errorism.dcl']:send(webhook,source,message,preset,priority)
Parameter | Type | Description |
---|
webhook | string | Required. Discord webhook url / Shorthand (In Webhook Config) |
source | int | Required. Player Server Id |
message | string or string[] | Required. Player Server Id |
preset | string | Preset of this log (In Config file) |
priority | string | Priority of this log (In Config file) |
imgUrl | string | Image Url (it will override by the preset that has screenshot on) |
Meesage Prefix Tips (for message parameter)
--- comment / สีเทา
*** comment / สีเทา
+ Add / เพิ่ม / สีเขียว
- Remove / ลบ / สีแดง
Usage/Examples
exports['errorism.dcl']:send(
"discord webhook url",
source, -- ถ้าฝั่ง client สามารถใช้ GetPlayerServerId(PlayerId()) เพื่อดึงไอดี
"+ Add 9 bread into inventory", -- msg 1
"สาธารณะ", -- preset / ประเภท
"เพิ่ม", -- priority / ความสำคัญ
"https://images.squarespace-cdn.com/content/v1/5b788d28697a98e17a6d4c7a/b83f0eab-7dd6-4e9b-83a1-13139ac2a03b/rickroll+cropped.png" -- img url
)
exports['errorism.dcl']:send(
"onPlayerJoin", -- Shorthand
source, -- ถ้าฝั่ง client สามารถใช้ GetPlayerServerId(PlayerId()) เพื่อดึงไอดี
{
"# Crafted 1 pistol", -- msg 1
"- Remove 1 iron", -- msg 2
"+ Add 1 pistol into inventory" -- msg 3
},
"ทั้งหมด", -- preset / ประเภท
"สูง" -- priority / ความสำคัญ
)