الإخطارات القابلة للتخصيص ل fivem. يحاكي الإخطارات GTAV الأصلية ، ولكنها تسمح بمزيد من التخصيص
css
الخاصة بك إلى ui/css/custom.css
~r~
، ~b~
، ~h~
، إلخ) exports . bulletin : Send ( message , timeout , position , progress , theme , exitAnim , flash )
-- or
exports . bulletin : Send ({
message = ' Message ' ,
timeout = 5000 ,
theme = ' success '
...
})
exports . bulletin : SendAdvanced ( message , title , subject , icon , timeout , position , progress , theme , exitAnim , flash )
-- or
exports . bulletin : SendAdvanced ({
message = ' Some Message ' ,
title = ' Some Title ' ,
subject = ' Some Subtitle ' ,
icon = ' CHAR_BANK_MAZE ' ,
...
})
local pinID = exports . bulletin : SendPinned ({
type = ' advanced ' , -- or 'standard'
message = ' This is pinned! ' ,
title = ' Title ' ,
subject = ' Subject ' ,
icon = ' CHAR_BANK_MAZE '
})
-- unpin
exports . bulletin : Unpin ( pinID )
-- unpin multiple
exports . bulletin : Unpin ({ pinID1 , pinID2 , pinID3 , ... })
-- unpin all
exports . bulletin : Unpin ()
-- update content
exports . bulletin : UpdatePinned ( pinID , options )
هذه أساليب اختصار لإرسال إخطار تحت عنوان. يأخذون نفس params / table مثل طريقة Send()
:
-- Send standard success notification
exports . bulletin : SendSuccess ( ... )
-- Send standard info notification
exports . bulletin : SendInfo ( ... )
-- Send standard warning notification
exports . bulletin : SendWarning ( ... )
-- Send standard error notification
exports . bulletin : SendError ( ... )
يمكن تشغيل جميع الطرق من كل من العميل والخادم:
-- standard
TriggerClientEvent ( ' bulletin:send ' , source , ... )
-- advanced
TriggerClientEvent ( ' bulletin:sendAdvanced ' , source , ... )
يتم تمريرها كمعلمة فردية أو في جدول:
بارام | يكتب | تقصير | خيارات | خياري | وصف |
---|---|---|---|---|---|
message | string | لا | رسالة لإرسالها. يمكن أن تكون سلسلة أو HTML صالحة | ||
timeout | integer | 5000 | نعم | المدة في ms لعرض الإخطار | |
position | string | "bottomleft" | "bottomleft" ، "topleft" "topright" "bottomright" ، "bottom" ، "top" | نعم | نشر الإخطار |
progress | boolean | false | true ، false | نعم | ما إذا كان يجب عرض تقدم مهلة الإخطار |
theme | string | "default" | "default" ، "success" ، "info" ، "warning" ، "error" | نعم | موضوع الإخطار |
exitAnim | string | "fadeOut" | انظر animate.css للخيارات | نعم | الرسوم المتحركة المستخدمة لإخفاء الإشعار |
flash | boolean | false | نعم | يجعل الإخطار وميض | |
title | string | لا | عنوان الإخطار (متقدم فقط) | ||
subject | string | لا | الموضوع / الترجمة من الإخطار (متقدم فقط) | ||
icon | string | لا | الصورة لاستخدامها (متقدمة فقط) |
Config . Timeout = 5000 -- Overridden by the `timeout` param
Config . Position = " bottomleft " -- Overridden by the `position` param
Config . Progress = false -- Overridden by the `progress` param
Config . Theme = " default " -- Overridden by the `theme` param
Config . Queue = 5 -- No. of notifications to show before queueing
Config . Stacking = true
Config . ShowStackedCount = true
Config . AnimationOut = " fadeOut " -- Default exit animation - overriden by the `exitAnim` param
Config . AnimationTime = 500 -- Entry / exit animation interval
Config . FlashCount = 5 -- No. of times the notification blinks when `flash` param is used
Config . SoundFile = false -- Sound file stored in ui/audio used for notification sound. Leave as false to disable.
Config . SoundVolume = 0.4 -- 0.0 - 1.0
Config . Pictures = {
-- advanced notification icons
}
لإضافة صورتك المخصصة الخاصة بك ، قم بتحميل صورة 64x64
jpg
إلى دليل ui/images
وأضف الكود المخصص واسم الملف إلى جدول Config.Pictures
في config.lua
،
قم بتحميل my_custom_icon_image.jpg
إلى دليل ui/images
واستخدم MY_CUSTOM_ICON_CODE
(بدون مسافات!) كمفتاح.
Config . Pictures = {
...
MY_CUSTOM_ICON_CODE = " my_custom_icon_image.jpg " -- Add this
}
ثم استخدم الرمز المخصص في استدعاء الإخطار:
exports . bulletin : SendAdvanced ( " Message " , " Title " , " Subject " , " MY_CUSTOM_ICON_CODE " )
يمكنك تمكين صوت الإخطار عن طريق تحميل ملف صوت مخصص إلى دليل ui/audio
وتحرير التكوين لاستخدامه:
Config . SoundFile = ' my_notification_sound.mp3 '
Config . SoundVolume = 0.4
ملفات صوتية صالحة: .mp3
، .ogg
، .wav
نشرة تدعم التنسيق التالي:
n = new line
~ r ~ = Red
~ b ~ = Blue
~ g ~ = Green
~ y ~ = Yellow
~ p ~ = Purple
~ o ~ = Orange
~ u ~ = Black
~ w ~ = White
~ h ~ = Bold Text
يمكنك أيضًا استخدام HTML للألوان:
exports . bulletin : Send ( " <span class='r'>I am red</span> and <span class='y'>I am yellow</span> " )
أو أي HTML تحب
exports . bulletin : Send ( " <h1>Some Title</h1><p class='paragraph'>Some text</p><footer>Some footer text</footer> " )
من أجل إرسال إشعار مثبت ، ستحتاج إلى تخزين pin_id
من الإخطار حتى تتمكن من إلغاء وضعه لاحقًا.
local pinID = exports . bulletin : SendPinned ({
type = ' advanced ' -- or 'standard'
message = ' This is pinned! '
})
ثم لإلغاء تنفيذها فقط تمرير القيمة المخزنة إلى طريقة Unpin()
:
exports . bulletin : Unpin ( pinID )
تقبل طريقة Unpin()
أيضًا table
معرفات الدبوس:
exports . bulletin : Unpin ({ pinned1 , pinned2 , pinned3 })
أو حذف المعلمة لإلغاء كل شيء:
exports . bulletin : Unpin ()
يمكنك أيضًا تحديث محتوى الإشعار المثبت:
-- Send pinned notification
local pinID = exports . bulletin : SendPinned ({
type = ' advanced ' ,
message = ' This is pinned! ' ,
title = ' Title ' ,
subject = ' Subject ' ,
icon = ' CHAR_BANK_MAZE ' ,
theme = ' success '
})
-- Update it's content
exports . bulletin : UpdatePinned ( pinID , {
message = ' Updated message! ' ,
title = ' Updated title ' ,
subject = ' Updated subject ' ,
icon = ' CHAR_TREVOR ' ,
theme = ' error ' ,
flash = true
})
يمكن تحديث message
فقط ، title
، subject
، icon
، خيارات theme
flash
في الوقت الحالي.
لا يتم وضع الإشعارات المثبتة في قائمة الانتظار ، على سبيل المثال ، إذا قمت بتعيين Config.Queue
إلى 5
وكان لديك إعلامين 2
، فستحصل على أقصى قدر من 7
إشعارات تظهر في أي وقت.
إذا كنت تستخدم ESX
، فيمكنك الحصول على bulletin
لتجاوز الإخطارات عن طريق تحرير الوظائف المناسبة في es_extended/client/functions.lua
:
ESX . ShowNotification = function ( msg )
-- SetNotificationTextEntry('STRING')
-- AddTextComponentString(msg)
-- DrawNotification(0,1)
exports . bulletin : Send ( msg )
end
ESX . ShowAdvancedNotification = function ( sender , subject , msg , textureDict , iconType , flash , saveToBrief , hudColorIndex )
-- if saveToBrief == nil then saveToBrief = true end
-- AddTextEntry('esxAdvancedNotification', msg)
-- BeginTextCommandThefeedPost('esxAdvancedNotification')
-- if hudColorIndex then ThefeedNextPostBackgroundColor(hudColorIndex) end
-- EndTextCommandThefeedPostMessagetext(textureDict, textureDict, false, iconType, sender, subject)
-- EndTextCommandThefeedPostTicker(flash or false, saveToBrief)
exports . bulletin : SendAdvanced ( msg , sender , subject , textureDict )
end
نشرة حقوق الطبع والنشر (ج) 2021 MOBIUS1 هذا البرنامج هو برنامج مجاني: يمكنك إعادة توزيعه و/أو تعديله بموجب شروط رخصة GNU العامة العامة كما تم نشرها من قبل مؤسسة البرمجيات المجانية ، إما الإصدار 3 من الترخيص ، أو (في خيارك) أي إصدار لاحق. يتم توزيع هذا البرنامج على أمل أن يكون مفيدًا ، ولكن بدون أي ضمان ؛ بدون حتى الضمان الضمني للتسويق أو اللياقة لغرض معين. راجع رخصة GNU العامة لمزيد من التفاصيل. يجب أن تكون قد تلقيت نسخة من رخصة GNU العامة العامة مع هذا البرنامج. |