Jump to content

Random Maps


Anubhav

Recommended Posts

Posted
  
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)]) 
  

  • Moderators
Posted

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 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...