[STANDALONE] MSK Core

About

Offers performance-based functions and makes the one or other things much more pleasant.


Documentation

Link


Export

  • You have to add this at the top of your clientside and serverside file
MSK = exports.msk_core:getCoreObject()

Resmon


Clientside Features


  • Trigger Synchron Server Callback
MSK.TriggerCallback
 '...' is as many values as you want to send to the server
local data, data2 = MSK.TriggerCallback("Callback_Name", value1, value2, ...)`
Example
local value2 = 'Test2'

local test1, test2 = MSK.TriggerCallback("Callback_Name", value1, value2)
print(test1, test2) -- Output: Test, Test2`

  • Add and Delete a timeout
MSK.AddTimeout
Add a timeout
timeout = MSK.AddTimeout(miliseconds, function()
    waits miliseconds time // asyncron

end)


  • MSK.DelTimeout
MSK.DelTimeout
 Delete the timeout
MSK.DelTimeout(timeout)

  • Draw a 3D Text (size and font is optional)
MSK.Draw3DText
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')

Serverside Features

  • Register Synchron Server Callback
MSK.RegisterCallback
MSK.RegisterCallback("Callback_Name", function(source, cb, value1, value2, ...)
    cb(value1, value2)
end)

  • Register a Command with a few functions
MSK.RegisterCommand
MSK.RegisterCommand(name, groups, cb, console, suggestion)
Example
MSK.RegisterCommand('testCommand', 'admin', cb, console, suggestion)
MSK.RegisterCommand({'command1, command2', ...}, {'group1', 'group2', ...}, cb, console, suggestion)
Standalone
MSK.RegisterCommand('testCommand', 'admin', function(source, args, rawCommand)
    if not args.playerId then args.playerId = source end
    MSK.Notification(args.playerId, 'Command send successfully')
end, true, {help = 'Just a Test Command', arguments = {
    {name = 'playerId', help = 'PlayerID', action = 'playerId', val = true},
}})
ESX or QBCore
MSK.RegisterCommand('testCommand', 'admin', function(xPlayer, args, rawCommand)
    if not args.playerId then args.playerId = xPlayer end
    MSK.Notification(args.playerId.source, 'Command send successfully')
end, false, {help = 'Just a Test Command', arguments = {
    {name = 'playerId', help = 'PlayerID', action = 'playerId', val = false},
}})
Argument Action
action = false -- string or whatever
action = 'number' -- only number is allowed
action = 'playerId' -- only a playerId as a number is allowed

val = true -- arguments has to be used
val = false -- argument is optional but you have to set it as last argument



Common

  • Check if a value contains in a table
MSK.Table_Contains
table = {'value_1', 'value_2'}

-- Check if one of the values contains in the table
local contains = MSK.Table_Contains(table, {'value_1', 'value_5'})

-- Check if the value contains in the table
local contains = MSK.Table_Contains(table, 'value_1')

if contains then
    -- true
else
    -- false
end

MSK.logging

MSK.logging(script, code, ...)


Example:
MSK.logging('[msk_testing]', 'debug', 'value1', 'value2', ...)
MSK.logging('[msk_testing]', 'error', 'value1', 'value2', ...)


MSK.GetRandomLetter
MSK.GetRandomLetter(length)

Example:
MSK.GetRandomLetter(3) -- abc
string.upper(MSK.GetRandomLetter(3)) -- ABC
Code is accessible Yes
Subscription-based No
Lines (approximately) 500
Requirements oxmysql
Support Yes

Our other Scripts

Paid

Free

4 Likes

nice.

2 Likes

Did you just changed the names of the functions or what? I don’t see any new stuff here, what I see it’s literally copy and paste the functions of esx/qbcore. I think that this is just a stupid thing

3 Likes