Giter Site home page Giter Site logo

bulletin's Introduction

bulletin

Customisable notifications for FiveM. Mimics native GTAV notifications, but allows more customisation

Features

  • Not external libraries - written from the ground up for FiveM
  • Modern JS
  • Customise the position
  • Customise the look by adding your own css overrides to custom.css
  • Add your own fonts
  • Add your own advanced notification pictures
  • Supports queueing

Usage

Send Notification

Using exports:

exports.bulletin:Send(message, timeout, position, progress, theme)

Using events:

-- client
TriggerEvent("bulletin:send", message, timeout, position, progress, theme)

-- server
TriggerClientEvent("bulletin:send", source, message, timeout, position, progress, theme)

Send Advanced Notification

Using exports:

exports.bulletin:SendAdvanced(message, title, subject, icon, timeout, position, progress, theme)

Using events:

-- client 
TriggerEvent("bulletin:sendAdvanced", message, title, subject, icon, timeout, position, progress, theme)

-- server
TriggerClientEvent("bulletin:sendAdvanced", source, message, title, subject, icon, timeout, position, progress, theme)

Parameters

param type default options optional description
message string NO The message to send
timeout integer 5000 YES The duration in ms to display the notification
position string "bottomleft" "bottomleft", "topleft", "topright", "bottomright", "bottom", "top" YES The postion of the notification
progress boolean false true, false YES Whether to display the progress of the notification timeout
theme string "default" "default", "success", "warning", "danger" YES The theme of the notification
title string NO The title of the notification (advanced only)
subject string NO The subject / subtitle of the notification (advanced only)
icon string NO The picture to use (advanced only)

Default Config

Config.Timeout  = 5000          -- Overriden by the `timeout` param
Config.Position = "bottomleft"  -- Overriden by the `position` param
Config.Progress = false         -- Overriden by the `progress` param
Config.Theme    = "default"     -- Overriden by the `theme` param
Config.Queue    = 5             -- No. of notifications to show before queueing
Config.FadeTime = 500           -- The fadeIn / fadeOut time in ms

Config.Pictures = {
    -- advanced notification icons
}

Custom Advanced Notification Pictures

To add your own custom picture, upload a 64x64 jpg image to the ui/images directory and add the custom code and filename to the Config.Pictures table in config.lua,

Example

Upload my_custom_icon_image.jpg to the ui/images directory and use MY_CUSTOM_ICON_CODE (NO SPACES!) as the key.

Config.Pictures = {
    ...
    MY_CUSTOM_ICON_CODE = "my_custom_icon_image.jpg" -- Add this
}

Then use the custom code in the notification call:

exports.bulletin:SendAdvanced("Message", "Title", "Subject", "MY_CUSTOM_ICON_CODE")

Formatting

Bulletin supports the following formatting:

\n = new line
~r~ = Red
~b~ = Blue
~g~ = Green
~y~ = Yellow
~p~ = Purple
~o~ = Orange
~u~ = Black
~s~ / ~w~ = White
~h~ = Bold Text

To Do / Planned

  • Reduce number of params in favour of table of options
  • Support notification sound




Legal Notices

bulletin

Copyright (C) 2021 Mobius1

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.
If not, see https://www.gnu.org/licenses/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.