2022-05-12 01:52:44 +10:00
|
|
|
local CPlayer = {}
|
|
|
|
|
CPlayer.__index = CPlayer
|
|
|
|
|
|
2022-05-12 07:41:12 +10:00
|
|
|
function CPlayer:getCoords(update)
|
|
|
|
|
if update or not self.coords then
|
2022-05-12 01:52:44 +10:00
|
|
|
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
|
|
|
|
|
|
2022-05-12 07:41:12 +10:00
|
|
|
function lib.getPlayer()
|
2022-05-12 01:52:44 +10:00
|
|
|
return setmetatable({
|
2022-05-12 07:41:12 +10:00
|
|
|
id = cache.playerId,
|
|
|
|
|
ped = cache.ped,
|
|
|
|
|
serverId = cache.serverId,
|
2022-05-12 01:52:44 +10:00
|
|
|
}, CPlayer)
|
|
|
|
|
end
|