mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
Was planning to support checking other user playerdata, but will require much more planning to implement properly.
27 lines
468 B
Lua
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
|