MSK Scripts
TebexGithubDiscordMusiker15
  • MSK Scripts
    • Welcome
  • Common Issues
    • Keymaster
  • Miscellaneous
    • Change Notifications
  • Scripts
    • MSK Core
      • Installation
      • Functions
        • Client
          • Ace Permission
          • Commands
          • Coords
          • Player
          • Points
          • Request
          • Scaleform
          • UI
            • Input
            • Numpad
            • Progressbar
            • TextUI
          • Vehicle
        • Shared
          • String
          • Math
          • Table
          • Timeout
          • Vector
        • Server
          • Ace Permission
          • Ban System
          • Commands
          • Player
          • Scaleform
          • UI
            • Input
            • Numpad
            • Progressbar
            • TextUI
    • MSK Banking
      • Installation
        • Paycheck Transaction
      • Config
      • Exports
        • Client
        • Server
      • Events
        • Client
        • Server
      • Server Callbacks
    • MSK EngineToggle
      • Guides
      • Exports
        • Client
      • Event Handler
        • Client
        • Server
    • MSK Fuel
      • Config
      • Exports
        • Client
    • MSK Garage
      • Config
      • Exports
        • Client
    • MSK Handcuffs
      • Guides
        • General Edits for Jobs
        • Jaksam Job Creator
        • Multichar
        • ox_inventory
      • Config
      • Admin Commands
      • Exports
        • Client
        • Server
      • Events
        • Client
        • Server
      • Event Handlers
    • MSK Radio
      • Config
      • Exports
        • Client
        • Server
      • Events
        • Server
    • MSK Simcard
      • Installation
        • Config.Database
      • Config
    • MSK VehicleKeys
      • Guides
        • Installation
        • Integrations
      • Config
      • Admin Commands
      • Exports
        • Client
        • Server
    • MSK Whitelist
      • Config
      • Exports
        • Client
        • Server
    • MSK Weaponammo
Powered by GitBook
On this page
  • MSK.Math.Number
  • MSK.Math.Round
  • MSK.Math.Comma
  1. Scripts
  2. MSK Core
  3. Functions
  4. Shared

Math

MSK.Math.Number

Generates a random number.

Parameters length - number - The Length of the number

Returns number - number - The Number of the given length

local number = MSK.Math.Number(length)

-- Example
local number = MSK.Math.Number(3) -- Output: 123 or 475 or 285 or ...

-- As an Export:
local number = exports.msk_core:GetRandomNumber(length)

MSK.Math.Round

Rounds a number

Parameters number - number - The Number that should be rounded decimal - number - The Length of the decimal digits

Returns num - number - The rounded number

local num = MSK.Math.Round(number, decimal)

-- Example
local num = MSK.Math.Round(25.8385) -- Output: 26
local num = MSK.Math.Round(25.8385, 1) -- Output: 25.8
local num = MSK.Math.Round(25.8385, 2) -- Output: 25.84

-- As an Export:
local num = exports.msk_core:Round(length)

MSK.Math.Comma

Let your Number look like 1.000 f.e. for UIs, etc.

Parameters number - number - The Number that should be seperated tag - string - Optional

Returns text - string - The sperated text

local text = MSK.Math.Comma(number, tag) -- tag is optional

-- Example
local text = MSK.Math.Comma(1000) -- Output: 1.000
local text = MSK.Math.Comma(1000, ',') -- Output: 1,000

-- As an Export:
local text = exports.msk_core:Comma(number, tag)

Last updated 7 months ago