This repository was archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient.lua
129 lines (113 loc) · 3.06 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
local show = true
local active = false
local liczba = 1
local ProgressColor = {100, 1, 1}
local global_text
local global_timer
local global_type
------------EXAMPLE------------------------
-- local timer = 5
-- local type = "success"
-- local text = "Simple test redemrp_notification"
-- TriggerEvent("redemrp_notification:start", text, timer, type)
--------------OR-------------------------
-- TriggerEvent("redemrp_notification:start", "Simple test redemrp_notification" , 5)
-------------TEST COMMAND-------------
--[[
RegisterCommand('test_notification', function(source, args)
local text = ''
for i = 1,#args do
text = text .. ' ' .. args[i]
end
TriggerEvent("redemrp_notification:start", text , 5, "success")
end)
]]
RegisterNetEvent('redemrp_notification:start')
AddEventHandler('redemrp_notification:start', function(_text, _timer, _type)
global_type = _type
global_text = _text
global_timer =_timer
if _type == "error" then
ProgressColor = {100, 1, 1}
elseif _type == "success" then
ProgressColor = {37, 87, 5}
elseif _type == "warning" then
ProgressColor = {191, 143, 0}
else
ProgressColor = {100, 1, 1}
end
if active then
Citizen.CreateThread(function()
active = false
hideUI()
Citizen.Wait(100)
TriggerEvent("redemrp_notification:start", global_text , global_timer, global_type)
end)
else
active = true
liczba = GetLengthOfLiteralString(_text)
print(liczba)
ShowUI(_text, liczba)
bg(_timer)
end
end)
function hideUI()
SendNUIMessage({
type = "ui",
display = false
})
show = false
active = false
end
function ShowUI(text)
local _text = text
local _liczba = liczba*1.1
if _liczba < 80 then
_liczba = 80
end
SendNUIMessage({
type = "ui",
display = true,
text = _text,
liczba = _liczba
})
show = true
end
function bg(_timer)
local offset = 0
local height = liczba*0.0015
local load_offset = 0.6
if height < 0.1 then
height = 0.1
end
if liczba < 100 and liczba > 75 then
offset = 0.01
load_offset = 0.60
end
if liczba > 100 and liczba < 145 then
offset = liczba*0.0002
end
if liczba >= 145 then
offset = liczba*0.0003
end
if liczba > 200 then
offset = liczba*0.0004
load_offset = 0.58
end
print(offset)
HasStreamedTextureDictLoaded("generic_textures")
HasStreamedTextureDictLoaded("feeds")
Citizen.CreateThread(function()
local timer = _timer*100
local loading = 0.22
local del = loading/timer
while show and timer > 0 do
Citizen.Wait(0)
DrawSprite("feeds", "toast_bg", 0.15, 0.57+offset, 0.25, height, 0.2, 000, 2, 2, 255, 1)
DrawSprite("generic_textures", "hud_menu_4a", 0.15, load_offset +(offset*2), loading, 0.01, 0.2, ProgressColor[1], ProgressColor[2], ProgressColor[3], 190, 0)
timer = timer - 1
loading = loading - del
end
hideUI()
end)
end