mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(imports/player): return function
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user