@@ -3,12 +3,9 @@ MSK = {}
3
3
if Config .Framework :match (' esx' ) then
4
4
ESX = exports [" es_extended" ]:getSharedObject ()
5
5
6
- AddEventHandler (' esx:setPlayerData' , function (key , val , last )
6
+ RegisterNetEvent (' esx:setPlayerData' , function (key , val )
7
7
if GetInvokingResource () == ' es_extended' then
8
8
ESX .PlayerData [key ] = val
9
- if OnPlayerData then
10
- OnPlayerData (key , val , last )
11
- end
12
9
end
13
10
end )
14
11
@@ -21,6 +18,10 @@ if Config.Framework:match('esx') then
21
18
ESX .PlayerLoaded = false
22
19
ESX .PlayerData = {}
23
20
end )
21
+
22
+ RegisterNetEvent (' esx:setJob' , function (job )
23
+ ESX .PlayerData .job = job
24
+ end )
24
25
elseif Config .Framework :match (' qbcore' ) then
25
26
QBCore = exports [' qb-core' ]:GetCoreObject ()
26
27
35
36
36
37
MSK .Notification = function (title , message , typ , duration )
37
38
if Config .Notification == ' native' then
38
- SetNotificationTextEntry (' STRING' )
39
- AddTextComponentString (message )
40
- DrawNotification (false , true )
39
+ BeginTextCommandThefeedPost (' STRING' )
40
+ AddTextComponentSubstringPlayerName (message )
41
+ EndTextCommandThefeedPostTicker (false , true )
41
42
elseif Config .Notification == ' okok' then
42
43
exports [' okokNotify' ]:Alert (title , message , duration or 5000 , typ or ' info' )
43
44
elseif Config .Notification == ' custom' then
@@ -52,30 +53,94 @@ MSK.Notification = function(title, message, typ, duration)
52
53
})
53
54
end
54
55
end
56
+ MSK .Notify = MSK .Notification
55
57
exports (' Notification' , MSK .Notification )
56
58
57
59
MSK .HelpNotification = function (text )
58
- SetTextComponentFormat (' STRING' )
59
- AddTextComponentString (text )
60
- DisplayHelpTextFromStringLabel (0 , 0 , 1 , - 1 )
60
+ BeginTextCommandDisplayHelp (' STRING' )
61
+ AddTextComponentSubstringPlayerName (text )
62
+ EndTextCommandDisplayHelp (0 , false , true , - 1 )
61
63
end
64
+ MSK .HelpNotify = MSK .HelpNotification
62
65
exports (' HelpNotification' , MSK .HelpNotification )
63
66
64
67
MSK .AdvancedNotification = function (text , title , subtitle , icon , flash , icontype )
65
68
if not flash then flash = true end
66
69
if not icontype then icontype = 1 end
67
70
if not icon then icon = ' CHAR_HUMANDEFAULT' end
68
71
69
- SetNotificationTextEntry (' STRING' )
70
- AddTextComponentString (text )
71
- SetNotificationMessage (icon , icon , flash , icontype , title , subtitle )
72
- DrawNotification (false , true )
72
+ BeginTextCommandThefeedPost (' STRING' )
73
+ AddTextComponentSubstringPlayerName (text )
74
+ EndTextCommandThefeedPostMessagetext (icon , icon , flash , icontype , title , subtitle )
75
+ EndTextCommandThefeedPostTicker (false , true )
73
76
end
77
+ MSK .AdvancedNotify = MSK .AdvancedNotification
74
78
exports (' AdvancedNotification' , MSK .AdvancedNotification )
75
79
80
+ MSK .ScaleformAnnounce = function (header , text , typ , duration )
81
+ local scaleform = ' '
82
+
83
+ local loadScaleform = function (sclform )
84
+ if not HasScaleformMovieLoaded (scaleform ) then
85
+ scaleform = RequestScaleformMovie (sclform )
86
+ while not HasScaleformMovieLoaded (scaleform ) do
87
+ Wait (1 )
88
+ end
89
+ end
90
+ end
91
+
92
+ if typ == 1 then
93
+ loadScaleform (" MP_BIG_MESSAGE_FREEMODE" )
94
+ BeginScaleformMovieMethod (scaleform , " SHOW_SHARD_WASTED_MP_MESSAGE" )
95
+ ScaleformMovieMethodAddParamTextureNameString (header )
96
+ ScaleformMovieMethodAddParamTextureNameString (text )
97
+ EndScaleformMovieMethod ()
98
+ elseif typ == 2 then
99
+ loadScaleform (" POPUP_WARNING" )
100
+ BeginScaleformMovieMethod (scaleform , " SHOW_POPUP_WARNING" )
101
+ ScaleformMovieMethodAddParamFloat (500.0 )
102
+ ScaleformMovieMethodAddParamTextureNameString (header )
103
+ ScaleformMovieMethodAddParamTextureNameString (text )
104
+ EndScaleformMovieMethod ()
105
+ end
106
+
107
+ local draw = true
108
+ while draw do
109
+ local sleep = 1
110
+
111
+ DrawScaleformMovieFullscreen (scaleform , 255 , 255 , 255 , 255 , 0 )
112
+
113
+ MSK .SetTimeout (duration or 8000 , function ()
114
+ draw = false
115
+ end )
116
+
117
+ Wait (sleep )
118
+ end
119
+ end
120
+ MSK .Scaleform = MSK .ScaleformAnnounce
121
+ exports (' ScaleformAnnounce' , MSK .ScaleformAnnounce )
122
+
123
+ MSK .Subtitle = function (text , duration )
124
+ BeginTextCommandPrint (' STRING' )
125
+ AddTextComponentSubstringPlayerName (text )
126
+ EndTextCommandPrint (duration , true )
127
+ end
128
+ exports (' Subtitle' , MSK .Subtitle )
129
+
130
+ MSK .Spinner = function (text , typ , duration )
131
+ BeginTextCommandBusyspinnerOn (' STRING' )
132
+ AddTextComponentSubstringPlayerName (text )
133
+ EndTextCommandBusyspinnerOn (typ or 4 ) -- 4 or 5, all others are useless // 4 = orange // 5 = white
134
+
135
+ MSK .SetTimeout (duration or 5000 , function ()
136
+ BusyspinnerOff ()
137
+ end )
138
+ end
139
+ exports (' Spinner' , MSK .Spinner )
140
+
76
141
MSK .Draw3DText = function (coords , text , size , font )
77
142
local coords = type (coords ) == " vector3" and coords or vec (coords .x , coords .y , coords .z )
78
- local camCoords = GetGameplayCamCoords ()
143
+ local camCoords = GetFinalRenderedCamCoord ()
79
144
local distance = # (coords - camCoords )
80
145
81
146
if not size then size = 1 end
@@ -165,12 +230,22 @@ MSK.ProgressStop = function()
165
230
end
166
231
exports (' ProgressStop' , MSK .ProgressStop )
167
232
168
- RegisterNetEvent (" msk_core:notification" )
169
- AddEventHandler (" msk_core:notification" , function (title , message , info , time )
170
- MSK .Notification (title , message , info , time )
233
+ RegisterNetEvent (" msk_core:notification" , function (title , message , typ , time )
234
+ MSK .Notification (title , message , typ , time )
171
235
end )
172
236
173
- RegisterNetEvent (' msk_core:advancedNotification' )
174
- AddEventHandler (' msk_core:advancedNotification' , function (text , title , subtitle , icon , flash , icontype )
237
+ RegisterNetEvent (' msk_core:advancedNotification' , function (text , title , subtitle , icon , flash , icontype )
175
238
MSK .AdvancedNotification (text , title , subtitle , icon , flash , icontype )
239
+ end )
240
+
241
+ RegisterNetEvent (" msk_core:scaleformNotification" , function (title , message , typ , duration )
242
+ MSK .ScaleformAnnounce (title , message , typ , duration )
243
+ end )
244
+
245
+ RegisterNetEvent (" msk_core:subtitle" , function (message , duration )
246
+ MSK .Subtitle (message , duration )
247
+ end )
248
+
249
+ RegisterNetEvent (" msk_core:spinner" , function (text , typ , duration )
250
+ MSK .Spinner (text , typ , duration )
176
251
end )
0 commit comments