Skip to content

Blackpantek/mythic_notify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mythic Notifications

A simple notification system inspired by NoPixel's

Image of Notification

Use

To display a notification simply make a call like below (Client-Side) :

exports['mythic_notify']:SendAlert('type', 'message')

Notification Styles

  • Inform - 'inform'
  • Error - 'error'
  • Success - 'success'

Client-Side Functions (All Exported)

  • SendAlert ( type, text, length, style ) | Displays Standard Alert For Provided Time. Length & Style are both optional, if no length is passed it defaults to 2500ms or 2.5s. If no style is passed it will use the style of the passed alert type
  • PersistentAlert ( action, id, type, text, style ) | Displays an alert that will persist on the screen until function is called again with end action.

Client Events (Trigger Notification From Server)

  • mythic_notify:client:SendAlert OBJECT { type, text, duration } - If no duration is given, will default to 2500ms
  • mythic_notify:client:PersistentAlert OBJECT { action, id, type, text } - Note: If using end action, type & text can be excluded)

Persistent Notifications Actions -

  • start - ( id, type, text, style ) - Additionally, you can call PersistentAlert with the start action and pass an already existing ID to update the notification on the screen.
  • end - ( id )

Note About ID: This is expected to be an entirely unique value that your resource is responsible for tracking. I’d suggest using something related to your resource name so there’s no chance of interferring with any other persistent notifications that may exist.

Custom Style Format -

The custom style is a simple array in key, value format where the key is the CSS style attribute and the value is whatever you want to set that CSS attribute to.

Examples -

Client:
exports['mythic_notify']:SendAlert('inform', 'Hype! Custom Styling!', 2500, { ['background-color'] = '#ffffff', ['color'] = '#000000' })
Server:
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Hype! Custom Styling!', length = 2500, style = { ['background-color'] = '#ffffff', ['color'] = '#000000' } })

Note: When calling through the event, you can omit the length parameter and the alert will default to 2500 ms or ~2.5 seconds

Result:

Custom Styling

About

A simple FiveM notification resource

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 41.5%
  • JavaScript 39.1%
  • CSS 12.2%
  • HTML 7.2%