Anubhav Posted March 23, 2014 Posted March 23, 2014 Is it a way to start random map? Something with my own script?
HerculePoirot Posted March 23, 2014 Posted March 23, 2014 I think u should use tables and then extract a random entry from it using math.random and use the map assigned to that entry.
cheez3d Posted March 23, 2014 Posted March 23, 2014 local maps = {} for k,resource in ipairs (getResources()) do if getResourceInfo(resource,"type") == "map" then table.insert(maps,k,resource) end end startResource(maps[math.random(1,#maps)])
Anubhav Posted March 23, 2014 Author Posted March 23, 2014 =__=. Will get the maps from each resource? I need it only for one resource name : tdmMaps
Moderators IIYAMA Posted March 23, 2014 Moderators Posted March 23, 2014 Before you let somebody lock it, you also can use mapmanager. function setNextRound () local mapmanager = getResourceFromName ( "mapmanager" ) if mapmanager then local maps = call (mapmanager,"getMapsCompatibleWithGamemode",thisResource) if maps then call (mapmanager,"changeGamemodeMap",maps[math.random(#maps)]) end end end
Recommended Posts