Kenix Posted January 15, 2011 Share Posted January 15, 2011 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 Link to comment
proracer Posted January 15, 2011 Share Posted January 15, 2011 In race gamemode Nextmap script is already integrated. Link to comment
Kenix Posted January 15, 2011 Author Share Posted January 15, 2011 In race gamemode Nextmap script is already integrated. I do not for a race game mode lol Link to comment
SDK Posted January 15, 2011 Share Posted January 15, 2011 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 Link to comment
Kenix Posted January 15, 2011 Author Share Posted January 15, 2011 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 Link to comment
Castillo Posted January 15, 2011 Share Posted January 15, 2011 if it needs admin rights then add it to acl. Link to comment
Kenix Posted January 16, 2011 Author Share Posted January 16, 2011 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" /> Link to comment
Kenix Posted January 16, 2011 Author Share Posted January 16, 2011 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') ) Link to comment
Castillo Posted January 17, 2011 Share Posted January 17, 2011 if you want only to load the map then why you put changeGamemode? i think you should use changeGamemodeMap Link to comment
Kenix Posted January 17, 2011 Author Share Posted January 17, 2011 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() Link to comment
Kenix Posted January 19, 2011 Author Share Posted January 19, 2011 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 Link to comment
SDK Posted January 19, 2011 Share Posted January 19, 2011 Where's stopResource? The current map isn't stopped now, it needs to be added before startResource obviously Link to comment
Kenix Posted January 19, 2011 Author Share Posted January 19, 2011 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) Link to comment
SDK Posted January 19, 2011 Share Posted January 19, 2011 And it doesn't work now? Please post full script again and debug Link to comment
Kenix Posted January 20, 2011 Author Share Posted January 20, 2011 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) Link to comment
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