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.Player
  • Other Players
  • Event Handler
  • Set own values
  • MSK.GetClosestPlayer
  • MSK.GetClosestPlayers
  1. Scripts
  2. MSK Core
  3. Functions
  4. Client

Player

MSK.Player

Parameters clientId - number - Player Index - equal to PlayerId() serverId - number - Player Server Id ped - number - Player Index - equal to PlayerPedId() coords - vector3 - Player Coords - equal to GetEntityCoords(PlayerPedId()) heading - float - Player Heading - equal to GetEntityHeading(PlayerPedId()) vehicle - number - A vehicle handle seat - number - Seat, the player is in - equal to GetVehiclePedIsIn(PlayerPedId(), false) weapon - number - Hash of Players current weapon - equal to GetCurrentPedWeapon(PlayerPedId(), true)

local clientId = MSK.Player.clientId
local serverId = MSK.Player.serverId
local playerPed = MSK.Player.ped

local playerCoords = MSK.Player.coords
local playerHeading = MSK.Player.heading

local vehicle = MSK.Player.vehicle
local seat = MSK.Player.seat

local currentWeapon = MSK.Player.weapon

-- Notification
MSK.Player.Notify(header, message, type, duration)

Other Players

You can get information about other players on clientside

Parameters playerId - number - Players server id key - string - The key that you want the value from

Returns value - any - The new value of the key

Description See MSK.Player above for parameter "key"

local value = MSK.Player.Get(playerId, key)

-- Example: 
local coords = MSK.Player.Get(playerId, 'coords')

Event Handler

Returns key - string - The key that changed value - any - The new value of the changed key oldValue - any - The old value of the changed key

Description See MSK.Player above for parameter "key"

AddEventHandler('msk_core:onPlayer', function(key, value, oldValue)
    print(key, value, oldValue)
end)

Set own values

You can set you own values by using MSK.Player as a function. You can also set them as replicated.

Parameters key - string - The key that you want to set value - any - The value that you want to set for the key replicated - boolean - whether replicated or not

MSK.Player(key, value, replicated)

-- Example: You can only use the key in the script you've set it
MSK.Player('test', 'this is a test')

-- Example: You can use the key in all scripts
MSK.Player('test', 'this is a test', true)

-- Output
print(MSK.Player.test) -- 'this is a text'

MSK.GetClosestPlayer

Parameters coords - vector3 - Coords - Optional, default: playerCoords

Returns player - number - Player Index - equal to PlayerId() distance - float - The Distance to this Player

local player, distance = MSK.GetClosestPlayer(coords)

if player ~= -1 and distance <= 2.5 then
    -- Do something with this player
end

-- As an Export:
local player, distance = exports.msk_core:GetClosestPlayer(coords)

MSK.GetClosestPlayers

Parameters coords - vector3 - Coords maxDistance - float - Max distance to check for players - Max Distance is 200.0

local players = MSK.GetClosestPlayers(MSK.Player.coords, 25.0)

-- As an Export:
local player, distance = exports.msk_core:GetClosestPlayers(coords, maxDistance)

Last updated 5 months ago