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.Points.Add
  • MSK.Points.Remove
  • MSK.Points.GetAllPoints
  • MSK.Points.GetClosestPoint
  1. Scripts
  2. MSK Core
  3. Functions
  4. Client

Points

MSK.Points.Add

Adds a new Point.

Parameters data - table - Point data

Returns point - table - The added point

local point = MSK.Points.Add({
    coords = vector3(576.13, 2723.86, 42.06),
    distance = 5.0,
    onEnter = function(point)
        print('onEnter', point.id, point.coords, point.distance)
    end,
    onExit = function(point)
        print('onExit', point.id, point.coords, point.distance)
    end,
    onRemove = function(point)
        print('onRemove', ("Deleted Point with ID %s"):format(point.id))
    end
})

print(point.id, point.coords, point.distance)

-- To remove the Point:
point.Remove()

MSK.Points.Remove

Removes the given point

Parameters pointId - number - ID of the Point

Returns success - boolean

local success = MSK.Points.Remove(point.id)

if success then
    -- Point was found and deleted
else
    -- Point does not exist
end

-- You can also use the following, descripted above on MSK.Points.Add
point.delete()

MSK.Points.GetAllPoints

Get all Points.

Returns points - table - All Points

local points = MSK.Points.GetAllPoints()

for k, point in pairs(points) do
    print(point.id, point.coords, point.distance, point.inside)
    
    -- To remove the Point:
    point.Remove()
end

MSK.Points.GetClosestPoint

Get the Point the Player is at.

Returns point - table? - The Point the Player is at or nil if the Player is not inside of any point

local point = MSK.Points.GetClosestPoint()

if point then
    print(point.id, point.coords, point.distance)
    
    -- To remove the Point:
    point.Remove()
else
    -- Player is not inside of any point
end

Last updated 6 months ago