Forum

> > CS2D > Scripts > Vote Map
Forums overviewCS2D overview Scripts overviewLog in to reply

English Vote Map

2 replies
To the start Previous 1 Next To the start

old Vote Map

G3tWr3ck3d
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[22:33:56] [ZP] Map change to <zm_greymarsh
> by Admin
[22:33:56] LOAD MAP: 'maps/zm_greymarsh
.map' does not exist
[22:33:56] 16 
[22:33:57] [ZP] Map change to <zm_researchcentermk
> by Admin
[22:33:57] LOAD MAP: 'maps/zm_researchcentermk
.map' does not exist
[22:33:57] 15 
[22:33:58] 14 
[22:33:59] [ZP] Map change to <zm_Assisi_Piazza_v1.1
> by Admin
[22:33:59] LOAD MAP: 'maps/zm_Assisi_Piazza_v1.1
.map' does not exist
[22:33:59] 13 
[22:34:00] [ZP] Map change to <zm_cafecounty
> by Admin
[22:34:00] LOAD MAP: 'maps/zm_cafecounty
.map' does not exist
[22:34:00] 12 
[22:34:01] [ZP] Map change to <zm_de_dust
> by Admin
[22:34:01] LOAD MAP: 'maps/zm_de_dust
.map' does not exist
[22:34:01] 11 
[22:34:02] [ZP] Map change to <zm_de_dust2_xmas
> by Admin
[22:34:02] LOAD MAP: 'maps/zm_de_dust2_xmas
.map' does not exist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if title:sub(1, 4) == "Maps" then
		local page = title:match("(%d*)/"..math.ceil(#mp.maps / 6))
		local pages = math.ceil(#mp.maps / 6)
		if button == 8 then mp.mapmenu(id, page + 1) end
		if button == 9 then mp.mapmenu(id, page - 1) end
		if button <= 6 and button > 0 then
			if level[id] < 5 and not mp.pollstarted then
				local map = ((page - 1) * 6) + button
				mp.startpoll(id, map)
			elseif level[id] >= 5 then			
				local e
				local map = ((page - 1) * 6) + button
				mp.map = mp.maps[map]
				for e = 1,p_cnt do 
					if player(e,'exists')then 
						zp_player_sv(e)
					end 
				end
				msg(content[1].."Map change to <"..mp.map.."> by Admin@C")
				timer(5000,"parse","changemap "..mp.map)
			else
				msg2(id,"\169255000000Error, there's already a map vote pending!") 
			end
		end
	end
It just returns map does not exist. Using http://unrealsoftware.de/files_show.php?file=15921 vote system
Any ideas why it wont change map?

I have noticed that it only occurs on my linux dedicated server. While on my windows dedicated it works changing the map. I feel like is some kind of a cs2d bug

old Re: Vote Map

VADemon
User Off Offline

Quote
It looks like you have a new-line character between <name> and .map

Where and how do you define
mp.maps
?

old Re: Vote Map

G3tWr3ck3d
User Off Offline

Quote
1
2
3
4
5
6
function mp.mapsupdate()
	mp.maps = {}
	local file = io.open("sys/lua/zombieplague/maplist.cfg","r")
	for line in file:lines() do if line ~= "" then table.insert(mp.maps, line) end end
	file:close()
end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function mp.mapmenu(id, page)
	mp.mapsupdate()

	local page = page or 1
	local pages = math.ceil(#mp.maps / 6)
	if page < 1 then page = pages end
	if page > pages then page = 1 end
	local menuString = "Maps ("..page.."/"..pages..")"
	for i = 6 * page - 5, 6 * page do
		if mp.maps[i] then menuString = menuString ..", ".. mp.maps[i] else menuString = menuString .."," end
	end
	if page == pages then menuString = menuString ..",,First page" else menuString = menuString ..",,Next page" end
	if page == 1 then menuString = menuString ..",Last page" else menuString = menuString ..",Previous page" end
	menu(id, menuString)
end

maps are stored in mapslist.cfg as newline characters
1
2
3
zm_de_dust2_xmas
zm_de_dust
zm_cafecounty
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview