Coords Class - pitermcflebor/fivem-classes-lua GitHub Wiki
Client-side / Server-side
Init
local coords = Coords(
x, -- number
y, -- number
z, -- number
heading, -- number
)
Example
--
-- Creating some coords and how to use them
--
local spawnPoint = Coords(
25.3445, -- x
65.3213, -- y
79.0123, -- z
)
-- all parameters are optional, at least one needed
local waypoint = Coords(
26.4556, -- x
54.1234, -- y
)
local vehicleSpawn = Coords(
24.1234, -- x
123.213, -- y
60.0001, -- z
14.0000 -- heading
)
-- getting the coords
local x,y = vehicleSpawn.xy
local x = vehicleSpawn.x
local x,y,z = vehicleSpawn.xyz
local x,y,z,w = vehicleSpawn.xyzw
local heading = vehicleSpawn.heading
local x,y,z,w = table.unpack(vehicleSpawn)
local x,y,z = tonumber(vehicleSpawn)