Commands (Server-side)
Commands
onExecuted
ทำงานเมื่อดำเนินการใช้คำสั่งเสร็จสิ้นแล้ว
function Commands.onExecuted(source, command, success, response)
local client <const> = (source > 0 and source or nil)
if success then
return respHandler[command.key](client, response)
elseif client then
return Commands.sendClientMessage(client, false, ("Failed to execute command '^3%s^7': ^1%s^7."):format(command.raw, response.message))
end
print(("[^1ERROR^7] Failed to execute command '^3%s^7': ^1%s^7."):format(command.raw, response.message))
end
Parameters
- source:
integer
- Net ID ของผู้เล่นที่ใช้คำสั่ง หรือ
0
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่นที่ใช้คำสั่ง หรือ
- command:
table<{ [key]: any }>
- ข้อมูลของคำสั่งที่ใช้งาน (ดูรายละเอียดด้านล่าง)
- success:
boolean
- สถานะการใช้งานคำสั่ง
- response:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง (ดูรายละเอียดด้านล่าง)
- command
- response
Field | Type | Description |
---|---|---|
key | string | คีย์ของคำสั่ง |
name | string | ชื่อของคำสั่ง |
raw | string | ข้อมูลของคำสั่งที่ใช้ |
args | table<{ [index]: string }> | ข้อมูลอาร์กิวเมนต์ของคำสั่งที่ใช้ |
ข้อมูลตอบกลับเมื่อใช้คำสั่งสำเร็จ คุณสามารถดูรายละเอียดได้ที่ respHandler
ข้อมูลตอบกลับเมื่อใช้คำสั่งล้มเหลว
Field | Type | Description |
---|---|---|
type | string | ประเภทของข้อผิดพลาด |
message | string | ข้อความของข้อผิดพลาด |
sendClientMessage
ส่งข้อความไปยังฝั่งไคลเอนต์เมื่อใช้คำสั่งเสร็จสิ้นแล้ว
function Commands.sendClientMessage(client, success, message)
if success then
return TriggerClientEvent('chat:addMessage', client, { multiline = true, color = { 0, 255, 0 }, args = { '»', message } })
end
TriggerClientEvent('chat:addMessage', client, { multiline = true, color = { 255, 0, 0 }, args = { '»', message } })
end
Parameters
- client:
integer
- Net ID ของผู้เล่นที่ใช้คำสั่ง
- success:
boolean
- สถานะการใช้งานคำสั่ง
- message:
string
- ข้อความตอบกลับจากการใช้คำสั่งที่จะส่งไปยังฝั่ง Client
respHandler
จัดการข้อมูลการตอบกลับเมื่อใช้คำสั่งสำเร็จ โดยจะถูกเรียกใช้งานจากฟังก์ชัน onExecuted
getUser
ทำงานเมื่อใช้คำสั่ง "รับข้อมูลผู้ใช้งาน" สำเร็จ
function respHandler.getUser(client, resp)
local message <const> = ("[^2INFO^7] Successfully retrieved data for identifier '^5%s^7': %s"):format(resp.identifier, json.encode(resp.data, { indent = true }))
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- data:
table<{ [key]: any }>
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
addUser
ทำงานเมื่อใช้คำสั่ง "เพิ่มข้อมูลผู้ใช้งาน" สำเร็จ
function respHandler.addUser(client, resp)
local message <const> = resp.data.bound_id
and ("[^2INFO^7] Successfully added identifier '^5%s^7' and bound ID '^5%s^7' to the database"):format(resp.identifier, resp.data.bound_id)
or ("[^2INFO^7] Successfully added identifier '^5%s^7' to the database"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- data:
table<{ [key]: any }>
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
deleteUser
ทำงานเมื่อใช้คำสั่ง "ลบข้อมูลผู้ใช้งาน" สำเร็จ
function respHandler.deleteUser(client, resp)
local message <const> = ("[^2INFO^7] Successfully deleted data for identifier '^5%s^7' from the database"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- data:
table<{ [key]: any }>
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
getBanInfo
ทำงานเมื่อใช้คำสั่ง "รับข้อมูลการถูกแบน" สำเร็จ
function respHandler.getBanInfo(client, resp)
local message <const> = ("[^2INFO^7] Identifier: ^5%s^7\n[^2INFO^7] Bound ID: %s\n[^2INFO^7] Associated ID: %s\n[^2INFO^7] Ban Type: %s\n[^2INFO^7] Ban Reason: %s\n[^2INFO^7] Ban Start: %s\n[^2INFO^7] Ban End: %s")
:format(resp.identifier,
('^5' .. resp.boundId .. '^7' or 'None'),
(resp.banDetails.associated_id and '^3' .. resp.banDetails.associated_id .. '^7' or 'None'),
(resp.banDetails.type == 'temporary' and '^3Temporary^7' or '^1Permanent^7'),
'^6' .. resp.banDetails.reason .. '^7',
'^3' .. resp.banDetails.start_datetime .. '^7',
(resp.banDetails.end_datetime and '^2' .. resp.banDetails.end_datetime .. '^7' or 'None')
)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- boundId:
string
|nil
- ตัวระบุที่ผูกไว้กับตัวระบุหลัก
- banHwids:
table<{ [index]: string }>
|nil
- ข้อมูล HWIDs ที่ถูกแบน
- banDetails:
table<{ [key]: any }>
- ข้อมูลการถูกแบนของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
banUser
ทำงานเมื่อใช้คำสั่ง "แบนผู้ใช้ถาวรหรือชั่วคราว" สำเร็จ
function respHandler.banUser(client, resp)
local message <const> = resp.banDays
and ("[^2INFO^7] Successfully banned identifier '^5%s^7' for ^3%d^7 days"):format(resp.identifier, resp.banDays)
or ("[^2INFO^7] Successfully permanently banned identifier '^5%s^7'"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- boundId:
string
|nil
- ตัวระบุที่ผูกไว้กับตัวระบุหลัก
- banDays:
integer
|nil
- จำนวนวันที่ถูกแบนชั่วคราว หรือ
nil
หากเป็นการแบนถาวร
- จำนวนวันที่ถูกแบนชั่วคราว หรือ
- banHwids:
table<{ [index]: string }>
|nil
- ข้อมูล HWIDs ที่ถูกแบน
- banDetails:
table<{ [key]: any }>
- ข้อมูลการถูกแบนของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
unbanUser
ทำงานเมื่อใช้คำสั่ง "ยกเลิกแบนผู้ใช้" สำเร็จ
function respHandler.unbanUser(client, resp)
local message <const> = ("[^2INFO^7] Successfully unbanned identifier '^5%s^7' by '^3%s^7'"):format(resp.identifier, (resp.unbanBy or 'Unknown'))
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- boundId:
string
|nil
- ตัวระบุที่ผูกไว้กับตัวระบุหลัก
- unbanBy:
string
|nil
- ยกเลิกการแบนโดย
- banHwids:
table<{ [index]: string }>
|nil
- ข้อมูล HWIDs ที่ถูกแบน
- banDetails:
table<{ [key]: any }>
- ข้อมูลการถูกแบนของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
setUserRole
ทำงานเมื่อใช้คำสั่ง "กำหนดบทบาทของผู้ใช้" สำเร็จ
function respHandler.setUserRole(client, resp)
local message <const> = ("[^2INFO^7] Successfully assigned role '^2%s^7' (ID: ^2%d^7) to identifier '^5%s^7'."):format(resp.newRole.name, resp.newRole.id, resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
reactivateUser
ทำงานเมื่อใช้คำสั่ง "ยกเลิกสถานะการถูกระงับ" สำเร็จ (เป็นการยกเลิกสถานะ inactivePlayers)
function respHandler.reactivateUser(client, resp)
local message <const> = ("[^2INFO^7] Successfully reactivated identifier '^5%s^7' in the database"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
setNewIdentifier
ทำงานเมื่อใช้คำสั่ง "กำหนดตัวระบุให้ผู้ใช้ใหม่" สำเร็จ
function respHandler.setNewIdentifier(client, resp)
local message <const> = ("[^2INFO^7] Successfully updated identifier from '^3%s^7' to '^2%s^7' in the database"):format(resp.identifier, resp.newIdentifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- ตัวระบุเก่าของผู้เล่น
- newIdentifier:
string
- ตัวระบุใหม่ของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
resetBindIdentifier
ทำงานเมื่อใช้คำสั่ง "รีเซ็ตตัวระบุที่ถูกผูกไว้ของผู้ใช้" สำเร็จ
function respHandler.resetBindIdentifier(client, resp)
local message <const> = ("[^2INFO^7] Successfully reset bound ID for identifier '^5%s^7' in the database"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- lastBoundId:
string
- ตัวระบุที่ผูกไว้กับตัวระบุหลักก่อนที่จะถูกรีเซ็ต
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
resetHwids
ทำงานเมื่อใช้คำสั่ง "รีเซ็ต HWIDs ของผู้ใช้" สำเร็จ
function respHandler.resetHwids(client, resp)
local message <const> = ("[^2INFO^7] Successfully reset HWIDs for identifier '^5%s^7' in the database"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- lastHwids:
table<{ [index]: string }>
|nil
- ข้อมูล HWIDs ล่าสุดของผู้เล่นก่อนที่จะถูกรีเซ็ต
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
getPoints
ทำงานเมื่อใช้คำสั่ง "รับพอยท์ของผู้ใช้" สำเร็จ
function respHandler.getPoints(client, resp)
local indexedData <const> = {}
if resp.data?.temporary then
for i, v in ipairs(resp.data.temporary) do
indexedData[#indexedData + 1] = ("[^2INFO^7] Index: ^3%d^7 | Value: ^5%d^7 | Expiry: ^1%s^7"):format(i, v.value, v.expiry_datetime)
end
end
local message <const> = ("[^2INFO^7] Points for identifier '^5%s^7'\n[^2INFO^7] Total Points: ^2%d^7\n[^2INFO^7] Permanent Points: ^5%d^7\n[^2INFO^7] Temporary Points: ^5%d^7\n%s")
:format(resp.identifier, resp.totalPoints, resp.permPoints, resp.tempPoints, (next(indexedData) and table.concat(indexedData, '\n') or ''))
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- totalPoints:
integer
- จำนวนคิวพ้อยท์ทั้งหมด
- permPoints:
integer
- จำนวนคิวพ้อยท์ถาวร
- tempPoints:
integer
- จำนวนคิวพ้อยท์ชั่วคราว (แบบมีวันหมดอายุ)
- data:
table<{ [key]: any }>
|nil
- ข้อมูลคิวพ้อยท์ของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
addPoints
ทำงานเมื่อใช้คำสั่ง "เพิ่มพอยท์ให้ผู้ใช้" สำเร็จ
function respHandler.addPoints(client, resp)
local message <const> = resp.expirationDays
and ("[^2INFO^7] Successfully added ^2%d^7 points with an expiration of ^3%d^7 days for identifier '^5%s^7' (Prev Points: ^3%d^7, New Points: ^2%d^7)")
:format(resp.addPoints, resp.expirationDays, resp.identifier, resp.prevPoints, resp.newPoints)
or ("[^2INFO^7] Successfully added ^2%d^7 points without expiration for identifier '^5%s^7' (Prev Points: ^3%d^7, New Points: ^2%d^7)")
:format(resp.addPoints, resp.identifier, resp.prevPoints, resp.newPoints)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- addPoints:
integer
- จำนวนคิวพ้อยท์ที่ถูกเพิ่ม
- expirationDays:
integer
|nil
- จำนวนวันหมดอายุของคิวพ้อยท์แบบชั่วคราว หร ือ
nil
หากเป็นคิวพ้อยท์แบบถาวร (ไม่มีวันหมดอายุ)
- จำนวนวันหมดอายุของคิวพ้อยท์แบบชั่วคราว หร ือ
- prevPoints:
integer
- จำนวนคิวพ้อยท์ก่อนที่จะเพิ่ม
- newPoints:
integer
- จำนวนคิวพ้อยท์หลังจากถูกเพิ่ม
- data:
table<{ [key]: any }>
|nil
- ข้อมูลคิวพ้อยท์ของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
setPermanentPoints
ทำงานเมื่อใช้คำสั่ง "กำหนดพ้อยท์แบบไม่มีวันหมดอายุให้ผู้ใช้" สำเร็จ
function respHandler.setPermanentPoints(client, resp)
local message <const> = ("[^2INFO^7] Permanent points successfully set: ^2%d^7 for identifier '^5%s^7'\n[^2INFO^7] Prev Permanent Points: ^3%d^7\n[^2INFO^7] New Permanent Points: ^2%d^7\n[^2INFO^7] Current Temporary Points: ^5%d^7\n[^2INFO^7] Total Points: ^2%d^7")
:format(resp.setPermPoints, resp.identifier, resp.prevPermPoints, resp.setPermPoints, resp.tempPoints, resp.totalPoints)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- setPermPoints:
integer
- จำนวนคิวพ้อยท์ถาวรที่ถูกกำหนดใหม่ (ไม่มีวันหมดอายุ)
- prevPermPoints:
integer
- จำนวนคิวพ้อยท์ถาวรก่อนถูกกำหนดใหม่ (จำนวนเก่า)
- tempPoints:
integer
- จำนวนคิวพ้อยท์ชั่วคราว (แบบมีวันหมดอายุ)
- totalPoints:
integer
- จำนวนคิวพ้อยท์ทั้งหมด (หลังถูกกำหนดใหม่)
- data:
table<{ [key]: any }>
|nil
- ข้อมูลคิวพ้อยท์ของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
deleteTemporaryPoints
ทำงานเมื่อใช้คำสั่ง "ลบพ้อยท์แบบมีวันหมดอายุของผู้ใช้" สำเร็จ
function respHandler.deleteTemporaryPoints(client, resp)
local message <const> = ("[^2INFO^7] Successfully deleted ^1%d^7 temporary points from index ^3%d^7 for identifier '^5%s^7'\n[^2INFO^7] Prev Temporary Points: ^3%d^7\n[^2INFO^7] Remaining Temporary Points: ^2%d^7\n[^2INFO^7] Current Permanent Points: ^5%d^7\n[^2INFO^7] Current Total Points: ^2%d^7")
:format(resp.removedData.value, resp.removedIndex, resp.identifier, (resp.tempPoints + resp.removedData.value), resp.tempPoints, resp.permPoints, resp.totalPoints)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- removedIndex:
integer
- หมายเลข index ของตารางที่ถูกลบข้อมูลคิวพ้อยท์ชั่วคราวออก (แบบมีวันหมดอายุ)
- removedData:
table<{ value: integer, expiry_datetime: string }>
- ข้อมูลคิวพ้อยท์ชั่วคราวออกที่ถูกลบออก
- tempPoints:
integer
- จำนวนคิวพ้อยท์ชั่วคราวคงเหลือ
- totalPoints:
integer
- จำนวนคิวพ้อยท์คงเหลือทั้งหมด
- data:
table<{ [key]: any }>
|nil
- ข้อมูลคิวพ้อยท์ของผู้เล่น หลังจากถูกลบ
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
purgePoints
ทำงานเมื่อใช้คำสั่ง "ลบพ้อยท์ทั้งหมดของผู้ใช้" สำเร็จ
function respHandler.purgePoints(client, resp)
local message <const> = ("[^2INFO^7] Successfully purged points for identifier '^5%s^7'\n[^2INFO^7] Total Points Removed: ^1%d^7\n[^2INFO^7] Permanent Points Removed: ^1%d^7\n[^2INFO^7] Temporary Points Removed: ^1%d^7\n[^2INFO^7] Data Before Purge: %s")
:format(resp.identifier, resp.totalPoints, resp.permPoints, resp.tempPoints, json.encode(resp.data, { indent = true }))
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- data:
table<{ [key]: any }>
- ข้อมูลคิวพ้อยท์ของผู้เล่น ก่อนถูกลบข้อมูล
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
getAirtime
ทำงานเมื่อใช้คำสั่ง "รับเวลาออนไลน์ที่เหลือของผู้ใช้" สำเร็จ
function respHandler.getAirtime(client, resp)
local message <const> = ("[^2INFO^7] Successfully retrieved remaining airtime for identifier '^5%s^7'\n[^2INFO^7] Remaining Airtime: ^2%d^7 seconds"):format(resp.identifier, resp.numAirtime)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- numAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
setAirtime
ทำงานเมื่อใช้คำสั่ง "กำหนดเวลาออนไลน์ให้ผู้ใช้" สำเร็จ
function respHandler.setAirtime(client, resp)
local message <const> = ("[^2INFO^7] Successfully set ^3%d^7 seconds of airtime for identifier '^5%s^7'\n[^2INFO^7] Previous Airtime: ^3%d^7 seconds\n[^2INFO^7] Current Airtime: ^2%d^7 seconds")
:format(resp.newAirtime, resp.identifier, resp.oldAirtime, resp.newAirtime)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- oldAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือก่อนที่จะถูกกำหนดใหม่
- newAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือหลังจากถูกกำหนดใหม่
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
addAirtime
ทำงานเมื่อใช้คำสั่ง "เพิ่มเวลาออนไลน์ให้ผู้ใช้" สำเร็จ
function respHandler.addAirtime(client, resp)
local message <const> = ("[^2INFO^7] Successfully added ^2%d^7 seconds of airtime for identifier '^5%s^7'\n[^2INFO^7] Previous Airtime: ^3%d^7 seconds\n[^2INFO^7] Current Airtime: ^2%d^7 seconds")
:format(resp.addAirtime, resp.identifier, resp.oldAirtime, resp.newAirtime)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- addAirtime:
integer
- จำนวนแอร์ไทม์ที่จะเพิ่ม
- oldAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือก่อนที่จะถูกเพิ่ม
- newAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือหลังจากถูกเพิ่ม
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
removeAirtime
ทำงานเมื่อใช้คำสั่ง "ลดเวลาออนไลน์ของผู้ใช้" สำเร็จ
function respHandler.removeAirtime(client, resp)
local message <const> = ("[^2INFO^7] Successfully removed ^1%d^7 seconds of airtime for identifier '^5%s^7'\n[^2INFO^7] Previous Airtime: ^3%d^7 seconds\n[^2INFO^7] Current Airtime: ^2%d^7 seconds")
:format(resp.removeAirtime, resp.identifier, resp.oldAirtime, resp.newAirtime)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- removeAirtime:
integer
- จำนวนแอร์ไทม์ที่จะลบ
- oldAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือก่อนที่จะลบ
- newAirtime:
integer
- จำนวนแอร์ไทม์คงเหลือหลังจากถูกลบ
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
clearPlayerCache
ทำงานเมื่อใช้คำสั่ง "ล้างแคชข้อมูลผู้เล่น" สำเร็จ
function respHandler.clearPlayerCache(client, resp)
local message <const> = ("[^2INFO^7] Successfully cleared player cache for identifier '^5%s^7'"):format(resp.identifier)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
getMyInfo
ทำงานเมื่อใช้คำสั่ง "รับข้อมูลส่วนตัวของผู้เล่น" สำเร็จ
function respHandler.getMyInfo(client, resp)
local message <const> = ("[^2INFO^7] User Role: ^2%s^7\n[^2INFO^7] Airtime Left: ^3%s^7\n[^2INFO^7] Total Points: ^2%d^7\n[^2INFO^7] Permanent Points: ^5%d^7\n[^2INFO^7] Temporary Points: ^3%d^7")
:format(resp.role.name:gsub('^%l', string.upper), resp.airtimeLeft, resp.queuePoints.total, resp.queuePoints.permanent, resp.queuePoints.temporary)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- ข้อมูลตอบกลับของคำสั่ง
- identifier:
string
- ข้อมูลของผู้เล่น
- identifier:
- ข้อมูลตอบกลับของคำสั่ง
getQueueInfo
ทำงานเมื่อใช้คำสั่ง "รับข้อมูลเกี่ยวกับระบบคิว" สำเร็จ
function respHandler.getQueueInfo(client, resp)
local message <const> = ('[^2INFO^7] Queue Status: %s\n[^2INFO^7] Max Queue Size: ^3%d^7\n[^2INFO^7] Players in Queue: ^3%d^7\n[^2INFO^7] Players Downloading: ^3%d^7\n[^2INFO^7] Players Reconnectable (Crashed): ^3%d^7\n[^2INFO^7] Players Online: ^3%d^7\n[^2INFO^7] Total Used Slots: ^5%d^7/^5%d^7')
:format((resp.isQueueFull and '^1Full^7' or '^2Not Full^7'), resp.maxQueueSize, resp.numQueues, resp.numDownloads, resp.numCrashes, resp.numPlayers, resp.numUsedSlots, resp.maxServerSlots)
if client then
return Commands.sendClientMessage(client, true, message)
end
print(message)
end
Parameters
- client:
integer
|nil
- Net ID ของผู้เล่น หรือ
nil
หากใช้คำสั่งที่ Server Console
- Net ID ของผู้เล่น หรือ
- resp:
table<{ [key]: any }>
- isQueueFull:
boolean
- ตอบกลับ
true
หากคิวเต็ม
- ตอบกลับ
- maxServerSlots:
integer
- จำนวนสล็อตเซิร์ฟเวอร์สูงสุด
- maxQueueSize:
integer
- จำนวนคิวสูงสุดที่รองรับ
- numQueues:
integer
- จำนวนผู้เล่นที่รออยู่ในคิว
- numDownloads:
integer
- จำนวนผู้เล่นที่กำลังดาวน์โหลดทรัพยากรของเซิร์ฟเวอร์ (ก่อนเข้าหน้า Loading Screen)
- numCrashes:
integer
- จำนวนผู้เล่นที่เกิดการขัดข้องและมีสิทธิ์เข้าร่วมใหม่โดยไม่ต้องรอคิว
- numPlayers:
integer
- จำนวนผู้เล่นออนไลน์อยู่ในเซิร์ฟเวอร์
- numUsedSlots:
integer
- จำนวนสล็อตเซิร์ฟเวอร์ที่ถูกใช้งาน (
numPlayers
+numDownloads
+numCrashes
)
- จำนวนสล็อตเซิร์ฟเวอร์ที่ถูกใช้งาน (
- isQueueFull: