Skip to content

Commit 40a0e6d

Browse files
committed
Update v2.1.3
* Renamed common folder to shared * Updated Natives * Added MSK.Subtitle * Added MSK.Spinner * Added MSK.ScaleformAnnounce
1 parent beef60b commit 40a0e6d

File tree

6 files changed

+122
-44
lines changed

6 files changed

+122
-44
lines changed

Readme.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
## Requirements
99
* oxmysql
1010

11-
## Notifications
11+
## MSK.Notification
1212
![Screenshot_283](https://github.com/MSK-Scripts/msk_core/assets/49867381/81ee7bb1-f862-46f5-b56a-507da8fde12d)
1313

14-
## Input
14+
## MSK.Input
1515
![Screenshot_278](https://github.com/MSK-Scripts/msk_core/assets/49867381/6ea12afb-1376-4ff6-9781-c546b3242a45)
1616
![Screenshot_277](https://github.com/MSK-Scripts/msk_core/assets/49867381/a220b32e-d3a4-489f-86c3-3a1606cf4526)
1717

18-
## Numpad
18+
## MSK.Numpad
1919
![Screenshot_279](https://github.com/MSK-Scripts/msk_core/assets/49867381/a6922fdf-458f-4c98-951f-4d6d456e4dbe)
2020
![Screenshot_280](https://github.com/MSK-Scripts/msk_core/assets/49867381/4931b498-2b34-4655-9bab-f3f125822167)

client/cl_progress.lua

-18
This file was deleted.

client/main.lua

+95-20
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ MSK = {}
33
if Config.Framework:match('esx') then
44
ESX = exports["es_extended"]:getSharedObject()
55

6-
AddEventHandler('esx:setPlayerData', function(key, val, last)
6+
RegisterNetEvent('esx:setPlayerData', function(key, val)
77
if GetInvokingResource() == 'es_extended' then
88
ESX.PlayerData[key] = val
9-
if OnPlayerData then
10-
OnPlayerData(key, val, last)
11-
end
129
end
1310
end)
1411

@@ -21,6 +18,10 @@ if Config.Framework:match('esx') then
2118
ESX.PlayerLoaded = false
2219
ESX.PlayerData = {}
2320
end)
21+
22+
RegisterNetEvent('esx:setJob', function(job)
23+
ESX.PlayerData.job = job
24+
end)
2425
elseif Config.Framework:match('qbcore') then
2526
QBCore = exports['qb-core']:GetCoreObject()
2627

@@ -35,9 +36,9 @@ end)
3536

3637
MSK.Notification = function(title, message, typ, duration)
3738
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)
4142
elseif Config.Notification == 'okok' then
4243
exports['okokNotify']:Alert(title, message, duration or 5000, typ or 'info')
4344
elseif Config.Notification == 'custom' then
@@ -52,30 +53,94 @@ MSK.Notification = function(title, message, typ, duration)
5253
})
5354
end
5455
end
56+
MSK.Notify = MSK.Notification
5557
exports('Notification', MSK.Notification)
5658

5759
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)
6163
end
64+
MSK.HelpNotify = MSK.HelpNotification
6265
exports('HelpNotification', MSK.HelpNotification)
6366

6467
MSK.AdvancedNotification = function(text, title, subtitle, icon, flash, icontype)
6568
if not flash then flash = true end
6669
if not icontype then icontype = 1 end
6770
if not icon then icon = 'CHAR_HUMANDEFAULT' end
6871

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)
7376
end
77+
MSK.AdvancedNotify = MSK.AdvancedNotification
7478
exports('AdvancedNotification', MSK.AdvancedNotification)
7579

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+
76141
MSK.Draw3DText = function(coords, text, size, font)
77142
local coords = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
78-
local camCoords = GetGameplayCamCoords()
143+
local camCoords = GetFinalRenderedCamCoord()
79144
local distance = #(coords - camCoords)
80145

81146
if not size then size = 1 end
@@ -165,12 +230,22 @@ MSK.ProgressStop = function()
165230
end
166231
exports('ProgressStop', MSK.ProgressStop)
167232

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)
171235
end)
172236

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)
175238
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)
176251
end)

fxmanifest.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ games { 'gta5' }
44
author 'Musiker15 - MSK Scripts'
55
name 'msk_core'
66
description 'Core functions for MSK Scripts'
7-
version '2.1.2'
7+
version '2.1.3'
88

99
lua54 'yes'
1010

@@ -15,14 +15,14 @@ shared_scripts {
1515
client_scripts {
1616
'client/main.lua',
1717
'client/cl_*.lua',
18-
'common/common.lua',
18+
'shared/shared.lua',
1919
}
2020

2121
server_scripts {
2222
'@oxmysql/lib/MySQL.lua',
2323
'server/main.lua',
2424
'server/sv_*.lua',
25-
'common/common.lua',
25+
'shared/shared.lua',
2626
}
2727

2828
ui_page 'html/index.html'

server/main.lua

+21
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,35 @@ MSK.Notification = function(src, title, message, info, time)
105105
if not src or src == 0 then return end
106106
TriggerClientEvent('msk_core:notification', src, title, message, info, time)
107107
end
108+
MSK.Notify = MSK.Notification
108109
exports('Notification', MSK.Notification)
109110

110111
MSK.AdvancedNotification = function(src, text, title, subtitle, icon, flash, icontype)
111112
if not src or src == 0 then return end
112113
TriggerClientEvent('msk_core:advancedNotification', src, text, title, subtitle, icon, flash, icontype)
113114
end
115+
MSK.AdvancedNotify = MSK.AdvancedNotification
114116
exports('AdvancedNotification', MSK.AdvancedNotification)
115117

118+
MSK.ScaleformAnnounce = function(src, header, text, typ, duration)
119+
if not src or src == 0 then return end
120+
TriggerClientEvent('msk_core:scaleformNotification', src, header, text, typ, duration)
121+
end
122+
MSK.Scaleform = MSK.ScaleformAnnounce
123+
exports('ScaleformAnnounce', MSK.ScaleformAnnounce)
124+
125+
MSK.Subtitle = function(src, message, duration)
126+
if not src or src == 0 then return end
127+
TriggerClientEvent('msk_core:subtitle', src, message, duration)
128+
end
129+
exports('Subtitle', MSK.Subtitle)
130+
131+
MSK.Spinner = function(src, text, typ, duration)
132+
if not src or src == 0 then return end
133+
TriggerClientEvent('msk_core:spinner', src, text, typ, duration)
134+
end
135+
exports('Spinner', MSK.Spinner)
136+
116137
MSK.AddWebhook = function(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)
117138
local content = {}
118139

File renamed without changes.

0 commit comments

Comments
 (0)