esx_giveallplayers
ตัวอย่างรหัสที่ใช้เพิ่มไปยังทรัพยากร esx_giveallplayers เพื่อส่งข้อมูลมายัง azael_dc-serverlogs
danger
โปรดตรวจสอบตัวแปรของรหัสทุกครั้ง เนื่องจากเวอร์ชันของทรัพยากรในตัวอย่างอาจจะไม่มีความเข้ากันได้กับทรัพยากรในเวอร์ชันที่คุณกำลังใช้งานอยู่ และส่งผลให้ไม่มีการส่งข้อมูลไปยัง azael_dc-serverlogs เนื่องจากมีข้อผิดพลาดเกิดขึ้นจากรหัสที่คุณดำเนินการเพิ่ม
server.lua (Server)
ไปยังโฟลเดอร์ server แล้วดำเนินการเปิดไฟล์ server.lua
ระบบ-แจกไอเทม
Event | Label |
---|---|
TimeGiveItemAll | ระบบ-แจกไอเทม |
- วางรหัสด้านล่างนี้ต่อจาก
xPlayer.addInventoryItem(Config.Items[ranItem].name, Config.Items[ranItem].count)
บรรทัดที่ 23
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'TimeGiveItemAll ',
content = ('ได้รับ %s จำนวน %s'):format(ESX.GetItemLabel(Config.Items[ranItem].name), Config.Items[ranItem].count),
source = xPlayer.source,
color = 2
})
end)
- วางรหัสด้านล่างนี้ต่อจาก
xPlayer.addInventoryItem(Config.Items[i].name, Config.Items[i].count)
บรรทัดที่ 27
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'TimeGiveItemAll ',
content = ('ได้รับ %s จำนวน %s'):format(ESX.GetItemLabel(Config.Items[i].name), Config.Items[i].count),
source = xPlayer.source,
color = 2
})
end)
ระบบ-แจกเงิน
Event | Label |
---|---|
TimeGiveMoneyAll | ระบบ-แจกเงิน |
- วางรหัสด้านล่างนี้ต่อจาก
end
บรรทัดที่ 50
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'TimeGiveMoneyAll ',
content = ('ได้รับ %s จำนวน $%s'):format(Config.Money[ranMoney].account, ESX.Math.GroupDigits(Config.Money[ranMoney].amount)),
source = xPlayer.source,
color = 2
})
end)
- วางรหัสด้านล่างนี้ต่อจาก
end
บรรทัดที่ 62
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'TimeGiveMoneyAll ',
content = ('ได้รับ %s จำนวน $%s'):format(Config.Money[i].account, ESX.Math.GroupDigits(Config.Money[i].amount)),
source = xPlayer.source,
color = 2
})
end)
ระบบ-แจกอาวุธ
Event | Label |
---|---|
TimeGiveWeaponAll | ระบบ-แจกอาวุธ |
- วางรหัสด้านล่างนี้ต่อจาก
xPlayer.addWeapon(Config.Weapon[ranWeapon].weaponName, Config.Weapon[ranWeapon].amount)
บรรทัดที่ 75
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'TimeGiveWeaponAll ',
content = ('ได้รับ %s และ กระสุน จำนวน %s'):format(ESX.GetWeaponLabel(Config.Weapon[ranWeapon].weaponName), Config.Weapon[ranWeapon].amount),
source = xPlayer.source,
color = 2
})
end)
- วางรหัสด้านล่างนี้ต่อจาก
xPlayer.addWeapon(Config.Weapon[i].weaponName, Config.Weapon[i].amount)
บรรทัดที่ 79
pcall(function()
exports['azael_dc-serverlogs']:insertData({
event = 'TimeGiveWeaponAll ',
content = ('ได้รับ %s และ กระสุน จำนวน %s'):format(ESX.GetWeaponLabel(Config.Weapon[i].weaponName), Config.Weapon[i].amount),
source = xPlayer.source,
color = 2
})
end)