esx_policejob
ตัวอย่างรหัสที่ใช้เพิ่มไปยังทรัพยากร esx_policejob เพื่อส่งข้อมูลมายัง azael_dc-serverlogs
danger
โปรดตรวจสอบตัวแปรของรหัสทุกครั้ง เนื่องจากเวอร์ชันของทรัพยากรในตัวอย่างอาจจะไม่มีความเข้ากันได้กับทรัพยากรในเวอร์ชันที่คุณกำลังใช้งานอยู่ และส่งผลให้ไม่มีการส่งข้อมูลไปยัง azael_dc-serverlogs เนื่องจากมีข้อผิดพลาดเกิดขึ้นจากรหัสที่คุณดำเนินการเพิ่ม
main.lua (Server)
ไปยังโฟลเดอร์ server แล้วดำเนินการเ ปิดไฟล์ main.lua
ตำรวจ-ยึด (ไอเทม, เงิน, อาวุธ)
note
ไม่ต้องดำเนินการในส่วนนี้ หากคุณใช้งาน nc_inventory หรือ esx_inventoryhud
- ไอเทม
- เงิน
- อาวุธ
Event | Label |
---|---|
PoliceTakeItem | ตำรวจ-ยึด-ไอเทม |
วางรหัสด้านล่างนี้ต่อจาก sourceXPlayer.addInventoryItem(itemName, amount)
บรรทัดที่ 31
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'PoliceTakeItem',
content = ('ยึด %s จำนวน %s จาก %s'):format(sourceItem.label, amount, targetXPlayer.name),
source = sourceXPlayer.source,
color = 2,
options = {
important = (amount >= 500 and true)
}
})
exports['azael_dc-serverlogs']:insertData({
event = 'PoliceTakeItem',
content = ('ถูกยึด %s จำนวน %s โดย %s'):format(sourceItem.label, amount, sourceXPlayer.name),
source = targetXPlayer.source,
color = 3,
options = {
important = (amount >= 500 and true)
}
})
end)
Event | Label |
---|---|
PoliceTakeMoney | ตำรวจ-ยึด-เงิน |
วางรหัสด้านล่างนี้ต่อจาก sourceXPlayer.addAccountMoney(itemName, amount, "Confiscated")
บรรทัดที่ 47
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'PoliceTakeMoney',
content = ('ยึด %s จำนวน $%s จาก %s'):format(itemName, ESX.Math.GroupDigits(amount), targetXPlayer.name),
source = sourceXPlayer.source,
color = 2,
options = {
important = (amount >= 100000 and true)
}
})
exports['azael_dc-serverlogs']:insertData({
event = 'PoliceTakeMoney',
content = ('ถูกยึด %s จำนวน $%s โดย %s'):format(itemName, ESX.Math.GroupDigits(amount), sourceXPlayer.name),
source = targetXPlayer.source,
color = 3,
options = {
important = (amount >= 100000 and true)
}
})
end)
Event | Label |
---|---|
PoliceTakeWeapon | ตำรวจ-ยึด-อาวุธ |
วางรหัสด้านล่างนี้ต่อจาก sourceXPlayer.addWeapon(itemName, amount)
บรรทัดที่ 61
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'PoliceTakeWeapon',
content = ('ยึด %s จำนวน 1 จาก %s'):format(ESX.GetWeaponLabel(itemName), targetXPlayer.name),
source = sourceXPlayer.source,
color = 2
})
exports['azael_dc-serverlogs']:insertData({
event = 'PoliceTakeWeapon',
content = ('ถูกยึด %s จำนวน 1 โดย %s'):format(ESX.GetWeaponLabel(itemName), sourceXPlayer.name),
source = targetXPlayer.source,
color = 3
})
end)