'LinKin Posted March 17, 2014 Posted March 17, 2014 Hello, I want to make a GUI so that it displays a list of all maps compatible with Race gamemode. (Only Race). Which stuff should I use to get those maps? Also, to order them alphabetically in the GUI. Thanks.
JR10 Posted March 17, 2014 Posted March 17, 2014 Try this: local raceMaps = {} addEventHandler('onResourceStart', resourceRoot, function() for index, resource in pairs(getResources()) do if (getResourceInfo(resource, "type") == "map" and string.find(getResourceInfo(resource, "gamemodes") or "", "race") then table.insert(raceMaps, resource) end end end)
'LinKin Posted March 17, 2014 Author Posted March 17, 2014 Hmm, I remember some function that was smth like this: getMapsCompatibleWithGamemode(getRunningGamemode()). Also, how to sort them alphabetically?
JR10 Posted March 17, 2014 Posted March 17, 2014 That's an exported function in the mapmanager resource, you can also use that. Here's how to sort the raceMaps table: table.sort(raceMaps, function(a, b) return getResourceName(b) > getResourceName(a) end) Not tested but should work.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now