X3D Notify (แจ้งเตือน)
การ์ดแจ้งเตือน 9 ตำแหน่ง ใส่ไอคอนไอเทมกับกรอบระดับความหายากได้ รองรับภาษาไทยเต็มรูปแบบ
ซื้อ / รับฟรีตั้งค่า configการติดตั้ง
ensure x3d_notify
เอา esx_notify ตัวเดิมออกก่อน เพราะสองตัวเปิด NUI ซ้อนกัน
มีสคริปต์เก่าเรียก exports['esx_notify'] อยู่? ย้าย optional/esx_notify/ ออกมาไว้ใน resources/ แล้ว ensure esx_notify ต่อจาก x3d_notify เป็นตัวส่งต่อ 12 บรรทัด ไม่ต้องแก้สคริปต์เก่าสักตัว
ensure x3d_notify
ensure esx_notify # เฉพาะเมื่อมีสคริปต์เก่าเรียกชื่อนี้
ตั้งค่า (config.lua)
| คีย์ | ค่าเริ่มต้น | ความหมาย |
|---|---|---|
Config.position |
middle-right |
ตำแหน่งเริ่มต้นของการ์ด (ใช้เมื่อสคริปต์ไม่ระบุตำแหน่ง) |
Config.notificationSoundEnabled |
true |
เปิดเสียงแจ้งเตือน |
Config.Debug |
false |
พิมพ์ทุกการแจ้งเตือนลงคอนโซลฝั่ง client |
ใช้ยังไง
-- ฝั่ง client
exports['x3d_notify']:Notify(type, length, message, title, position, icon, iconBg)
exports['x3d_notify']:Success(message, length, title, position)
exports['x3d_notify']:Error(message, length, title, position)
exports['x3d_notify']:Warning(message, length, title, position)
exports['x3d_notify']:Info(message, length, title, position)
exports['x3d_notify']:ClearAll()
exports['x3d_notify']:SetConfig(position, soundEnabled)
-- ฝั่ง server
TriggerClientEvent('ESX:Notify', source, type, length, message, title, position)
type คือ success error warning info (คุมสีกับไอคอน)
length คือเวลาแสดงเป็นมิลลิวินาที ถ้าไม่ใส่ใช้ 3000
title ใส่อะไรก็ได้ ถ้าไม่ใส่การ์ดจะแสดงชื่อประเภทแทน
icon / iconBg คือรูปไอเทมและรูปกรอบระดับความหายาก
position คือ top-right top-left top-center bottom-right bottom-left bottom-center left-center right-center center ถ้าไม่ใส่ใช้ Config.position
สีในข้อความ
~r~ แดง · ~g~ เขียว · ~b~ น้ำเงิน · ~y~ เหลือง · ~p~ ม่วง · ~o~ ส้ม · ~s~ กลับสีปกติ · ~br~ ขึ้นบรรทัดใหม่
exports['x3d_notify']:Error('เงินไม่พอ ต้องการ ~r~$5,000~s~', 4000, 'ใช้เงิน')
คำสั่งทดสอบ
พิมพ์ /testnotify ในเกมเพื่อดูว่าการ์ดขึ้นปกติ