mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-08 06:02:57 +08:00
mapmanager: only load maps matching current game
This commit is contained in:
parent
e7f7519e45
commit
ea6f1d8133
@ -13,6 +13,20 @@ local function refreshResources()
|
||||
local type = GetResourceMetadata(resource, 'resource_type', 0)
|
||||
local params = json.decode(GetResourceMetadata(resource, 'resource_type_extra', 0))
|
||||
|
||||
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
|
||||
@ -21,6 +35,7 @@ local function refreshResources()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
AddEventHandler('onResourceListRefresh', function()
|
||||
refreshResources()
|
||||
|
Loading…
Reference in New Issue
Block a user