Mapmanager is an included citizenfx resource that handles map changes, game types, and compatibility between gametypes and maps.
Exports are called using exports["mapmanger"]:exportname(args)
Returns the current game type.
Arguments : None
-- mapmanager_server.lua
function getCurrentGameType()
return currentGameType
end
Returns the current map.
Arguments : None
-- mapmanager_server.lua
function getCurrentMap()
return currentMap
end
Changes the current game type.
Arguments : gameType
-- mapmanager_server.lua
function changeGameType(gameType)
if currentMap and not doesMapSupportGameType(gameType, currentMap) then
StopResource(currentMap)
end
if currentGameType then
StopResource(currentGameType)
end
StartResource(gameType)
end
Changes the current map
Arguments : map
-- mapmanager_server.lua
function changeMap(map)
if currentMap then
StopResource(currentMap)
end
StartResource(map)
end
Returns a bool variables as to whether or not a map supports a game type.
Arguments : gameType map
-- mapmanager_server.lua
function doesMapSupportGameType(gameType, map)
if not gametypes[gameType] then
return false
end
if not maps[map] then
return false
end
if not maps[map].gameTypes then
return true
end
return maps[map].gameTypes[gameType]
end
Returns a table of all available maps.
Arguments : None
-- mapmanager_server.lua
function getMaps()
return maps
end
Will end a round.
Arguments : None
-- mapmanager_server.lua
function roundEnded()
SetTimeout(50, handleRoundEnd)
end