Player

MSK.Player

local clientId = MSK.Player.clientId --> PlayerId()
local serverId = MSK.Player.serverId
local playerPed = MSK.Player.playerPed

local vehicle = MSK.Player.vehicle --> DoesEntityExist(GetVehiclePedIsIn(playerPed, false))
local seat = MSK.Player.seat --> GetPedInVehicleSeat(vehicle)

local currentWeapon = MSK.Player.weapon --> GetCurrentPedWeapon(playerPed, true)

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 key can be:

  • clientId - equal to PlayerId()

  • serverId - equal to GetPlayerServerId(PlayerId())

  • playerPed - equal to PlayerPedId()

  • vehicle - equal to GetVehiclePedIsIn(PlayerPedId(), false)

  • seat - The current seat the Player is in

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

MSK.GetClosestPlayer

local player, distance = MSK.GetClosestPlayer()

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

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

MSK.GetClosestPlayers

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

local players = MSK.GetClosestPlayers(GetEntityCoords(PlayerPedId(), 25.0)

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

Last updated