From 1ac844f20ae8f647f549f6ed4a565aab63700996 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Mon, 11 Apr 2022 04:59:01 +0000 Subject: [PATCH] tweak(init): store serverId --- fxmanifest.lua | 1 - init.lua | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 5bfc0d7..5a27571 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -60,4 +60,3 @@ server_scripts { 'resource/**/server/*.lua' } -provide 'pe-lualib' diff --git a/init.lua b/init.lua index b167034..6eaa5bb 100644 --- a/init.lua +++ b/init.lua @@ -152,7 +152,7 @@ local ox = GetResourceState('ox_core') ~= 'missing' and setmetatable({}, { groups = GetResourceState('ox_groups') ~= 'missing', } -local cache_mt = { +local cache = setmetatable({}, { __index = function(self, key) return rawset(self, key, exports[lualib]['cache'](nil, key) or false)[key] end, @@ -164,6 +164,7 @@ local cache_mt = { else self.playerId = PlayerId() + self.serverId = GetPlayerServerId(self.playerId) end if ox.groups then @@ -175,9 +176,7 @@ local cache_mt = { }) end end -} - -local cache = setmetatable({}, cache_mt) +}) Citizen.CreateThreadNow(function() while true do