Skip to content

Commit

Permalink
Update v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Musiker15 committed Aug 19, 2024
1 parent 73832b3 commit 3d2616d
Show file tree
Hide file tree
Showing 11 changed files with 318 additions and 135 deletions.
1 change: 0 additions & 1 deletion client/cl_anticombatlog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ local display = function(data)
end
end)
end

RegisterNetEvent('msk_core:anticombatlog', display)
5 changes: 5 additions & 0 deletions client/cl_input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ MSK.CloseInput = function()
end
exports('CloseInput', MSK.CloseInput)
exports('closeInput', MSK.CloseInput) -- Support for old Scripts
RegisterNetEvent('msk_core:closeInput', MSK.CloseInput)

MSK.Register('msk_core:input', function(source, header, placeholder, field)
return MSK.Input(header, placeholder, field)
end)

RegisterNUICallback('submitInput', function(data)
if data.input == '' then data.input = nil end
Expand Down
5 changes: 5 additions & 0 deletions client/cl_numpad.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ MSK.CloseNumpad = function()
})
end
exports('CloseNumpad', MSK.CloseNumpad)
RegisterNetEvent('msk_core:closeNumpad', MSK.CloseNumpad)

MSK.Register('msk_core:numpad', function(source, pin, show)
return MSK.Numpad(pin, show)
end)

RegisterNUICallback('submitNumpad', function(data)
callback(true)
Expand Down
4 changes: 4 additions & 0 deletions client/cl_showCoords.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ MSK.DoesShowCoords = function()
end
exports('DoesShowCoords', MSK.DoesShowCoords)

MSK.Register('msk_core:doesShowCoords', function(source)
return showCoords
end)

local DrawGenericText = function(text)
SetTextColour(186, 186, 186, 255)
SetTextFont(7)
Expand Down
103 changes: 84 additions & 19 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ MSK.Notification = function(title, message, typ, duration)
end
MSK.Notify = MSK.Notification
exports('Notification', MSK.Notification)
RegisterNetEvent("msk_core:notification", MSK.Notification)

MSK.HelpNotification = function(text)
BeginTextCommandDisplayHelp('STRING')
Expand All @@ -61,6 +62,7 @@ MSK.HelpNotification = function(text)
end
MSK.HelpNotify = MSK.HelpNotification
exports('HelpNotification', MSK.HelpNotification)
RegisterNetEvent("msk_core:helpNotification", MSK.HelpNotification)

MSK.AdvancedNotification = function(text, title, subtitle, icon, flash, icontype)
if not flash then flash = true end
Expand All @@ -74,6 +76,7 @@ MSK.AdvancedNotification = function(text, title, subtitle, icon, flash, icontype
end
MSK.AdvancedNotify = MSK.AdvancedNotification
exports('AdvancedNotification', MSK.AdvancedNotification)
RegisterNetEvent("msk_core:advancedNotification", MSK.AdvancedNotification)

MSK.ScaleformAnnounce = function(header, text, typ, duration)
local scaleform = ''
Expand Down Expand Up @@ -117,13 +120,15 @@ MSK.ScaleformAnnounce = function(header, text, typ, duration)
end
MSK.Scaleform = MSK.ScaleformAnnounce
exports('ScaleformAnnounce', MSK.ScaleformAnnounce)
RegisterNetEvent("msk_core:scaleformNotification", MSK.ScaleformAnnounce)

MSK.Subtitle = function(text, duration)
BeginTextCommandPrint('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandPrint(duration or 8000, true)
end
exports('Subtitle', MSK.Subtitle)
RegisterNetEvent("msk_core:subtitle", MSK.Subtitle)

MSK.Spinner = function(text, typ, duration)
BeginTextCommandBusyspinnerOn('STRING')
Expand All @@ -135,6 +140,7 @@ MSK.Spinner = function(text, typ, duration)
end)
end
exports('Spinner', MSK.Spinner)
RegisterNetEvent("msk_core:spinner", MSK.Spinner)

MSK.Draw3DText = function(coords, text, size, font)
local coords = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
Expand All @@ -160,10 +166,33 @@ MSK.Draw3DText = function(coords, text, size, font)
ClearDrawOrigin()
end
exports('Draw3DText', MSK.Draw3DText)
RegisterNetEvent("msk_core:draw3DText", MSK.Draw3DText)

MSK.DrawGenericText = function(text, outline, font, size, color, position)
if not font then font = 0 end
if not size then size = 0.34 end
if not color then color = {r = 255, g = 255, b = 255, a = 255} end
if not position then position = {height = 0.90, width = 0.50} end

SetTextColour(color.r, color.g, color.b, color.a)
SetTextFont(font)
SetTextScale(size, size)
SetTextWrap(0.0, 1.0)
SetTextCentre(true)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 205)
if outline then SetTextOutline() end
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(position.width, position.height)
end
exports('DrawGenericText', MSK.DrawGenericText)
RegisterNetEvent("msk_core:drawGenericText", MSK.DrawGenericText)

MSK.HasItem = function(item)
if Config.Framework == 'standalone' then
return logging('error', ('Function %s can not used without Framework!'):format('MSK.HasItem'))
logging('error', ('Function %s can not used without Framework!'):format('MSK.HasItem'))
return
end

local hasItem = MSK.Trigger('msk_core:hasItem', item)
Expand Down Expand Up @@ -197,6 +226,38 @@ MSK.IsVehicleEmpty = function(vehicle)
end
exports('IsVehicleEmpty', MSK.IsVehicleEmpty)

MSK.IsSpawnPointClear = function(coords, maxDistance)
local nearbyVehicles = {}

if coords then
coords = vector3(coords.x, coords.y, coords.z)
else
coords = GetEntityCoords(PlayerPedId())
end

for k, vehicle in pairs(GetGamePool('CVehicle')) do
local distance = #(coords - GetEntityCoords(vehicle))

if distance <= maxDistance then
nearbyVehicles[#nearbyVehicles + 1] = vehicle
end
end

return #nearbyVehicles == 0
end
exports('IsSpawnPointClear', MSK.IsSpawnPointClear)

MSK.GetPedVehicleSeat = function(ped, vehicle)
if not ped then ped = PlayerPedId() end
if not vehicle then GetVehiclePedIsIn(ped, false) end

for i = -1, 16 do
if (GetPedInVehicleSeat(vehicle, i) == ped) then return i end
end
return -1
end
exports('GetPedVehicleSeat', MSK.GetPedVehicleSeat)

MSK.GetPedMugshot = function(ped, transparent)
if not DoesEntityExist(ped) then return end
local mugshot = transparent and RegisterPedheadshotTransparent(ped) or RegisterPedheadshot(ped)
Expand All @@ -220,30 +281,34 @@ end
MSK.ProgressStart = MSK.Progressbar -- Support for old Scripts
exports('Progressbar', MSK.Progressbar)
exports('ProgressStart', MSK.Progressbar) -- Support for old Scripts
RegisterNetEvent("msk_core:progressbar", MSK.Progressbar)

MSK.ProgressStop = function()
SendNUIMessage({
action = 'progressBarStop',
})
end
exports('ProgressStop', MSK.ProgressStop)
RegisterNetEvent("msk_core:progressbarStop", MSK.ProgressStop)

RegisterNetEvent("msk_core:notification", function(title, message, typ, time)
MSK.Notification(title, message, typ, time)
end)

RegisterNetEvent('msk_core:advancedNotification', function(text, title, subtitle, icon, flash, icontype)
MSK.AdvancedNotification(text, title, subtitle, icon, flash, icontype)
end)

RegisterNetEvent("msk_core:scaleformNotification", function(title, message, typ, duration)
MSK.ScaleformAnnounce(title, message, typ, duration)
end)

RegisterNetEvent("msk_core:subtitle", function(message, duration)
MSK.Subtitle(message, duration)
end)
MSK.LoadAnimDict = function(dict)
if not HasAnimDictLoaded(dict) then
RequestAnimDict(dict)

RegisterNetEvent("msk_core:spinner", function(text, typ, duration)
MSK.Spinner(text, typ, duration)
end)
while not HasAnimDictLoaded(dict) do
Wait(1)
end
end
end
exports('LoadAnimDict', MSK.LoadAnimDict)

MSK.LoadModel = function(modelHash)
if not HasModelLoaded(modelHash) then
RequestModel(modelHash)

while not HasModelLoaded(modelHash) do
Wait(1)
end
end
end
exports('LoadModel', MSK.LoadModel)
1 change: 0 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Config.VersionChecker = true
-- Only Required for MSK.RegisterCommand and MSK.HasItem // View Docu for more Information about that!
Config.Framework = 'esx' -- Set to 'standalone', 'esx' or 'qbcore'
----------------------------------------------------------------
-- /coords
Config.showCoords = {
enable = true,
command = 'coords',
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ games { 'gta5' }
author 'Musiker15 - MSK Scripts'
name 'msk_core'
description 'Core functions for MSK Scripts'
version '2.2.0'
version '2.3.0'

lua54 'yes'

Expand Down
Loading

0 comments on commit 3d2616d

Please sign in to comment.