Jump to content

next map


Kenix

Recommended Posts

Posted

Here's the script does not work help me fix it. :(

  
local lastmap = nil 
  
function startnextmap() 
    local array = {} 
    local z = 0 
  
    for i,v in ipairs(getResources()) do 
        if string.match(getResourceName(v), "zm") then  
            z = z + 1  
            array[z]=v  
        end 
    end 
         
    local nextmap = array[math.random(1,z)] 
    if lastmap ~= nextmap then  
        stopResource(nextmap)  
        startResource(getResourceFromName(getResourceName(nextmap))) 
        lastmap = nextmap 
    end 
end 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
In race gamemode Nextmap script is already integrated.

I do not for a race game mode lol

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

The stopResource and startResource are wrong, use the correct pointers.

Or if you're running mapmanager, you can use this (it's probably better to not use this tho):

local lastmap = nil 
  
function startnextmap() 
    local gamemode = exports.mapmanager:getRunningGamemode()     -- current gamemode 
    local array = exports.mapmanager:getMapsCompatibleWithGamemode(gamemode) 
    local nextmap = array[math.random(1,#array)] 
    if lastmap ~= nextmap then  
        stopResource(exports.mapmanager:getRunningGamemodeMap())  
        startResource(nextmap) 
        lastmap = nextmap 
    end 
end 

Learn Lua - Learn to script - GUI scripting

Scripter tools - Find/fix errors yourself(!)

Don't pm me for scripting help, keep it for the Scripting subforum!

Posted
The stopResource and startResource are wrong, use the correct pointers.

Or if you're running mapmanager, you can use this (it's probably better to not use this tho):

local lastmap = nil 
  
function startnextmap() 
    local gamemode = exports.mapmanager:getRunningGamemode()     -- current gamemode 
    local array = exports.mapmanager:getMapsCompatibleWithGamemode(gamemode) 
    local nextmap = array[math.random(1,#array)] 
    if lastmap ~= nextmap then  
        stopResource(exports.mapmanager:getRunningGamemodeMap())  
        startResource(nextmap) 
        lastmap = nextmap 
    end 
end 

not working need admin rights

[2011-01-15 22:41:22] Access denied @ 'stopResource'

[2011-01-15 22:41:22] Access denied @ 'startResource'

edit : mapmanager running

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

if it needs admin rights then add it to acl.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

already a better job but he swears at stopResource

Bad argument @ 'stopResource'

acl

 name="Admin">         name="resource.zombie_mod" />name="Admin">        name="function.stopResource" access="true" />        name="function.startResource" access="true" /> 

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

help make that he has started any card please.

I used to use it here but it loads the game mode and maps as well I'd like to do to load only the map

  
exports.mapmanager:changeGamemode( getResourceFromName('zombie_mod') ) 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

if you want only to load the map then why you put changeGamemode? i think you should use

changeGamemodeMap 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
if you want only to load the map then why you put changeGamemode? i think you should use
changeGamemodeMap 

something is not working.

error in both cases mapmanager: invalid map specified.

  
function startnextmap() 
        local array = {} 
    local z = 0 
  
    for i,v in ipairs(getResources()) do 
        if string.match(getResourceName(v), "zm") then  
            z = z + 1  
            array[z]=v  
        end 
    end 
        exports.mapmanager:changeGamemodeMap(math.random(1,z)) 
         
end 
  

  
exports.mapmanager:changeGamemodeMap() 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

here I am slightly corrected the error but still the problem with stop maps and runs it perfectly

immediately evident that he was stupidly run maps

[2011-01-19 16:55:25] Starting zm-newisland

[2011-01-19 16:55:25] start: Resource 'zm-newisland' started

[2011-01-19 16:55:44] Starting zm-angar

[2011-01-19 16:55:44] start: Resource 'zm-angar' started

[2011-01-19 16:55:56] Starting zm-war-island

[2011-01-19 16:55:56] start: Resource 'zm-war-island' started

  
function startnextmap() 
    local gamemode = exports.mapmanager:getRunningGamemode()      
    outputChatBox( "gamemode = " .. tostring(gamemode) ) 
  
    local array = exports.mapmanager:getMapsCompatibleWithGamemode(gamemode) 
    outputChatBox( "array = " .. tostring(array) ) 
  
    local nextmap = array[math.random(1,#array)] 
    outputChatBox( "nextmap = " .. tostring(nextmap) ) 
  
     
    if lastmap ~= nextmap then  
        
         local curentmap = exports.mapmanager:getRunningGamemodeMap()      
        outputChatBox( "MAP = " .. tostring(curentmap) )    
         
        startResource(nextmap) 
        lastmap = nextmap 
    else 
        outputChatBox( "случайно выбрана все та же текущая карта" ) 
    end 
end 
  

help please :(

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
Where's stopResource? The current map isn't stopped now, it needs to be added before startResource obviously
  
local thismap = exports.mapmanager:getRunningGamemodeMap() 
stopResource(thismap) 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
And it doesn't work now? Please post full script again and debug

userdata wrote and values.

  
function startnextmap() 
    local gamemode = exports.mapmanager:getRunningGamemode()      
    outputChatBox( "gamemode = " .. tostring(gamemode) ) 
  
    local array = exports.mapmanager:getMapsCompatibleWithGamemode(gamemode) 
    outputChatBox( "array = " .. tostring(array) ) 
  
    local nextmap = array[math.random(1,#array)] 
    outputChatBox( "nextmap = " .. tostring(nextmap) ) 
  
     
    if lastmap ~= nextmap then  
         
        local thismap = exports.mapmanager:getRunningGamemodeMap() 
         outputChatBox( "MAP = " .. tostring(thismap) )   
  
        stopResource(thismap) 
        startResource(nextmap) 
        lastmap = nextmap 
    else 
        outputChatBox( "случайно выбрана все та же текущая карта" ) 
    end 
end 
  
  

edit :and call

  
setTimer(startnextmap, 6100, 1) 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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