_index
title: mapmanager
Mapmanager
Mapmanager is an included citizenfx resource that handles map changes, game types, and compatibility between gametypes and maps.
Resource Structure
Client Scripts
- mapmanager_client.lua
Server Scripts
- mapmanager_server.lua
Shared Scripts
- mapmanager_shared.lua
Exports
Exports are called using exports["mapmanger"]:exportname(args)
Shared Scripts > getCurrentGameType
Returns the current game type.
Arguments : None
-- mapmanager_server.lua
function getCurrentGameType()
return currentGameType
end
Shared Scripts > getCurrentMap
Returns the current map.
Arguments : None
-- mapmanager_server.lua
function getCurrentMap()
return currentMap
end
Shared Scripts > changeGameType
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
Shared Scripts > changeMap
Changes the current map
Arguments : map
-- mapmanager_server.lua
function changeMap(map)
if currentMap then
StopResource(currentMap)
end
StartResource(map)
end
Shared Scripts > doesMapSupportGameType
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
Shared Scripts > getMaps
Returns a table of all available maps.
Arguments : None
-- mapmanager_server.lua
function getMaps()
return maps
end
Shared Scripts > roundEnded
Will end a round.
Arguments : None
-- mapmanager_server.lua
function roundEnded()
SetTimeout(50, handleRoundEnd)
end
title: mapmanager
Mapmanager
Mapmanager is an included citizenfx resource that handles map changes, game types, and compatibility between gametypes and maps.