Skip to content

Commit 9a3929f

Browse files
committed
Update v1.9.1
* Added exports for all functions * Added MSK.GetPedMugshot
1 parent 8c6a4c9 commit 9a3929f

File tree

8 files changed

+47
-28
lines changed

8 files changed

+47
-28
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9
1+
1.9.1

client/client.lua

+14-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ elseif Config.Framework:match('qbcore') then
88
QBCore = exports['qb-core']:GetCoreObject()
99
end
1010

11-
MSK.RegisterCallback = function(name, cb)
11+
MSK.RegisterClientCallback = function(name, cb)
1212
Callbacks[name] = cb
1313
end
14+
MSK.RegisterCallback = MSK.RegisterClientCallback
15+
exports('RegisterClientCallback', RegisterClientCallback)
1416

15-
MSK.TriggerCallback = function(name, ...)
17+
MSK.TriggerServerCallback = function(name, ...)
1618
local requestId = GenerateRequestKey(callbackRequest)
1719
local response
1820

@@ -26,6 +28,8 @@ MSK.TriggerCallback = function(name, ...)
2628

2729
return table.unpack(response)
2830
end
31+
MSK.TriggerCallback = MSK.TriggerServerCallback
32+
exports('TriggerServerCallback', TriggerServerCallback)
2933

3034
MSK.Notification = function(title, message, info, time)
3135
if Config.Notification == 'native' then
@@ -44,12 +48,14 @@ MSK.Notification = function(title, message, info, time)
4448
exports['okokNotify']:Alert(title, message, time or 5000, info or 'info')
4549
end
4650
end
51+
exports('Notification', Notification)
4752

4853
MSK.HelpNotification = function(text)
4954
SetTextComponentFormat('STRING')
5055
AddTextComponentString(text)
5156
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
5257
end
58+
exports('HelpNotification', HelpNotification)
5359

5460
MSK.AdvancedNotification = function(text, title, subtitle, icon, flash, icontype)
5561
if not flash then flash = true end
@@ -61,6 +67,7 @@ MSK.AdvancedNotification = function(text, title, subtitle, icon, flash, icontype
6167
SetNotificationMessage(icon, icon, flash, icontype, title, subtitle)
6268
DrawNotification(false, true)
6369
end
70+
exports('AdvancedNotification', AdvancedNotification)
6471

6572
MSK.Draw3DText = function(coords, text, size, font)
6673
local coords = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
@@ -85,6 +92,7 @@ MSK.Draw3DText = function(coords, text, size, font)
8592
EndTextCommandDisplayText(0.0, 0.0)
8693
ClearDrawOrigin()
8794
end
95+
exports('Draw3DText', Draw3DText)
8896

8997
MSK.HasItem = function(item)
9098
if not Config.Framework:match('esx') or Config.Framework:match('qbcore') then
@@ -95,6 +103,7 @@ MSK.HasItem = function(item)
95103
local hasItem = MSK.TriggerCallback('msk_core:hasItem', item)
96104
return hasItem
97105
end
106+
exports('HasItem', HasItem)
98107

99108
MSK.GetVehicleInDirection = function()
100109
local playerPed = PlayerPedId()
@@ -111,6 +120,7 @@ MSK.GetVehicleInDirection = function()
111120

112121
return nil
113122
end
123+
exports('GetVehicleInDirection', GetVehicleInDirection)
114124

115125
MSK.IsVehicleEmpty = function(vehicle)
116126
if not vehicle or (vehicle and not DoesEntityExist(vehicle)) then return end
@@ -119,6 +129,7 @@ MSK.IsVehicleEmpty = function(vehicle)
119129

120130
return passengers == 0 and driverSeatFree
121131
end
132+
exports('IsVehicleEmpty', IsVehicleEmpty)
122133

123134
MSK.GetPedMugshot = function(ped, transparent)
124135
if not DoesEntityExist(ped) then return end
@@ -130,6 +141,7 @@ MSK.GetPedMugshot = function(ped, transparent)
130141

131142
return mugshot, GetPedheadshotTxdString(mugshot)
132143
end
144+
exports('GetPedMugshot', GetPedMugshot)
133145

134146
GenerateRequestKey = function(tbl)
135147
local id = string.upper(MSK.GetRandomString(3)) .. math.random(000, 999) .. string.upper(MSK.GetRandomString(2)) .. math.random(00, 99)

client/client_input.lua

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ closeInput = function()
2121
SetNuiFocus(false, false)
2222
isOpen = false
2323
end
24+
MSK.CloseInput = closeInput
2425
exports('closeInput', closeInput)
2526

2627
RegisterNUICallback('closeInput', function(data)

client/client_progress.lua

-18
This file was deleted.

common/common.lua

+16-3
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ MSK.GetRandomString = function(length)
1313
end
1414
end
1515
MSK.GetRandomLetter = MSK.GetRandomString
16+
exports('GetRandomString', GetRandomString)
1617

1718
MSK.Round = function(num, decimal)
1819
return tonumber(string.format("%." .. (decimal or 0) .. "f", num))
1920
end
21+
exports('Round', Round)
2022

2123
MSK.Trim = function(str, bool)
2224
if bool then return (str:gsub("^%s*(.-)%s*$", "%1")) end
2325
return (str:gsub("%s+", ""))
2426
end
27+
exports('Trim', Trim)
2528

2629
MSK.Split = function(str, delimiter)
2730
local result = {}
@@ -32,8 +35,9 @@ MSK.Split = function(str, delimiter)
3235

3336
return result
3437
end
38+
exports('Split', Split)
3539

36-
MSK.Table_Contains = function(table, value)
40+
MSK.TableContains = function(table, value)
3741
if type(value) == 'table' then
3842
for k, v in pairs(table) do
3943
for k2, v2 in pairs(value) do
@@ -51,6 +55,8 @@ MSK.Table_Contains = function(table, value)
5155
end
5256
return false
5357
end
58+
MSK.Table_Contains = MSK.TableContains
59+
exports('TableContains', TableContains)
5460

5561
MSK.Comma = function(int, tag)
5662
if not tag then tag = '.' end
@@ -66,9 +72,10 @@ MSK.Comma = function(int, tag)
6672

6773
return newInt
6874
end
75+
exports('Comma', Comma)
6976

7077
local Timeout = 0
71-
MSK.AddTimeout = function(ms, cb)
78+
MSK.SetTimeout = function(ms, cb)
7279
local requestId = Timeout + 1
7380

7481
SetTimeout(ms, function()
@@ -79,11 +86,14 @@ MSK.AddTimeout = function(ms, cb)
7986
Timeout = requestId
8087
return requestId
8188
end
89+
MSK.AddTimeout = MSK.SetTimeout
90+
exports('SetTimeout', SetTimeout)
8291

8392
MSK.DelTimeout = function(requestId)
8493
if not requestId then return end
8594
Timeouts[requestId] = true
8695
end
96+
exports('DelTimeout', DelTimeout)
8797

8898
MSK.DumpTable = function(tbl, n)
8999
if not n then n = 0 end
@@ -100,8 +110,9 @@ MSK.DumpTable = function(tbl, n)
100110

101111
return s .. '}'
102112
end
113+
exports('DumpTable', DumpTable)
103114

104-
MSK.logging = function(code, ...)
115+
MSK.Logging = function(code, ...)
105116
local script = "[^2"..GetInvokingResource().."^0]"
106117

107118
if not MSK.Table_Contains({'error', 'debug', 'info'}, code) then
@@ -127,6 +138,8 @@ MSK.logging = function(code, ...)
127138
end
128139
end
129140
end
141+
MSK.logging = MSK.Logging
142+
exports('Logging', Logging)
130143

131144
exports('getConfig', function()
132145
return Config

fxmanifest.lua

+1-1
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 '1.9'
7+
version '1.9.1'
88

99
lua54 'yes'
1010

server/server.lua

+11-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ elseif Config.Framework:match('qbcore') then
1616
QBCore = exports['qb-core']:GetCoreObject()
1717
end
1818

19-
MSK.RegisterCallback = function(name, cb)
19+
MSK.RegisterServerCallback = function(name, cb)
2020
Callbacks[name] = cb
2121
end
22+
MSK.RegisterCallback = MSK.RegisterServerCallback
23+
exports('RegisterServerCallback', RegisterServerCallback)
2224

23-
MSK.TriggerCallback = function(name, playerId, ...)
25+
MSK.TriggerClientCallback = function(name, playerId, ...)
2426
local requestId = GenerateRequestKey(callbackRequest)
2527
local response
2628

@@ -34,6 +36,8 @@ MSK.TriggerCallback = function(name, playerId, ...)
3436

3537
return table.unpack(response)
3638
end
39+
MSK.TriggerCallback = MSK.TriggerClientCallback
40+
exports('TriggerClientCallback', TriggerClientCallback)
3741

3842
MSK.RegisterCommand = function(name, group, cb, console, framework, suggestion)
3943
if type(name) == 'table' then
@@ -120,16 +124,19 @@ MSK.RegisterCommand = function(name, group, cb, console, framework, suggestion)
120124
ExecuteCommand(('add_ace group.%s command.%s allow'):format(group, name))
121125
end
122126
end
127+
exports('RegisterCommand', RegisterCommand)
123128

124129
MSK.Notification = function(src, title, message, info, time)
125130
if not src or src == 0 then return end
126131
TriggerClientEvent('msk_core:notification', src, title, message, info, time)
127132
end
133+
exports('Notification', Notification)
128134

129135
MSK.AdvancedNotification = function(src, text, title, subtitle, icon, flash, icontype)
130136
if not src or src == 0 then return end
131137
TriggerClientEvent('msk_core:advancedNotification', src, text, title, subtitle, icon, flash, icontype)
132138
end
139+
exports('AdvancedNotification', AdvancedNotification)
133140

134141
MSK.AddWebhook = function(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)
135142
local content = {}
@@ -173,6 +180,7 @@ MSK.AddWebhook = function(webhook, botColor, botName, botAvatar, title, descript
173180
['Content-Type'] = 'application/json'
174181
})
175182
end
183+
exports('AddWebhook', AddWebhook)
176184

177185
MSK.HasItem = function(xPlayer, item)
178186
if not xPlayer then logging('error', 'Player on Function MSK.HasItem does not exist!') return end
@@ -192,6 +200,7 @@ MSK.HasItem = function(xPlayer, item)
192200

193201
return hasItem
194202
end
203+
exports('HasItem', HasItem)
195204

196205
MSK.RegisterCallback('msk_core:hasItem', function(source, cb, item)
197206
local src = source

server/server_player.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ MSK.GetPlayer = function(player)
3434

3535
return Player
3636
end
37+
exports('GetPlayer', GetPlayer)
3738

3839
MSK.GetPlayers = function(key, val)
3940
local Players
@@ -67,4 +68,5 @@ MSK.GetPlayers = function(key, val)
6768
end
6869

6970
return Players
70-
end
71+
end
72+
exports('GetPlayers', GetPlayers)

0 commit comments

Comments
 (0)