Client

Functions - Clientside

MSK.Register

Register Client Callback (MSK.Trigger)

MSK.Register("Callback_Name", function(playerId, arg1, arg2, ...)
    return ...
end)

-- Example
MSK.Register("msk_testing:clientCallback", function(source, a, b, c)
    print(source, a, b, c)
    return a, b, c
end)

MSK.Trigger

Trigger Server Callback (MSK.Register)

local data = MSK.Trigger("Callback_Name", ...)

-- Example
local a, b, c = MSK.Trigger("msk_testing:serverCallback:1", '123', '456', '789')
print(a, b, c)

MSK.TriggerCallback

Trigger Server Callback (MSK.Register)

local data = MSK.TriggerCallback("Callback_Name", ...)

-- Example
local a, b, c = MSK.TriggerCallback("msk_testing:serverCallback:2", '123', '456', '789')
print(a, b, c)

MSK.Notification

Show a Notification. You can use farbcodes like: ~g~

Preview

Parameters title - string - Title message - string - Message Text info - string - Optional - Default: general time - number <miliseconds> - Optional - Default: 5000

MSK.Notification(title, message, info, duration)

-- Example
MSK.Notification('Title', 'This is a Notification', 'general', 5000)

MSK.HelpNotification

Show a Help Notification

Parameters text - string - Text

MSK.HelpNotification(text)

-- Example
MSK.HelpNotification('Press ~g~E~s~ to open')

MSK.AdvancedNotification

Show a Picture Notification

Parameters text - string - Text title - string - Title subtitle - string - Subtitle icon - string - Optional - Default: CHAR_HUMANDEFAULT flash - boolean - Optional - Default: true icontype - number - Optional - Default: 1

-- flash and iconType are optional
MSK.AdvancedNotification(text, title, subtitle, icon, flash, icontype)

-- Example
MSK.AdvancedNotification('This is a Notification', 'Title', 'Subtitle', 'CHAR_HUMANDEFAULT', true, 1)

MSK.Draw3DText

Draw a 3D Text (size and font is optional)

Parameters location - table <x, y, z> / vector3 - Location text - string - Text size - number - Optional - Default: 1 font - number - Optional - Default: 0

MSK.Draw3DText(location, text, size, font)

-- Example
local location = GetEntityCoords(PlayerPedId())
MSK.Draw3DText(location, 'This is the Label Text', 1, 0)
MSK.Draw3DText(location, 'This is the Label Text')

MSK.DrawGenericText

Draw Generic Text

Parameters text - string - Text outline - boolean - Text Outline font - number - Text Font - Optional, default: 0 size - float - Text Size - Optional, default: 0.34 color - table <r, g, b, a> - Text Color - Optional, default: white position - string - Text Position on the Screen - Optional, default: bottom center

MSK.DrawGenericText(text, outline, font, size, color, position)

-- Example
local color = {r = 255, g = 255, b = 255, a = 255}
local position = {width = 0.50, height = 0.90}
MSK.DrawGenericText('Test', true, 0, 0.34, color, position)

MSK.HasItem

Checks if you have the item in your inventory (only for ESX or QBCore)

Parameters itemName - string - The item name

Returns hasItem - table <name, label, count> - If the player has the item

local hasItem = MSK.HasItem(itemName)

-- Example
local hasItem = MSK.HasItem('bread') -- returns: name, label, count
print(hasItem.name, hasItem.label, hasItem.count)

MSK.Input.Open

Opens an Input Window.

Preview

Parameters header - string - Header Text placeholder - string - Placeholder text field - boolean - Small Input or Big Input

Returns input - string/number - Input

Asynchronous

-- Small Input Window
MSK.Input.Open('This is a Header', 'This is a Placeholder', function(input)
    if not input then return end

    print(input)
end)

-- Big Input Window
MSK.Input.Open('This is a Header', 'This is a Placeholder', true, function(input)
    if not input then return end

    print(input)
end)

Synchronous

-- Small Input Window
local input = MSK.Input.Open('This is a Header', 'This is a Placeholder')
print(input)

-- Big Input Window
local input = MSK.Input.Open('This is a Header', 'This is a Placeholder', true)
print(input)

MSK.Input.Close

Closes the current Input Window.

MSK.Input.Close()

MSK.Input.Active

Checks if the Input Window is active

Returns isActive - boolean - whether the Input Window is active

local isActive = MSK.Input.Active()

MSK.GetPedMugshot

Get the PedMugshot from a specific Ped.

Parameters playerPed - number - The Player Ped transparent - boolean - Transparent Background

local mugshot, mugshotStr = MSK.GetPedMugshot(playerPed, transparent)
UnregisterPedheadshot(mugshot) -- You have to call this to delete the unregister the mugshot after use

-- Example
local mugshot, mugshotStr = MSK.GetPedMugshot(PlayerPedId(), true)
MSK.AdvancedNotification('Message', 'Title', 'Subtitle', mugshotStr)
UnregisterPedheadshot(mugshot)

MSK.GetVehicleInDirection

Get the Vehicle in front of the player

Returns vehicle - int - A vehicle handle coords - vector3 - The vehicle coords distance - float - The distance between the vehicle and the player

local vehicle, coords, distance = MSK.GetVehicleInDirection()

MSK.IsVehicleEmpty

Get whether the vehicle is empty or not

Parameters vehicle - int - A vehicle handle

Returns isVehicleEmpty - boolean - whether the vehicle is empty or not

local vehicle, coords, distance = MSK.GetVehicleInDirection()
local isVehicleEmpty = MSK.IsVehicleEmpty(vehicle)
print(isVehicleEmpty)

MSK.Progress.Start

Shows a progressbar. color is optional and can be set in config.lua.

Parameters time - number <miliseconds> - The time in miliseconds text - boolean - Text color - string - Color as hex

MSK.Progress.Start(time, text, color)

-- Example
MSK.Progress.Start(5000, 'Progressing...') -- default color set in config.lua
MSK.Progress.Start(5000, 'Progressing...', "#5eb131") -- custom color

MSK.Progress.Stop

Stops the current ProgressBar.

MSK.Progress.Stop()

MSK.Progress.Active

Checks if the Progressbar is active

Returns isActive - boolean - whether the Progressbar is active

local isActive = MSK.Progress.Active()

MSK.Numpad.Open

Opens an Numpad Window.

Preview

Parameters pin - string - The correct Pin showPin - boolean - Show Numbers or ****

Returns isCorrect - boolean - If the inserted pin is correct or not

Asynchronous

MSK.Numpad.Open('1234', true, function(isCorrect)
    logging('debug', 'Correct:', isCorrect)
end)

Synchronous

local isCorrect = MSK.Numpad.Open('1234', true)

MSK.Numpad.Close

Closes the current Numpad Window.

MSK.Numpad.Close()

MSK.Numpad.Active

Checks if the Numpad Window is active

Returns isActive - boolean - whether the Numpad Window is active

local isActive = MSK.Numpad.Active()

MSK.Subtitle

Shows a text at the center-bottom. You can use farbcodes like: ~g~

Preview

Parameters text - string - The message text duration - number <miliseconds> - Duration in miliseconds - Optional: default: 8000

MSK.Subtitle(text, duration)

-- Example
MSK.Subtitle('This is a Subtitle by ~g~MSK Scripts~s~', 8000)

MSK.Spinner

Shows a Loading Spinner at the right-bottom

Preview

Type 4

Type 5

Parameters text - string - The message text typ - number - The Spinner Type - Optional: default: 4 duration - number <miliseconds> - Duration in miliseconds - Optional: default: 5000

MSK.Spinner(text, typ, duration)

-- Example: Orange Spinner
MSK.Spinner('This is a Spinner by MSK Scripts', 4, 8000)
-- Example: White Spinner
MSK.Spinner('This is a Spinner by MSK Scripts', 5, 8000)

MSK.ScaleformAnnounce

Shows a Scaleform Announement.

Preview

Parameters header - string - The Header text text - string - The Message text typ - number - The Scaleform Type duration - number <miliseconds> - Duration in miliseconds - Optional: default: 8000

MSK.ScaleformAnnounce(header, text, typ, duration)

-- Example: typ 1
MSK.ScaleformAnnounce('~y~Announement~s~', 'This is a Announement by ~g~MSK Scripts~s~', 1, 8000)
-- Example: typ 2
MSK.ScaleformAnnounce('~y~Announement~s~', 'This is a Announement by ~g~MSK Scripts~s~', 2, 8000)

Last updated