-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.lua
25 lines (22 loc) · 848 Bytes
/
client.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
notifications = {}
addEvent( "callNotification",true)
addEvent( "onPreNotificationRender",true)
addEvent( "onNotificationRendered",true)
local create_play= true
addEventHandler( "onPreNotificationRender", localPlayer, function() create_play = false end)
addEventHandler( "onNotificationRendered", localPlayer, function(object)
for k,v in pairs(notifications) do
if v.id == object or not v.id then table.remove( notifications, k ) end
end
create_play = true
if #notifications > 0 then
notifications[1].start()
end
end)
function createNotification(text)
if not create_play then
if notifications[#notifications].text == text then return end
end
table.insert( notifications, Notification:new(text,create_play))
end
addEventHandler( "callNotification", localPlayer, createNotification )