mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +01:00
refactor(player/client): create player instance at init
And minor fixes.
This commit is contained in:
@@ -3,7 +3,7 @@ CPlayer.__index = CPlayer
|
|||||||
|
|
||||||
function CPlayer:getCoords(update)
|
function CPlayer:getCoords(update)
|
||||||
if update or not self.coords then
|
if update or not self.coords then
|
||||||
self.coords = GetEntityCoords(self.ped)
|
self.coords = GetEntityCoords(cache.ped)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.coords
|
return self.coords
|
||||||
@@ -20,7 +20,8 @@ end
|
|||||||
function lib.getPlayer()
|
function lib.getPlayer()
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
id = cache.playerId,
|
id = cache.playerId,
|
||||||
ped = cache.ped,
|
|
||||||
serverId = cache.serverId,
|
serverId = cache.serverId,
|
||||||
}, CPlayer)
|
}, CPlayer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
player = lib.getPlayer()
|
||||||
|
|||||||
Reference in New Issue
Block a user