audi868 Posted September 9, 2011 Share Posted September 9, 2011 Any help? It is returning errors at setting cmd. function nextmap(source,cmd,...) nextmapname = table.concat({...}," ") for k,v in ipairs(getResources()) do local name = getResourceInfo(v,'name') if name == nextmapname then nextmap = v end end outputChatBox("Nextmap set to "..getResourceName(nextmap),source) end addCommandHandler("nm",nextmap) addEvent("onGamemodeMapStop") addEventHandler("onGamemodeMapStop",root,function() if not (nextmap) == nil then local map = nextmap startResource(map) nextmap = nil end end ) Link to comment
audi868 Posted September 9, 2011 Author Share Posted September 9, 2011 Bad argument at getResourceName, and the nextmap doesn't starts too Link to comment
Castillo Posted September 9, 2011 Share Posted September 9, 2011 (edited) function nextmap(source,cmd,...) nextmapname = table.concat({...}," ") nextmap = nil for k,v in ipairs(getResources()) do local name = getResourceInfo(v,'name') if name == nextmapname then nextmap = v end end if nextmap then outputChatBox("Nextmap set to "..getResourceName(nextmap),source) end end addCommandHandler("nm",nextmap) addEvent("onGamemodeMapStop") addEventHandler("onGamemodeMapStop",root,function() if (nextmap) then local map = nextmap startResource(map) nextmap = nil end end ) Edited September 9, 2011 by Guest Link to comment
Castillo Posted September 9, 2011 Share Posted September 9, 2011 /nm seems to work, I'm not sure if the rest does, copy the code again, I changed something, but shouldn't do difference, copy it anyway. Link to comment
audi868 Posted September 9, 2011 Author Share Posted September 9, 2011 My bad, I was trying it on a un-named map. ty btw Link to comment
Castillo Posted September 9, 2011 Share Posted September 9, 2011 Oh, lol. P.S: You welcome. 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