Jump to content

[REL] simple-notifications


ViRuZGamiing

Recommended Posts

Hi guys

 

I was in need of some notifications in my car-dealership script, so I decided to split up the functionality and share this resource as well.

These notifications aren't very special but can be very useful for displaying errors or information, they stack underneath each other and can be removed manually or automatically.

 

Visual Example

R58EhwG.png

List of Functions (client)

add: adds a notification with given parameters

exports["simple-notifications"]:add("Hello world!", 7000, 220, tocolor(255, 255, 255), tocolor(0, 155, 0, 155));
add(text[, delay, fade, textColor, bgColor])
  text: text to display (string)
  delay (optional): time to stay active in milliseconds (number)
      default: 7000
  fade (optional): time for the fade out animation in milliseconds (number)
      default: 220
  textColor (optional): color of the text (tocolor)
      default: tocolor(255, 255, 255)
  bgColor (optional): background color of the text (tocolor)
      default: tocolor(0, 0, 0, 155)
      
return index (number)

shift: removes the first notification

exports["simple-notifications"]:shift();

pop: removes the last notification

exports["simple-notifications"]:pop();

remove: removes a notification by index

remove(idx[, instant])
	idx: the index returned from the add function (number)
	instant: remove the notification without fade (boolean)
		default: false

List of Functions (server)

All client side functions are shared, but they take an extra first argument playerSource, example:

exports["simple-notifications"]:add(source, "Hello world!", 7000, 220, tocolor(255, 255, 255), tocolor(0, 155, 0, 155));

Download
https://community.mtasa.com/index.php?p=resources&s=details&id=18339

 

Leave any questions or feedback below and I'll see if I add it.

Viruz out!

Edited by ViRuZGamiing
finished editing
  • Like 2
Link to post
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...