mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
36 lines
569 B
Lua
36 lines
569 B
Lua
local CPlayer = {}
|
|
|
|
function CPlayer:__index(index, ...)
|
|
local method = CPlayer[index]
|
|
|
|
if method then
|
|
return function(...)
|
|
return method(self, ...)
|
|
end
|
|
end
|
|
end
|
|
|
|
function CPlayer:getCoords(update)
|
|
if update or not self.coords then
|
|
self.coords = GetEntityCoords(self.getPed())
|
|
end
|
|
|
|
return self.coords
|
|
end
|
|
|
|
function CPlayer:getDistance(coords)
|
|
return #(self:getCoords() - coords)
|
|
end
|
|
|
|
function CPlayer:getPed()
|
|
if update or not self.ped then
|
|
self.ped = GetPlayerPed(self.source)
|
|
end
|
|
|
|
return self.ped
|
|
end
|
|
|
|
function lib.getPlayer()
|
|
return CPlayer
|
|
end
|