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
  1. Scripts
  2. MSK Core
  3. Functions
  4. Client

Commands

MSK.RegisterCommand

Parameters commandName - string or table - The Command callback - function - Function to execute restricted - boolean - Check Player Ace Permission properties - boolean or table - Data Properties

Description Parameter: properties

  • showSuggestion - boolean - Show chat suggestion - Optional, default: true

  • help - string - Chat suggestion

  • params - table - Paramter for the command

  • hotkey - table - Register a Hotkey (RegisterKeyMapping) - Optional, default: nil

You can only use the hotkey if no params was set!

Parameter: params

  • name - string - name of the argument

  • type - string - type of the argument - number, string, playerId, any, player - player is only returning the playerData for ESX or QBCore

  • help - string - chat suggestion of the argument

  • optional - boolean? - Is the Argment optional? Has to be the last argument! - Optional, default: false

Parameter: hotkey

  • key - string - Keybind

  • text - string - Description of the Keybind

MSK.RegisterCommand(commandName, callback, restricted, properties)

-- Example 1
MSK.RegisterCommand('testCommand', function(source, args, raw)    
    local data, reason = args.data, args.reason
    
    if not reason then 
        reason = 'Unknown reason'
    end
    
    print(('Data: %s; Reason: %s'):format(data, reason))
end, false, {
    showSuggestion = true,
    help = 'This is a Test Command',
    params = {
        {name = "data", type = 'any', help = "Anything"},
        {name = "reason", type = 'string', help = "Optional Text", optional = true},
    }
})

-- Example 2 -> With Hotkey (You can't use params)
MSK.RegisterCommand('testCommand', function(source, args, raw)    
    local data, reason = args.data, args.reason
    
    if not reason then 
        reason = 'Unknown reason'
    end
    
    print(('Data: %s; Reason: %s'):format(data, reason))
end, false, {
    showSuggestion = true,
    help = 'This is a Test Command'
    hotkey = {
        key = 'X',
        text = 'Test Command'
    }
})

-- As an Export:
exports.msk_core:RegisterCommand(commandName, callback, restricted, properties)

Last updated 6 months ago