Files
ox_lib/imports/player/client.lua

36 lines
638 B
Lua
Raw Normal View History

--[[
This module was experimental and won't be worked on or used further.
May be removed in the future.
]]
local CPlayer = {}
function CPlayer:__index(index, ...)
2022-09-18 22:41:25 +10:00
local method = CPlayer[index]
2022-09-18 22:41:25 +10:00
if method then
return function(...)
return method(self, ...)
end
end
end
function CPlayer:getCoords(update)
2022-09-18 22:41:25 +10:00
if update or not self.coords then
self.coords = GetEntityCoords(cache.ped)
end
2022-09-18 22:41:25 +10:00
return self.coords
end
function CPlayer:getDistance(coords)
2022-09-18 22:41:25 +10:00
return #(self:getCoords() - coords)
end
---@deprecated
function lib.getPlayer()
2022-09-18 22:41:25 +10:00
return CPlayer
end
2022-09-18 22:41:25 +10:00
return lib.getPlayer