fix(imports/player): return function

This commit is contained in:
Linden
2022-09-18 22:41:25 +10:00
parent 36703a1f47
commit f1671f14bc
2 changed files with 29 additions and 25 deletions

View File

@@ -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

View File

@@ -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