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
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.multitheftauto.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!