From ea6f1d813365653907c4ce3e7864134c692a8d97 Mon Sep 17 00:00:00 2001 From: astatine Date: Tue, 10 Dec 2019 11:00:37 +0100 Subject: [PATCH] mapmanager: only load maps matching current game --- .../mapmanager/mapmanager_server.lua | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/[managers]/mapmanager/mapmanager_server.lua b/resources/[managers]/mapmanager/mapmanager_server.lua index cb8cd21..3f2cf70 100644 --- a/resources/[managers]/mapmanager/mapmanager_server.lua +++ b/resources/[managers]/mapmanager/mapmanager_server.lua @@ -12,12 +12,27 @@ local function refreshResources() if GetNumResourceMetadata(resource, 'resource_type') > 0 then local type = GetResourceMetadata(resource, 'resource_type', 0) local params = json.decode(GetResourceMetadata(resource, 'resource_type_extra', 0)) - - if type == 'map' then - maps[resource] = params - elseif type == 'gametype' then - gametypes[resource] = params + + local valid = false + + local games = GetNumResourceMetadata(resource, 'game') + if games > 0 then + for j = 0, games - 1 do + local game = GetResourceMetadata(resource, 'game', j) + + if game == GetConvar('gamename', 'gta5') or game == 'common' then + valid = true + end + end end + + if valid then + if type == 'map' then + maps[resource] = params + elseif type == 'gametype' then + gametypes[resource] = params + end + end end end end