diff --git a/imports/player/client.lua b/imports/player/client.lua index 5e710ca7b..a4b298f20 100644 --- a/imports/player/client.lua +++ b/imports/player/client.lua @@ -6,28 +6,30 @@ local CPlayer = {} function CPlayer:__index(index, ...) - local method = CPlayer[index] + local method = CPlayer[index] - if method then - return function(...) - return method(self, ...) - end - end + 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(cache.ped) - end + if update or not self.coords then + self.coords = GetEntityCoords(cache.ped) + end - return self.coords + return self.coords end function CPlayer:getDistance(coords) - return #(self:getCoords() - coords) + return #(self:getCoords() - coords) end ---@deprecated function lib.getPlayer() - return CPlayer + return CPlayer end + +return lib.getPlayer diff --git a/imports/player/server.lua b/imports/player/server.lua index 365a575ca..88cfe7258 100644 --- a/imports/player/server.lua +++ b/imports/player/server.lua @@ -6,33 +6,35 @@ local CPlayer = {} function CPlayer:__index(index, ...) - local method = CPlayer[index] + local method = CPlayer[index] - if method then - return function(...) - return method(self, ...) - end - end + 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 + if update or not self.coords then + self.coords = GetEntityCoords(self.getPed()) + end - return self.coords + return self.coords end function CPlayer:getDistance(coords) - return #(self:getCoords() - coords) + return #(self:getCoords() - coords) end function CPlayer:getPed() self.ped = GetPlayerPed(self.source) - return self.ped + return self.ped end ---@deprecated function lib.getPlayer() - return CPlayer + return CPlayer end + +return lib.getPlayer