And btw , i don't get any errors , it's just not working also this code below is a module of the hc admin script which works , but this lonely module don't work..
vote map module code 

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
if BB==nil then BB={} end BB.mapvote={} function initArray(m) 	local array = {} 	for i = 1, m 	do array[i]=0 	end 		return array end maps = {} for mapm in io.lines(hc_dir.."/maps.txt") do table.insert(maps,mapm) end laser = {} laser = { ["mc_ Arena_v2 "] = "on", ["minecraft_Islands_1.5.0"] = "on", ["minecraft_CityZoon_v1.9"] = "on", ["mc_Chilla_Lake1.8"] = "on", } ---------------Settings--------------- voted=initArray(32) sortid=initArray(32) pager = initArray(32) for id = 1,32 do sortid[id]="ABC" pager[id]=1 end -- votclos = 0 votvlostim = 120 vot30 = initArray(32) -- count_down = 60 endsec = 30 votestarted = 0 voteend = 0 no = 0 yes = 0 fasc = 0 -- locked=false -- mf = 0 ---------------Menus--------------- function selectmenu(id, page) 	local page = page or 1 	local pages = math.ceil(#maps / 7) 	if page < 1 then page = pages end 	if page > pages then page = 1 end 	local m = 'Vote for map '.. page ..'/'.. pages ..'@b' 	if page == 1 then m = m ..',(mc-cs2d.boards.net)|Our forum' else m = m ..',<<|PREVIOUS PAGE' end 	for i = 7 * page - 6, 7 * page do 		if maps[i] then 		if laser[maps[i]]~=nil then 		m = m ..', '.. maps[i] .. '' 		else 		m = m ..', '.. maps[i] 		end 		else m = m ..',' end 	end 	if page == pages then m = m else m = m ..',>>|NEXT PAGE' end 	--if page == 1 then m = m..',<<|PREVIOUS PAGE' else m = m ..',<<|PREVIOUS PAGE' end 	menu(id, m) end --addhook("menu", "BB.mapvote.mapmenu") function BB.mapvote.mapmenu(id, title, button) local page = title:match('Vote for map ([%d]+)') if page ~= nil then page = tonumber(page) 		 if votestarted == 0 then 		 if locked == false then if button == 9 then selectmenu(id, page + 1) pager[id]=pager[id]+1 end 	 if page ~= 1 then if button == 1 then selectmenu(id, page - 1) pager[id]=pager[id]-1 end end if button >= 2 and button <= 8 then 		 if vot30[id] <= 0 then 		 		 if votclos == 1 then 				maptovote = (page - 1) * 7 + button - 1 				msg("©000255000"..player(id,"name").." called a vote to "..maps[maptovote].."") 				msg("©255255255Press [F3] for YES, [F4] for NO!") 				msg("©000255000"..player(id,"name").." voted YES!") 				parse('sv_sound "player/vote.wav"') 				yes = yes+1 				voted[id] = 1 				votestarted = 1 				locked=true 				whvot = player(id,"name") 				vot30[id] = 91 				for id = 1,32 do 				parse('hudtxt2 '..id..' 15 "©000255000'..whvot..' ©255255255called a vote For ©255000070'..maps[maptovote]..'" 5 410') 				end 				local neyesp = #player(0,"table") 				neyes = math.ceil(neyesp * 0.7) 				fasc = neyesp-1 				return false 				else 				if button ~= 0 then 				msg2(id,"©255000000You can't vote now!@C") 				msg2(id,"©255000000Wait 2 minute@C") 				end 				end 				 else 				 if button ~= 0 then 			msg2(id,"©255000000You can't vote now!@C") 				msg2(id,"©255000000Wait 30 sec@C") 				end 				end 				end 				end end end 				if page == 1 and button == 1 then 				msg2(id,"©255000000This system removed@C") 				selectmenu(id, 1) 				--menu(id,"<SORT>@b,A-B,,MOST PLAYED,,HIGHEST RATED,,NEWEST ADDED,,BACK|<<") 				end 				 				if title == "<SORT>" then 				if button == 1 then sortid[id]="ABC" selectmenu(id, 1) 				elseif button == 3 then sortid[id]="PLAYED X" selectmenu(id, 1) 				elseif button == 5 then sortid[id]="RATING +X" selectmenu(id, 1) 				elseif button == 7 then sortid[id]="NEW" selectmenu(id, 1) 				elseif button == 9 then selectmenu(id, 1) 				elseif button == 0 then selectmenu(id, 1) 				end end end --addhook("second","BB.mapvote.countdown") function BB.mapvote.countdown() 	if votestarted == 1 then 		if count_down == 0 then 			if yes >= neyes then 				voteend = 1 				msg("©000255000The poll is ACCEPTED!") 				parse('sv_sound "env/mystery.wav"') 				parse('hudtxt 15 "" 5 410') 				parse('hudtxt 43 "" 200 410') 				parse('hudtxt 7 "" 240 286') 				fasc = 0 			end 			if yes < neyes then 				msg("©255000000The poll is REJECTED!") 		 				locked=false 				parse('hudtxt 7 "" 240 286') 				parse('hudtxt 15 "" 5 410') 				parse('hudtxt 43 "" 200 410') 				fasc = 0 			end 			votestarted = 0 			count_down = 60 			for all = 1,32 do 				voted[all] = 0 			end 			no = 0 			yes = 0 		else 			parse('hudtxt 43 "©255255255Time: '..count_down..' YES: '..yes..' Need YES: '..neyes..'" 5 423') 			count_down=count_down-1 		end 	end 	if voteend == 1 then 		endsec = endsec-1 	end 	if endsec == -1 then 	if maps[maptovote]==game("sv_map") then 		parse("restart 2") 		endsec = 30 		yes = 0 		no = 0 		count_down = 60 		votestarted = 0 		locked = false 		voteend = 0 		parse('hudtxt 2 "" 5 425') 	else 		parse("map "..maps[maptovote].."") 		end 		end for id = 1,32 do if vot30[id] >= 1 then vot30[id] = vot30[id]-1 end end end function votclosp() votclos = 1 end --addhook("second","BB.mapvote.lastseconds") function BB.mapvote.lastseconds() 	for id=1,32 do 	if voteend == 1 then 	if maps[maptovote]==game("sv_map") then 	parse('hudtxt 2 "©000255000Restart map in '..endsec..' seconds" 5 425') 		elseif voteend == 1 then 	if maps[maptovote]~=game("sv_map") then 		parse('hudtxt 2 "©000255000Mapchange to '..maps[maptovote]..' in '..endsec..' seconds" 5 425') 	end 	end 	end 	if votestarted == 1 then 	if voted[id] == 0 then 	parse('hudtxt2 '..id..' 7 "©000255000[F3]©255255255 - vote ©000255000YES ©255000070[F4]©255255255 - vote ©255000070NO" 224 260') 	end 	if fasc == 0 or yes >= neyes then 	if vot30[id] >= 30 then 	if count_down >= 3 then 	vot30[id] = vot30[id]-count_down 	count_down = 0 	end 	end 	end end end end ---------------Player votes--------------- --addhook("serveraction","BB.mapvote.votechoose") function BB.mapvote.votechoose(id,action) 	if action == 2 then 		if voted[id] == 0 then 			if votestarted == 1 then 				yes = yes+1 				voted[id] = 1 				msg("©000255000"..player(id,"name").." voted YES!") 				parse('sv_sound "player/vote.wav"') 				parse('hudtxt2 '..id..' 7 "" 240 286') 				fasc = fasc - 1 			end 		else 			msg2(id,"©255000000You've already voted!@C") 		end 	elseif action == 3 then 		if voted[id] == 0 then 			if votestarted == 1 then 				no = no+1 				voted[id] = 1 				msg("©255000000"..player(id,"name").." voted NO!") 			parse('sv_sound "player/vote.wav"') 				parse('hudtxt2 '..id..' 7 "" 240 286') 				fasc = fasc - 1 			end 		else 			msg2(id,"©255000000You've already voted!@C") 		end 	end end function BB.mapvote.showmapv23() for id = 1,32 do if voteend == 0 then parse('hudtxt2 '..id..' 15 "©000255000'..whvot..' ©255255255called a vote For ©255000070'..maps[maptovote]..'" 5 410') end end end function BB.mapvote.join(id) if votestarted == 1 then if voteend == 0 then timer(500,"BB.mapvote.showmapv23") end voted[id] = 1 end end --addhook("leave","levnul") function levnul(id) if voted[id] == 0 then if votestarted == 1 then yes = yes+1 msg("©000255000"..player(id,"name").." voted YES!") parse('sv_sound "player/vote.wav"') fasc = fasc - 1 end end sortid[id]="ABC" pager[id]=1 end timer(120000,"votclosp") --timer(1,"votclosp")
PS : The hc script that i use is edited and i won't give it to any one , i would give it only to moderators.
edited 1×, last 25.06.15 06:30:19 pm