Files
ox_lib/imports/player/client.lua
Linden 4575b5e02a refactor(player): simplify
Was planning to support checking other user playerdata, but will
require much more planning to implement properly.
2022-05-12 07:41:12 +10:00

27 lines
468 B
Lua

local CPlayer = {}
CPlayer.__index = CPlayer
function CPlayer:getCoords(update)
if update or not self.coords then
self.coords = GetEntityCoords(self.ped)
end
return self.coords
end
function CPlayer:getDistance(coords)
return #(self:getCoords() - coords)
end
function lib.addPlayerMethod(name, fn)
CPlayer[name] = fn
end
function lib.getPlayer()
return setmetatable({
id = cache.playerId,
ped = cache.ped,
serverId = cache.serverId,
}, CPlayer)
end