Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.66 KB | None | 0 0
  1. /* AMX Mod X
  2. * Nextmap Chooser Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. * originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * In addition, as a special exception, the author gives permission to
  25. * link the code of this program with the Half-Life Game Engine ("HL
  26. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. * respects for all of the code used other than the HL Engine and MODs
  29. * from Valve. If you modify this file, you may extend this exception
  30. * to your version of the file, but you are not obligated to do so. If
  31. * you do not wish to do so, delete this exception statement from your
  32. * version.
  33. * Maps to select are in config/maps.ini file, mapcycle file or maps folder.
  34. *
  35. * If amx_mapchooser_type is set to 1, players can nominate maps for the vote.
  36. * They have to type "nominate mapname" or "vote mapname" or "mapname" in the chat.
  37. * They can type "nominations" in the chat to see the list of nominated maps.
  38. * They can type "amx_listmaps" in console to see the maps that can be nominated if
  39. * amx_nominfromfile is set to 1.
  40. *
  41. * Cvars:
  42. * amx_mapchooser_type <0/1/2> - 0: random maps from amx_mapchooser_mapsfile/mapcycle/maps folder
  43. * 1: nominations
  44. * 2: the nextmap is a random map chosen from amx_mapchooser_mapsloc (no vote)
  45. * amx_mapchooser_mapsloc <0|1|2> - 0: amx_mapchooser_mapsfile
  46. * 1: mapcycle
  47. * 2: maps folder
  48. * amx_mapchooser_mapsfile "maps.ini" - File used when amx_mapchooser_mapsloc is set to 0
  49. * The file must be in amxmodx/configs/ folder.
  50. * amx_mapchooser_mapsfile_s "maps_small.ini" - File used when amx_mapchooser_mapsloc is set to 0 and there
  51. * is less than 10 players on the server
  52. * The file must be in amxmodx/configs/ folder.
  53.  
  54. * amx_nominfromfile <0/1> - 0: players can nominate all the maps from the map folder
  55. * 1: players can only nominate maps from amx_mapchooser_mapsfile/mapcycle
  56. * amx_maxnominperplayer <num> - how many maps each player can nominate
  57. * amx_map_history <num> - how many last played maps shouldn't go to the maps vote menu
  58. *
  59. * amx_extendmap_max <time in mins.> - max. time for overall extending
  60. * amx_extendmap_step <time in mins.> - with what time the map will be extended
  61. * amx_ext_round_max <number of possible polls for extend> - how many times the map can be extended
  62. * amx_ext_round_step <number of rounds> - with what rounds number the map will be extended
  63. * amx_ext_win_max <number of possible polls for extend> - how many times the map can be extended
  64. * amx_ext_win_step <number of rounds> - with what rounds number the map will be extended
  65. *
  66. * amx_rtv <0/1> - 0 - disables rockthevote option
  67. * amx_rtv_percent <0.0-1.0> - rockthevote ratio (%/100 human-players they need to say rockthevote
  68. * to start voting for the next map.
  69. * amx_rtv_min_time <time in mins.> - minimum time (in minutes) required to play the map before players
  70. * can use rockthevote feature.
  71. * amx_rtv_map_time <time in sec.> - time after successful rtv then voting for the new map, the map
  72. * will change to the new one (instead waiting until round end)
  73. *
  74. * NOTE: Nextmap plugin is required for proper working of this plugin.
  75. *
  76. * Some parts of the nominations code are taken from Deagles's map management plugin and AMX 2006.3 mapchooser.
  77. *
  78. */
  79.  
  80. #include <amxmodx>
  81. #include <amxmisc>
  82.  
  83. #define VOTE_TIME 15
  84. #define CHECK_MENU_TIME 0.5
  85.  
  86. #define FLAG_AMX_VOTENEXTMAP ADMIN_VOTE
  87.  
  88. #define MAX_MAPS 1024
  89. #define SELECTMAPS 5
  90.  
  91. #define MAP_HISTORY_MAX 15
  92. // #define MAP_HISTORY 5
  93. #define NOMINATIONS_HELPMSG 12 // a help message telling people they can nominate maps will be displayed
  94. // every 15 * value seconds (ie: 15 * 12 = 3mns)
  95. // if amx_mapchooser_type is set to 1
  96. #define LISTMAPAMOUNT 10
  97.  
  98.  
  99. new const speak[][] = { "one", "two", "three", "four", "five" }
  100. new g_hist_mapName[MAP_HISTORY_MAX][32]
  101. new g_MapHistory = 5
  102. new g_mapName[MAX_MAPS][32]
  103. new g_mapsNum = 0
  104.  
  105. new g_nominMapName[SELECTMAPS][32]
  106. new g_nominMapsNum = 0
  107. new g_nominated[33]
  108. new g_whoNominMapNum[SELECTMAPS]
  109.  
  110. new bool:g_hasVoted[33]
  111.  
  112. new g_mapVoteName[SELECTMAPS][32]
  113. new g_voteCount[SELECTMAPS+3]
  114. new g_mapVoteNum = 0
  115. new g_teamScore[2]
  116. new g_lastMap[32]
  117. new g_maphistFile[128]
  118.  
  119. new g_coloredMenus
  120. new g_maxplayers
  121. new bool:g_selected = false
  122. new bool:g_call_say_vote = false
  123. new bool:g_vote_finished = false
  124. new bool:g_buyingtime = true
  125.  
  126. new g_extendCount = 0
  127. new bool:g_extend
  128. new bool:g_forceVote
  129. new g_forceVoteTime
  130.  
  131. new g_active_players = 0
  132. new bool:g_inprogress = false
  133. new bool:g_hasbeenrocked = false
  134. new bool:g_rockthevote = false
  135. new bool:g_ForceChangeMap = false
  136. new g_rocks = 0
  137. new g_rocked[33]
  138.  
  139. new g_nominationsHelpMsgIter
  140. new g_mapsOnServerNum
  141.  
  142. new pv_amx_mapchooser_type
  143. new pv_amx_map_history
  144. new pv_amx_vote_time
  145. new pv_amx_vote_delay
  146. new pv_amx_last_voting
  147. new pv_amx_rtv
  148. new pv_amx_rtv_percent
  149. new pv_amx_rtv_min_time
  150. new pv_amx_rtv_map_time
  151.  
  152. new menuid_choosenextmap
  153.  
  154. new const PLUGINNAME[] = "Nextmap Chooser 4"
  155. new const VERSION[] = "3.41"
  156. new const AUTHOR[] = "AMX Dev & KWo"
  157.  
  158. public NEXTMAP_MSG
  159. public NEXTMAP_ROUNDCOUNT
  160. public NEXTMAP_WINCOUNT
  161. public NEXTMAP_TIMECOUNT
  162.  
  163. public plugin_init()
  164. {
  165. register_plugin(PLUGINNAME,VERSION,AUTHOR)
  166. register_dictionary("mapchooser4.txt")
  167. register_dictionary("common.txt")
  168.  
  169. register_logevent( "eNewRound", 2, "1=Round_Start" )
  170. // register_event("RoundTime", "eNewRound", "bc")
  171. register_event( "SendAudio", "eEndRound", "a",
  172. "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw" )
  173. // register_logevent( "Log_Event_RoundEnd", 2, "1=Round_End" )
  174.  
  175. pv_amx_mapchooser_type = register_cvar("amx_mapchooser_type","0")
  176. pv_amx_map_history = register_cvar("amx_map_history","5")
  177. register_cvar("amx_mapchooser_mapsloc", "0")
  178. register_cvar("amx_mapchooser_mapsfile", "maps.ini")
  179. register_cvar("amx_mapchooser_mapsfile_s", "maps_small.ini")
  180. register_cvar("amx_nominfromfile","0")
  181. register_cvar("amx_maxnominperplayer","1")
  182.  
  183. register_cvar("amx_extendmap_max","90")
  184. register_cvar("amx_extendmap_step","15")
  185. register_cvar("amx_ext_round_max","3")
  186. register_cvar("amx_ext_round_step","3")
  187. register_cvar("amx_ext_win_max","3")
  188. register_cvar("amx_ext_win_step","3")
  189.  
  190. pv_amx_vote_time = register_cvar("amx_vote_time","20")
  191. pv_amx_vote_delay = register_cvar("amx_vote_delay","60")
  192. pv_amx_rtv = register_cvar("amx_rtv","1")
  193. pv_amx_rtv_percent = register_cvar("amx_rtv_percent","0.6")
  194. pv_amx_rtv_min_time = register_cvar("amx_rtv_min_time","10")
  195. pv_amx_rtv_map_time = register_cvar("amx_rtv_map_time","10")
  196.  
  197. pv_amx_last_voting = get_cvar_pointer("amx_last_voting")
  198. set_cvar_float("amx_last_voting",0.0)
  199. set_task(1.0, "checkFunc", .flags="b")
  200.  
  201. register_concmd("amx_votenextmap","cmdVoteNextMap",FLAG_AMX_VOTENEXTMAP,"<time> : the map will be changed <time> seconds after the end of the vote")
  202. register_clcmd("say","handleSay")
  203.  
  204. register_clcmd("amx_listmaps","cmdListMaps",0,"- lists maps that can be nominated.")
  205.  
  206. if ( cstrike_running() )
  207. register_event("TeamScore", "team_score", "a")
  208.  
  209. g_maxplayers = get_maxplayers()
  210.  
  211. get_localinfo("lastMap",g_lastMap,31)
  212. set_localinfo("lastMap","")
  213.  
  214. new MenuName[64]
  215. format(MenuName,63,"%L","en","CHOOSE_NEXTM")
  216. menuid_choosenextmap = register_menuid(MenuName)
  217. register_menucmd(menuid_choosenextmap,(-1^(-1<<(SELECTMAPS+2))),"countVote")
  218.  
  219. g_coloredMenus = colored_menus()
  220. g_buyingtime = true
  221. g_forceVote = false
  222.  
  223. g_active_players = 0
  224. g_rocks = 0
  225. g_inprogress = false
  226. g_hasbeenrocked = false
  227. g_rockthevote = false
  228. g_ForceChangeMap = false
  229.  
  230. for(new i = 1; i < 33; ++i)
  231. {
  232. g_rocked[i] = 0
  233. }
  234.  
  235. g_nominationsHelpMsgIter = 0
  236. getMapsOnServerNum()
  237. }
  238.  
  239. public checkFunc(id)
  240. {
  241. if(get_timeleft() == 123)
  242. {
  243. // Do things
  244. set_task(1.0, "countDown", 3)
  245. client_print(0,print_chat,"Voting is started. Wait a moment..." )
  246. }
  247. }
  248.  
  249. public countDown(timer)
  250. {
  251. if( timer )
  252. {
  253. client_cmd( 0 ,"spk ^"%s^"", speak[timer-1] )
  254. // say_hudmessage( 0, 64, 64, 64, 0.025, -1.0, 0, 0.0, 1.03, 0.0, 0.0, 4, "%L %L", , "", , "", timer, )
  255. // client_print(0, print_chat, "%s", --timer)
  256. set_task(1.0, "countDown", --timer)
  257. }
  258. else
  259. set_task( 0.01, "HideMenu" )
  260. }
  261.  
  262. public HideMenu( )
  263. {
  264. client_cmd(0, "slot10")
  265. }
  266.  
  267.  
  268. public plugin_cfg()
  269. {
  270. new filename[128]
  271. new cfgdir[128]
  272. get_configsdir(cfgdir, 127)
  273. format(g_maphistFile, 127, "%s/maphist.ini", cfgdir)
  274.  
  275. load_history(g_maphistFile)
  276.  
  277. if (get_cvar_num("amx_mapchooser_mapsloc") == 0)
  278. {
  279. new mapslocfile[32]
  280. get_cvar_string("amx_mapchooser_mapsfile", mapslocfile, 31)
  281. format(filename, 127, "%s/%s", cfgdir, mapslocfile)
  282.  
  283. if (loadSettings(filename))
  284. {
  285. log_message("[AMXX] - Nextmap Chooser 4: %s succesfully loaded.",mapslocfile)
  286. set_task(15.0, "voteNextmap", 987456, "", 0, "b")
  287. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  288. set_task(6.9, "setXvars", 64973122)
  289. }
  290. else
  291. {
  292. log_message("[AMXX] - Nextmap Chooser 4: Failed to load %s or no maps inside the file. Trying to load mapcycle." ,mapslocfile)
  293. get_cvar_string("mapcyclefile", filename, 63)
  294. if (loadSettings(filename))
  295. {
  296. log_message("[AMXX] - Nextmap Chooser 4: mapcycle succesfully loaded.")
  297. set_task(15.0, "voteNextmap", 987456, "", 0, "b")
  298. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  299. set_task(6.9, "setXvars", 64973122)
  300. }
  301. else
  302. {
  303. log_message("[AMXX] - Nextmap Chooser 4: Failed to load mapcycle or no maps inside the file. Trying to load maps folder.")
  304. set_cvar_num("amx_nominfromfile", 0)
  305. if (loadMapsFolder())
  306. {
  307. log_message("[AMXX] - Nextmap Chooser 4: maps folder succesfully loaded.")
  308. set_task(15.0, "voteNextmap", 987456, "", 0, "b")
  309. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  310. set_task(6.9, "setXvars", 64973122)
  311. }
  312. else
  313. {
  314. log_message("[AMXX] - Nextmap Chooser 4: Failed to load maps folder. No maps loaded.")
  315. }
  316. }
  317. }
  318. }
  319. else if (get_cvar_num("amx_mapchooser_mapsloc") == 1)
  320. {
  321. get_cvar_string("mapcyclefile", filename, 63)
  322. if (loadSettings(filename))
  323. {
  324. log_message("[AMXX] - Nextmap Chooser 4: mapcycle succesfully loaded.")
  325. set_task(15.0, "voteNextmap", 987456, "", 0, "b")
  326. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  327. set_task(6.9, "setXvars", 64973122)
  328. }
  329. else
  330. {
  331. log_message("[AMXX] - Nextmap Chooser 4: Failed to load mapcycle or no maps inside the file. Trying to load maps folder.")
  332. set_cvar_num("amx_nominfromfile", 0)
  333. if (loadMapsFolder())
  334. {
  335. log_message("[AMXX] - Nextmap Chooser 4: maps folder succesfully loaded.")
  336. set_task(15.0, "voteNextmap", 987456, "", 0, "b")
  337. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  338. set_task(6.9, "setXvars", 64973122)
  339. }
  340. else
  341. {
  342. log_message("[AMXX] - Nextmap Chooser 4: Failed to load maps folder. No maps loaded.")
  343. }
  344. }
  345. }
  346. else if (get_cvar_num("amx_mapchooser_mapsloc") == 2)
  347. {
  348. set_cvar_num("amx_nominfromfile", 0)
  349. if (loadMapsFolder())
  350. {
  351. log_message("[AMXX] - Nextmap Chooser 4: maps folder succesfully loaded.")
  352. set_task(15.0, "voteNextmap", 987456, "", 0, "b")
  353. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  354. set_task(6.9, "setXvars", 64973122)
  355. }
  356. else
  357. {
  358. log_message("[AMXX] - Nextmap Chooser 4: Failed to load maps folder. No maps loaded.")
  359. }
  360. }
  361. }
  362.  
  363. public client_putinserver(id)
  364. {
  365. if (!is_user_bot(id))
  366. {
  367. g_active_players++
  368. g_rocked[id] = 0
  369. }
  370. }
  371.  
  372. public client_disconnect(id)
  373. {
  374. if(is_user_bot(id))
  375. return PLUGIN_CONTINUE
  376.  
  377. g_active_players--
  378.  
  379. if (g_rocked[id])
  380. {
  381. g_rocked[id] = 0
  382. g_rocks--
  383. }
  384.  
  385. return PLUGIN_CONTINUE
  386. }
  387.  
  388. public setXvars()
  389. {
  390. if (get_pcvar_num(pv_amx_mapchooser_type) == 2)
  391. {
  392. remove_task(987456)
  393. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 3)
  394. new a, i, randNum = random_num(1,10)
  395. for(i = 0; i < randNum; ++i)
  396. {
  397. a = random_num(0,g_mapsNum-1)
  398. }
  399. set_cvar_string("amx_nextmap", g_mapName[a])
  400. return
  401. }
  402.  
  403. new timeleft = get_timeleft()
  404. new count = 1
  405. while((timeleft -= 15) > 129) ++count
  406. set_xvar_num(get_xvar_id("NEXTMAP_TIMECOUNT"), count*15)
  407. set_xvar_num(get_xvar_id("NEXTMAP_ROUNDCOUNT"), get_cvar_num("mp_maxrounds") - 2)
  408. set_xvar_num(get_xvar_id("NEXTMAP_WINCOUNT"), get_cvar_num("mp_winlimit") - 2)
  409.  
  410. if (NEXTMAP_MSG || NEXTMAP_ROUNDCOUNT || NEXTMAP_WINCOUNT || NEXTMAP_TIMECOUNT) // against the compiler which cannot see these xvars ARE used...
  411. // log_amx("xvars for mapchooser 4 setuped.")
  412. client_cmd(0, "")
  413.  
  414. }
  415.  
  416. public check_menu(param[])
  417. {
  418. new iter = param[0]
  419. new Float:vote_time = get_pcvar_float(pv_amx_vote_time) - (iter * CHECK_MENU_TIME)
  420. new menutime = floatround(vote_time, floatround_floor)
  421. if (menutime > 0)
  422. {
  423. new mapsmenu[512], mkeys, pos
  424. mkeys = (1<<SELECTMAPS+1)
  425. pos = 0
  426. for(new i = 0; i < g_mapVoteNum; ++i)
  427. {
  428. pos += format(mapsmenu[pos], 511, "%d. %s^n", i+1, g_mapVoteName[i])
  429. mkeys |= (1<<i)
  430. }
  431. mapsmenu[pos++] = '^n'
  432. pos = 0
  433. new mapname[32]
  434. get_mapname(mapname, 31)
  435. new nextMap[32]
  436. get_cvar_string("amx_nextmap", nextMap, 31)
  437. new players[32], numplayers, player
  438. new menuid, keys
  439. new menu[512]
  440. get_players(players, numplayers, "c")
  441. for(numplayers--; numplayers >= 0; numplayers--)
  442. {
  443. player = players[numplayers]
  444. if (g_hasVoted[player]) continue
  445. get_user_menu(player, menuid, keys)
  446. if (keys == 0 || menuid < 0)
  447. {
  448. menu[0] = '^0'
  449. pos = format(menu,511,g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
  450.  
  451. pos += format(menu[pos], 511-pos, "%s", mapsmenu)
  452. if (g_extend)
  453. {
  454. pos += format(menu[pos],511-pos,"%d. %L^n",SELECTMAPS+1,LANG_SERVER,"EXTEND_MAP",mapname)
  455. }
  456. format(menu[pos], 511-pos, "%d. %L", SELECTMAPS+2,LANG_SERVER,"KEEP_CURRENT_NEXTMAP", nextMap)
  457. show_menu(player, mkeys, menu, menutime, "AMX Choose nextmap:")
  458. }
  459. else if(menuid != menuid_choosenextmap)
  460. {
  461. if(menutime <= 6)
  462. {
  463. menu[0] = '^0'
  464. pos = format(menu,511,g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
  465. pos += format(menu[pos], 511-pos, "%s", mapsmenu)
  466. if( g_extend)
  467. {
  468. pos += format(menu[pos],511-pos,"%d. %L^n",SELECTMAPS+1,LANG_SERVER,"EXTEND_MAP",mapname)
  469. }
  470. format(menu[pos], 511-pos, "%d. %L", SELECTMAPS+2,LANG_SERVER,"KEEP_CURRENT_NEXTMAP", nextMap)
  471. show_menu(player, mkeys, menu, menutime, "AMX Choose nextmap:")
  472. }
  473. }
  474. }
  475. param[0] += 1
  476. set_task(CHECK_MENU_TIME, "check_menu", 1467853, param, 1)
  477. }
  478. }
  479.  
  480.  
  481. public checkVotes()
  482. {
  483. remove_task(1467853)
  484. for(new i = 1; i <= g_maxplayers; ++i)
  485. {
  486. g_hasVoted[i] = true
  487. }
  488.  
  489. new b = 0
  490. new Float:timelimit = get_cvar_float("mp_timelimit")
  491. new maxrounds = get_cvar_num("mp_maxrounds")
  492. new winlimit = get_cvar_num("mp_winlimit")
  493.  
  494. for(new a = 0; a < g_mapVoteNum; ++a)
  495. {
  496. if (g_voteCount[b] < g_voteCount[a])
  497. {
  498. b = a
  499. }
  500. }
  501.  
  502. if ( (timelimit > 0) && ( g_voteCount[SELECTMAPS] > g_voteCount[b] )
  503. && (g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS+1])
  504. && (g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS+2]))
  505. {
  506. new mapname1[32]
  507. get_mapname(mapname1,31)
  508. new Float:steptime = get_cvar_float("amx_extendmap_step")
  509. set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
  510. client_print(0,print_chat,"%L", LANG_SERVER, "CHO_FIN_EXT_T", steptime )
  511. // log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
  512. // mapname1 , steptime )
  513. ++g_extendCount
  514. new timeleft = get_timeleft()
  515. new count = 1
  516. while((timeleft -= 15) > 129) ++count
  517. set_xvar_num(get_xvar_id("NEXTMAP_TIMECOUNT"), count*15)
  518. g_ForceChangeMap = false
  519. g_vote_finished = true
  520. g_inprogress = false
  521. return
  522. }
  523.  
  524. if ( ( maxrounds > 0 ) && ( g_voteCount[SELECTMAPS] > g_voteCount[b] )
  525. && (g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS+1])
  526. && (g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS+2]))
  527. {
  528. new mapname2[32]
  529. get_mapname(mapname2,31)
  530. new stepround = get_cvar_num("amx_ext_round_step")
  531. set_cvar_num("mp_maxrounds", maxrounds + stepround )
  532. client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT_R", stepround )
  533. // log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %d rounds",
  534. // mapname2 , stepround )
  535. g_vote_finished = true
  536. g_inprogress = false
  537. g_ForceChangeMap = false
  538. ++g_extendCount
  539. set_xvar_num(get_xvar_id("NEXTMAP_ROUNDCOUNT"), (get_cvar_num("mp_maxrounds") - 2) - (g_teamScore[0] + g_teamScore[1]))
  540.  
  541. // log_amx("Vote: Map %s will be extended %d time(s)", mapname2 , g_extendCount )
  542. client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT_HMT", mapname2 , g_extendCount )
  543. return
  544. }
  545.  
  546. if ( (winlimit > 0 ) && ( g_voteCount[SELECTMAPS] > g_voteCount[b] )
  547. && (g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS+1])
  548. && (g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS+2]))
  549. {
  550. new mapname3[32]
  551. get_mapname(mapname3,31)
  552. new stepwin = get_cvar_num("amx_ext_win_step")
  553. set_cvar_num("mp_winlimit", winlimit + stepwin )
  554. client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT_W", stepwin )
  555. // log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0d wins",
  556. // mapname3 , stepwin )
  557. g_vote_finished = true
  558. g_inprogress = false
  559. g_ForceChangeMap = false
  560. new c = get_cvar_num("mp_winlimit") - 2
  561. set_xvar_num(get_xvar_id("NEXTMAP_WINCOUNT"), min(c-g_teamScore[0],c-g_teamScore[1]))
  562.  
  563. ++g_extendCount
  564. // log_amx("Vote: Map %s will be extended %d time(s)", mapname3 , g_extendCount )
  565. client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT_HMT", mapname3 , g_extendCount )
  566. return
  567. }
  568.  
  569. if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] )
  570. set_cvar_string("amx_nextmap", g_mapVoteName[b])
  571.  
  572. new smap[32]
  573. get_cvar_string("amx_nextmap",smap,31)
  574. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 3)
  575. new Float:MapChangeTime = get_pcvar_float(pv_amx_rtv_map_time)
  576.  
  577. if (g_forceVote == true)
  578. {
  579. g_ForceChangeMap = true
  580. if (MapChangeTime < 5.0)
  581. MapChangeTime = 5.0
  582. else if (MapChangeTime > 500.0)
  583. MapChangeTime = 500.0
  584. if (!task_exists(6482257))
  585. set_task(MapChangeTime, "doMapChange", 6482257)
  586. }
  587.  
  588. client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
  589. // log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
  590.  
  591. g_vote_finished = true
  592. g_inprogress = false
  593. g_forceVote = false
  594. }
  595.  
  596. public countVote(id,key)
  597. {
  598. if(g_hasVoted[id])
  599. {
  600. return PLUGIN_HANDLED
  601. }
  602. g_hasVoted[id] = true
  603.  
  604. if ( get_cvar_float("amx_vote_answers") && (!g_vote_finished) )
  605. {
  606. new name[32]
  607. get_user_name(id,name,31)
  608. if(key == SELECTMAPS+1)
  609. {
  610. new nextMap[32]
  611. get_cvar_string("amx_nextmap", nextMap, 31)
  612. client_print(0, print_chat, "%L", LANG_PLAYER, "CHOSE_CURR_NEXT", name, nextMap)
  613. // log_amx("%L", LANG_SERVER, "CHOSE_CURR_NEXT", name, nextMap)
  614. }
  615. else if ( key == SELECTMAPS )
  616. {
  617. client_print(0,print_chat,"%L", LANG_PLAYER, "CHOSE_EXT", name )
  618. // log_amx("%L", LANG_SERVER, "CHOSE_EXT", name )
  619. }
  620. else if ( key < SELECTMAPS )
  621. {
  622. client_print(0,print_chat,"%L", LANG_PLAYER, "X_CHOSE_X", name, g_mapVoteName[key])
  623. // log_amx("%L", LANG_SERVER, "X_CHOSE_X", name, g_mapVoteName[key])
  624. }
  625. }
  626. ++g_voteCount[key]
  627. return PLUGIN_HANDLED
  628. }
  629.  
  630. bool:isInMenu(map[])
  631. {
  632. for(new a=0; a<g_mapVoteNum; ++a)
  633. if(equal(g_mapVoteName[a], map))
  634. return true
  635. return false
  636. }
  637.  
  638. public voteNextmap()
  639. {
  640. if (g_buyingtime)
  641. {
  642. return
  643. }
  644.  
  645. new timelimit = get_cvar_num("mp_timelimit")
  646. new maxrounds = get_cvar_num("mp_maxrounds")
  647. new winlimit = get_cvar_num("mp_winlimit")
  648.  
  649. if ((g_forceVote == false) && (g_rockthevote == false))
  650. {
  651. new mapchoosertype = get_pcvar_num(pv_amx_mapchooser_type)
  652. if (maxrounds > 0)
  653. {
  654. if (((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])) && (!g_call_say_vote) && (!g_inprogress))
  655. {
  656. set_xvar_num(get_xvar_id("NEXTMAP_ROUNDCOUNT"), (maxrounds - 2)-(g_teamScore[0] + g_teamScore[1]))
  657. g_selected = false
  658.  
  659. if ((mapchoosertype == 1) && ++g_nominationsHelpMsgIter >= NOMINATIONS_HELPMSG)
  660. {
  661. g_nominationsHelpMsgIter = 0
  662. set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  663. // show_hudmessage(0, "%L", LANG_PLAYER, "NOMINATE_MAP")
  664. }
  665.  
  666. if ((get_pcvar_num(pv_amx_rtv) > 0) && (g_nominationsHelpMsgIter + 6 == NOMINATIONS_HELPMSG) && (!g_hasbeenrocked))
  667. {
  668. set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  669. // show_hudmessage(0, "%L", LANG_PLAYER, "RTV_MAP")
  670. }
  671.  
  672. return
  673. }
  674. }
  675. else if (winlimit > 0)
  676. {
  677. new c = winlimit - 2
  678. if (((c > g_teamScore[0]) && (c > g_teamScore[1])) && (!g_call_say_vote) && (!g_inprogress))
  679. {
  680. set_xvar_num(get_xvar_id("NEXTMAP_WINCOUNT"), min(c-g_teamScore[0],c-g_teamScore[1]))
  681. g_selected = false
  682.  
  683. if (mapchoosertype == 1 && ++g_nominationsHelpMsgIter >= NOMINATIONS_HELPMSG)
  684. {
  685. g_nominationsHelpMsgIter = 0
  686. set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  687. // show_hudmessage(0, "%L", LANG_PLAYER, "NOMINATE_MAP")
  688. }
  689.  
  690. if ((get_pcvar_num(pv_amx_rtv) > 0) && (g_nominationsHelpMsgIter + 6 == NOMINATIONS_HELPMSG) && (!g_hasbeenrocked))
  691. {
  692. set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  693. // show_hudmessage(0, "%L", LANG_PLAYER, "RTV_MAP")
  694. }
  695.  
  696. return
  697. }
  698. }
  699. else
  700. {
  701. new timeleft = get_timeleft()
  702. if ((timeleft < 1 || timeleft > 129) && (!g_call_say_vote) && (!g_inprogress))
  703. {
  704. if (timeleft > 0)
  705. {
  706. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  707. new count = 1
  708. while((timeleft -= 15) > 129) ++count
  709. set_xvar_num(get_xvar_id("NEXTMAP_TIMECOUNT"), count*15)
  710. }
  711. g_selected = false
  712.  
  713. if (mapchoosertype == 1 && ++g_nominationsHelpMsgIter >= NOMINATIONS_HELPMSG)
  714. {
  715. g_nominationsHelpMsgIter = 0
  716. set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  717. // show_hudmessage(0, "%L", LANG_PLAYER, "NOMINATE_MAP")
  718. }
  719.  
  720. if ((get_pcvar_num(pv_amx_rtv) > 0) && (g_nominationsHelpMsgIter + 6 == NOMINATIONS_HELPMSG) && (!g_hasbeenrocked))
  721. {
  722. set_hudmessage(255, 255, 255, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  723. // show_hudmessage(0, "%L", LANG_PLAYER, "RTV_MAP")
  724. }
  725.  
  726. return
  727. }
  728. }
  729. }
  730.  
  731. if ((g_selected) && (!g_call_say_vote) && (!g_rockthevote))
  732. return
  733.  
  734. g_selected = true
  735. g_vote_finished = false
  736.  
  737. new menu[512], mapsmenu[512], a, mkeys, pos
  738. new dmax = ((g_mapsNum + g_nominMapsNum - 1) > SELECTMAPS) ? SELECTMAPS : (g_mapsNum + g_nominMapsNum - 1)
  739. new players[32], numplayers
  740. g_voteCount[SELECTMAPS] = 0
  741. g_voteCount[SELECTMAPS+1] = 0
  742.  
  743. new mapname[32]
  744. get_mapname(mapname, 31)
  745. new nextMap[32]
  746. get_cvar_string("amx_nextmap", nextMap, 31)
  747. new error_cnt = 0
  748.  
  749. // For small amount of players - maps_small.ini if amx_mapchooser_mapsloc is 0
  750.  
  751. if (get_cvar_num("amx_mapchooser_mapsloc") == 0)
  752. {
  753. if (get_playersnum() < 11)
  754. {
  755. new mapslocfile_s[32]
  756. new mapslocfile[32]
  757. new filename[128]
  758. new cfgdir[128]
  759. get_configsdir(cfgdir, 127)
  760.  
  761. get_cvar_string("amx_mapchooser_mapsfile_s", mapslocfile_s, 31)
  762. format(filename, 127, "%s/%s", cfgdir, mapslocfile_s)
  763. if (loadSettings(filename))
  764. log_message("[AMXX] - Nextmap Chooser 4: %s succesfully loaded.", mapslocfile_s)
  765. else if (g_mapsNum == 0)
  766. {
  767. get_cvar_string("amx_mapchooser_mapsfile", mapslocfile, 31)
  768. format(filename, 127, "%s/%s", cfgdir, mapslocfile)
  769. if (loadSettings(filename))
  770. log_message("[AMXX] - Nextmap Chooser 4: %s succesfully loaded instead %s.", mapslocfile, mapslocfile_s)
  771. else
  772. {
  773. get_cvar_string("mapcyclefile", filename, 63)
  774. if (loadSettings(filename))
  775. {
  776. log_message("[AMXX] - Nextmap Chooser 4: mapcycle succesfully loaded instead %s.", mapslocfile_s)
  777. }
  778. else
  779. {
  780. log_message("[AMXX] - Nextmap Chooser 4: Failed to loads maps from mapsfile. No maps loaded. ")
  781. }
  782. }
  783. }
  784. }
  785. }
  786.  
  787. // Build the maps entries and the valid keys (same for all players)
  788. mkeys = (1<<SELECTMAPS+1)
  789. mapsmenu[0] = '^0'
  790. pos = 0
  791. for(g_mapVoteNum = 0; g_mapVoteNum < dmax; ++g_mapVoteNum)
  792. {
  793. if(g_nominMapsNum > 0 && g_mapVoteNum < g_nominMapsNum)
  794. {
  795. copy(g_mapVoteName[g_mapVoteNum], 31, g_nominMapName[g_mapVoteNum])
  796. }
  797. else
  798. {
  799. a = random_num(0,g_mapsNum-1)
  800. while((equal(g_mapName[a], nextMap) || isInMenu(g_mapName[a])) && (error_cnt < 100))
  801. {
  802. if(++a >= g_mapsNum)
  803. a = 0
  804. error_cnt++
  805. }
  806. if (error_cnt < 100)
  807. copy(g_mapVoteName[g_mapVoteNum], 31, g_mapName[a])
  808. else
  809. {
  810. client_print(0,print_chat,"[DEBUG] Preparing the map menu error!")
  811. log_amx("[DEBUG] Preparing the map menu error!")
  812. }
  813. }
  814. pos += format(mapsmenu[pos], 511-pos, "%d. %s^n", g_mapVoteNum+1, g_mapVoteName[g_mapVoteNum])
  815. mkeys |= (1<<g_mapVoteNum)
  816. g_voteCount[g_mapVoteNum] = 0
  817. }
  818. mapsmenu[pos++] = '^n'
  819.  
  820. g_extend = false
  821. if (((winlimit + maxrounds) == 0) && (timelimit > 0) && (g_extendCount < get_cvar_num("amx_extendmap_max")))
  822. {
  823. mkeys |= (1<<SELECTMAPS)
  824. g_extend = true
  825. }
  826. if((timelimit == 0) && (maxrounds > 0) && (g_extendCount < get_cvar_num("amx_ext_round_max")))
  827. {
  828. mkeys |= (1<<SELECTMAPS)
  829. g_extend = true
  830. }
  831. if ((timelimit == 0) && (winlimit > 0) && (g_extendCount < get_cvar_num("amx_ext_win_max")))
  832. {
  833. mkeys |= (1<<SELECTMAPS)
  834. g_extend = true
  835. }
  836.  
  837. for(new i = 1; i <= g_maxplayers; ++i)
  838. {
  839. g_hasVoted[i] = false
  840. }
  841.  
  842. // Now build (translated) menu for each player and send it
  843. new menuid, tempkeys, player
  844. new votetime = get_pcvar_num(pv_amx_vote_time)
  845. get_players(players, numplayers, "c")
  846. for(numplayers--; numplayers >= 0; numplayers--)
  847. {
  848. player = players[numplayers]
  849. get_user_menu(player, menuid, tempkeys)
  850. if (tempkeys == 0 || menuid <= 0)
  851. {
  852. pos = format(menu,511,g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
  853. pos += format(menu[pos], 511-pos, "%s", mapsmenu)
  854. if (g_extend)
  855. {
  856. pos += format(menu[pos],511-pos,"%d. %L^n",SELECTMAPS+1,LANG_SERVER,"EXTEND_MAP",mapname)
  857. }
  858. format(menu[pos], 511-pos, "%d. %L", SELECTMAPS+2,LANG_SERVER,"KEEP_CURRENT_NEXTMAP", nextMap)
  859. show_menu(player, mkeys, menu, votetime, "AMX Choose nextmap:")
  860. }
  861. }
  862.  
  863. remove_task(1467853)
  864. new param[1]
  865. param[0] = 1
  866. set_task(CHECK_MENU_TIME, "check_menu", 1467853, param, 1)
  867.  
  868. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 2)
  869. set_task(get_pcvar_float(pv_amx_vote_time), "checkVotes")
  870. if (!g_call_say_vote && !g_rockthevote)
  871. {
  872. client_print(0,print_chat,"%L",LANG_SERVER,"TIME_CHOOSE")
  873. }
  874. client_cmd(0, "spk Gman/Gman_Choose2")
  875. g_call_say_vote = false
  876.  
  877. if (g_hasbeenrocked && g_rockthevote)
  878. g_rockthevote = false
  879.  
  880. // log_amx("Vote: Voting for the nextmap started")
  881. if (task_exists(987457)) remove_task(987457)
  882. }
  883.  
  884. public cmdVoteNextMap(id,level,cid)
  885. {
  886. if (!cmd_access(id,level,cid,1))
  887. return PLUGIN_HANDLED
  888.  
  889. if (get_xvar_num(get_xvar_id("NEXTMAP_MSG")) != 1 || g_forceVote == true)
  890. {
  891. console_print(id, "%L", LANG_PLAYER, "VOT_NOT_ALLOWED")
  892. return PLUGIN_HANDLED
  893. }
  894.  
  895. new arg[32]
  896. read_argv(1, arg, 31)
  897. g_forceVoteTime = str_to_num(arg)
  898. if (g_forceVoteTime < 2) g_forceVoteTime = 20
  899.  
  900. g_forceVote = true
  901. client_cmd(0, "slot10")
  902. set_task(5.0,"voteNextmap",987457)
  903. // voteNextmap()
  904.  
  905. new authid[32], name[32], ipaddress[24]
  906. get_user_authid(id, authid, 31)
  907. get_user_name(id, name, 31)
  908. get_user_ip(id, ipaddress, 23, 1)
  909. log_amx("VoteNextMap: ^"%s<%d><%s><%s>^" start the vote for the next map",name,get_user_userid(id),authid,ipaddress)
  910. switch(get_cvar_num("amx_show_activity"))
  911. {
  912. // case 3: print_to_admins("acdefghijklmnopqrstuvw", print_chat, _T("ADMIN %s: start the vote for the next map"), name)
  913. case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "X_START_VOTE", name)
  914. case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "START_VOTE", name)
  915. }
  916.  
  917. return PLUGIN_HANDLED
  918. }
  919.  
  920. public delayedChange(param[])
  921. {
  922. set_cvar_float("mp_timelimit", 40)
  923. server_cmd("changelevel %s", param)
  924. }
  925.  
  926. public doMapChange()
  927. {
  928. new string[32], current_map[32]
  929. new len = get_cvar_string("amx_nextmap", string, 31)
  930. get_mapname(current_map, 31)
  931. new modName[8]
  932. get_modname(modName, 7)
  933. if (!equal(current_map, string))
  934. {
  935. if (!equal(modName, "zp"))
  936. {
  937. message_begin(MSG_ALL, SVC_INTERMISSION)
  938. message_end()
  939. }
  940. set_task(1.0, "delayedChange", 0, string, len)
  941. }
  942. g_forceVote = false
  943. }
  944.  
  945. isLastMaps(map[])
  946. {
  947. g_MapHistory = get_pcvar_num(pv_amx_map_history)
  948.  
  949. if (g_MapHistory < 0)
  950. {
  951. g_MapHistory = 0
  952. set_pcvar_num(pv_amx_map_history, 0)
  953. }
  954. else if (g_MapHistory > MAP_HISTORY_MAX)
  955. {
  956. g_MapHistory = MAP_HISTORY_MAX
  957. set_pcvar_num(pv_amx_map_history, MAP_HISTORY_MAX)
  958. }
  959.  
  960. for (new i = 0; i < g_MapHistory; ++i)
  961. {
  962. if (equali(map, g_hist_mapName[i]))
  963. {
  964. return 1
  965. }
  966. }
  967. return 0
  968. }
  969.  
  970. public cmdListMaps(id)
  971. {
  972. if(get_pcvar_num(pv_amx_mapchooser_type) == 1)
  973. {
  974. new arg1[8]
  975. new start = read_argv(1, arg1, 7) ? str_to_num(arg1) : 1
  976. if (--start < 0) start = 0
  977. if (get_cvar_num("amx_nominfromfile") == 1)
  978. {
  979. if (start >= g_mapsNum) start = g_mapsNum - 1
  980. console_print(id, "%L", LANG_PLAYER, "MAPS_CAN_NOMIN")
  981. new end = start + LISTMAPAMOUNT
  982. if (end > g_mapsNum) end = g_mapsNum
  983. for(new i = start; i < end; ++i)
  984. {
  985. console_print(id, "%3d: %s", i+1, g_mapName[i])
  986. }
  987. console_print(id, "%L", LANG_PLAYER, "MAPS_NOMIN_LIST_OF", start+1, end, g_mapsNum)
  988. if (end < g_mapsNum)
  989. console_print(id, "%L", LANG_PLAYER, "USE_LISTMAPS_MORE", end+1)
  990. else
  991. console_print(id, "%L", LANG_PLAYER, "USE_LISTMAPS_BEGIN")
  992. }
  993. else
  994. {
  995. if (start >= g_mapsOnServerNum) start = g_mapsOnServerNum - 1
  996. console_print(id, "%L", LANG_PLAYER, "MAPS_CAN_NOMIN")
  997. new end = start + LISTMAPAMOUNT
  998. if (end > g_mapsOnServerNum) end = g_mapsOnServerNum
  999. new len, pos = 2, iter = 0, text[32]
  1000. while((pos = read_dir("maps", pos, text, 31, len)) && iter < end)
  1001. {
  1002. if (len <= 4 || (len > 4 && !equali(text[len-4], ".bsp", 4))) continue
  1003. text[len-4] = '^0'
  1004. if (is_map_valid(text))
  1005. {
  1006. if (iter >= start)
  1007. {
  1008. console_print(id, "%3d: %s", iter+1, text)
  1009. }
  1010. ++iter
  1011. }
  1012. }
  1013. console_print(id, "%L", LANG_PLAYER, "MAPS_NOMIN_LIST_OF", start+1, end, g_mapsOnServerNum)
  1014. if (end < g_mapsOnServerNum)
  1015. console_print(id, "%L", LANG_PLAYER, "USE_LISTMAPS_MORE", end+1)
  1016. else
  1017. console_print(id, "%L", LANG_PLAYER, "USE_LISTMAPS_BEGIN")
  1018. }
  1019. }
  1020. return PLUGIN_HANDLED
  1021. }
  1022.  
  1023. public listNominations(id)
  1024. {
  1025. if (get_pcvar_num(pv_amx_mapchooser_type) == 1)
  1026. {
  1027. new a = 0, message[512], len = 0
  1028. if (g_nominMapsNum > 0)
  1029. {
  1030. len = format(message, 511, "%L", id, "MAPS_NOMIN_FOR_VOTE")
  1031. new name[24]
  1032. while(a < g_nominMapsNum)
  1033. {
  1034. name[0] = '^0'
  1035. get_user_name(g_whoNominMapNum[a], name, 23)
  1036. len += format(message[len], 511-len, "%L", id, "MAPS_NOMIN_BY", g_nominMapName[a], name)
  1037. ++a
  1038. }
  1039. set_hudmessage(0, 150, 255, 0.01, 0.18, 0, 15.0, 12.0, 1.5, 3.75, 2)
  1040. show_hudmessage(id, message)
  1041. }
  1042. }
  1043. return PLUGIN_HANDLED
  1044. }
  1045.  
  1046. public handleSay(id)
  1047. {
  1048. new message[256]
  1049. read_args(message, 255)
  1050. remove_quotes(message)
  1051.  
  1052. if ((equali(message, "votenext", 8)) && (access(id, FLAG_AMX_VOTENEXTMAP)))
  1053. {
  1054.  
  1055. if (get_xvar_num(get_xvar_id("NEXTMAP_MSG")) != 1 || g_forceVote == true)
  1056. {
  1057. console_print(id, "%L", LANG_PLAYER, "VOT_NOT_ALLOWED")
  1058. return PLUGIN_HANDLED
  1059. }
  1060.  
  1061. new arg[32]
  1062. read_argv(1, arg, 31)
  1063. g_forceVoteTime = str_to_num(arg)
  1064. if (g_forceVoteTime < 2) g_forceVoteTime = 20
  1065.  
  1066. g_forceVote = true
  1067. client_cmd(0, "slot10")
  1068. set_task(5.0,"voteNextmap",987457)
  1069. // voteNextmap()
  1070.  
  1071. new authid[32], name[32], ipaddress[24]
  1072. get_user_authid(id, authid, 31)
  1073. get_user_name(id, name, 31)
  1074. get_user_ip(id, ipaddress, 23, 1)
  1075. log_amx("VoteNextMap: ^"%s<%d><%s><%s>^" start the vote for the next map",name,get_user_userid(id),authid,ipaddress)
  1076. switch(get_cvar_num("amx_show_activity"))
  1077. {
  1078. // case 3: print_to_admins("acdefghijklmnopqrstuvw", print_chat, _T("ADMIN %s: start the vote for the next map"), name)
  1079. case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "X_START_VOTE", name)
  1080. case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "START_VOTE", name)
  1081. }
  1082.  
  1083. return PLUGIN_HANDLED
  1084. }
  1085. else if ((equali(message, "rockthevote", 11)) || (equali(message, "rtv", 3)))
  1086. {
  1087. new Float:voting = get_pcvar_float(pv_amx_last_voting) + get_pcvar_float(pv_amx_vote_time)
  1088. if (( voting && (voting + get_pcvar_float(pv_amx_vote_delay) > get_gametime()) ) || g_buyingtime)
  1089. {
  1090. client_print(id, print_chat, "%L", LANG_PLAYER, "VOT_NOT_ALLOWED")
  1091. if ( voting && (voting + get_pcvar_float(pv_amx_vote_delay) > get_gametime()) )
  1092. client_print(id, print_chat, "You need to wait amx_vote_delay time.")
  1093. if (g_buyingtime)
  1094. client_print(id, print_chat, "Buying time (15s) not elapsed yet from the round start.")
  1095. return PLUGIN_CONTINUE
  1096. }
  1097. rock_the_vote(id)
  1098. return PLUGIN_CONTINUE
  1099. }
  1100. else if (get_pcvar_num(pv_amx_mapchooser_type) == 1)
  1101. {
  1102. if (containi(message, "<") != -1
  1103. || containi(message, "?") != -1
  1104. || containi(message, ">") != -1
  1105. || containi(message, "*") != -1
  1106. || containi(message, "&") != -1
  1107. || containi(message, ".") != -1
  1108. || containi(message, "/") != -1
  1109. || containi(message, "\") != -1
  1110. || containi(message, "!") != -1)
  1111. {
  1112. return PLUGIN_CONTINUE
  1113. }
  1114. if (equali(message, "nominations", 11))
  1115. {
  1116. if (get_xvar_num(get_xvar_id("NEXTMAP_MSG")) == 2)
  1117. {
  1118. client_print(id, print_chat, "%L", LANG_PLAYER, "VOTING_IN_PROGRESS")
  1119. }
  1120. else
  1121. {
  1122. if(!g_nominMapsNum)
  1123. client_print(id, print_chat, "%L", LANG_PLAYER, "NO_MAPS_NOMIN")
  1124. else
  1125. listNominations(id)
  1126. }
  1127. return PLUGIN_CONTINUE
  1128. }
  1129. else if (equali(message, "nominate ", 9))
  1130. {
  1131. handleNominate(id, message[9])
  1132. }
  1133. else if (equali(message, "vote ", 5))
  1134. {
  1135. handleNominate(id, message[5])
  1136. }
  1137. else if (is_map_valid(message))
  1138. {
  1139. nominateMap(id, message)
  1140. }
  1141. else
  1142. {
  1143. new mapname[32], saymap[29]
  1144. read_args(saymap, 28)
  1145. remove_quotes(saymap)
  1146. format(mapname,31, "aim_%s", saymap)
  1147. if (is_map_valid(mapname))
  1148. {
  1149. nominateMap(id, mapname)
  1150. return PLUGIN_CONTINUE
  1151. }
  1152. format(mapname, 31, "as_%s", saymap)
  1153. if (is_map_valid(mapname))
  1154. {
  1155. nominateMap(id, mapname)
  1156. return PLUGIN_CONTINUE
  1157. }
  1158. format(mapname, 31, "awp_%s", saymap)
  1159. if (is_map_valid(mapname))
  1160. {
  1161. nominateMap(id, mapname)
  1162. return PLUGIN_CONTINUE
  1163. }
  1164. format(mapname, 31, "cs_%s", saymap)
  1165. if (is_map_valid(mapname))
  1166. {
  1167. nominateMap(id, mapname)
  1168. return PLUGIN_CONTINUE
  1169. }
  1170. format(mapname, 31, "de_%s", saymap)
  1171. if (is_map_valid(mapname))
  1172. {
  1173. nominateMap(id, mapname)
  1174. return PLUGIN_CONTINUE
  1175. }
  1176. format(mapname, 31, "fy_%s", saymap)
  1177. if (is_map_valid(mapname))
  1178. {
  1179. nominateMap(id, mapname)
  1180. return PLUGIN_CONTINUE
  1181. }
  1182. format(mapname, 31, "he_%s", saymap)
  1183. if (is_map_valid(mapname))
  1184. {
  1185. nominateMap(id, mapname)
  1186. return PLUGIN_CONTINUE
  1187. }
  1188. format(mapname, 31, "ka_%s", saymap)
  1189. if (is_map_valid(mapname))
  1190. {
  1191. nominateMap(id, mapname)
  1192. return PLUGIN_CONTINUE
  1193. }
  1194. format(mapname, 31, "kz_%s", saymap)
  1195. if (is_map_valid(mapname))
  1196. {
  1197. nominateMap(id, mapname)
  1198. return PLUGIN_CONTINUE
  1199. }
  1200. format(mapname, 31, "dod_%s", saymap)
  1201. if (is_map_valid(mapname))
  1202. {
  1203. nominateMap(id, mapname)
  1204. return PLUGIN_CONTINUE
  1205. }
  1206. }
  1207. }
  1208. return PLUGIN_CONTINUE
  1209. }
  1210.  
  1211. public handleNominate(id,map[])
  1212. {
  1213. if (is_map_valid(map))
  1214. {
  1215. nominateMap(id, map)
  1216. }
  1217. else
  1218. {
  1219. new mapname[32]
  1220. format(mapname, 31, "aim_%s", map)
  1221. if (is_map_valid(mapname))
  1222. {
  1223. nominateMap(id, mapname)
  1224. return PLUGIN_HANDLED
  1225. }
  1226. format(mapname, 31, "as_%s", map)
  1227. if (is_map_valid(mapname))
  1228. {
  1229. nominateMap(id, mapname)
  1230. return PLUGIN_HANDLED
  1231. }
  1232. format(mapname, 31, "awp_%s", map)
  1233. if (is_map_valid(mapname))
  1234. {
  1235. nominateMap(id, mapname)
  1236. return PLUGIN_HANDLED
  1237. }
  1238. format(mapname, 31, "cs_%s", map)
  1239. if (is_map_valid(mapname))
  1240. {
  1241. nominateMap(id, mapname)
  1242. return PLUGIN_HANDLED
  1243. }
  1244. format(mapname, 31, "de_%s", map)
  1245. if (is_map_valid(mapname))
  1246. {
  1247. nominateMap(id, mapname)
  1248. return PLUGIN_HANDLED
  1249. }
  1250. format(mapname, 31, "fy_%s", map)
  1251. if (is_map_valid(mapname))
  1252. {
  1253. nominateMap(id, mapname)
  1254. return PLUGIN_HANDLED
  1255. }
  1256. format(mapname, 31, "he_%s", map)
  1257. if (is_map_valid(mapname))
  1258. {
  1259. nominateMap(id, mapname)
  1260. return PLUGIN_HANDLED
  1261. }
  1262. format(mapname, 31, "ka_%s", map)
  1263. if (is_map_valid(mapname))
  1264. {
  1265. nominateMap(id, mapname)
  1266. return PLUGIN_HANDLED
  1267. }
  1268. format(mapname, 31, "kz_%s", map)
  1269. if (is_map_valid(mapname))
  1270. {
  1271. nominateMap(id, mapname)
  1272. return PLUGIN_HANDLED
  1273. }
  1274. format(mapname, 31, "dod_%s", map)
  1275. if (is_map_valid(mapname))
  1276. {
  1277. nominateMap(id, mapname)
  1278. return PLUGIN_HANDLED
  1279. }
  1280. client_print(id, print_chat, "%L", LANG_PLAYER, "MAP_NOT_FOUND_LIST", map)
  1281. }
  1282. return PLUGIN_HANDLED
  1283. }
  1284.  
  1285. public nominateMap(id,map[])
  1286. {
  1287. strtolower(map)
  1288. new current_map[32]
  1289. new n = 0, i, done = 0, isreplacement = 0
  1290. get_mapname(current_map, 31)
  1291. new temp_nominMapNums = g_nominMapsNum
  1292. if (get_xvar_num(get_xvar_id("NEXTMAP_MSG")) == 2)
  1293. {
  1294. client_print(id, print_chat, "%L", LANG_PLAYER, "VOTING_IN_PROGRESS")
  1295. return PLUGIN_HANDLED
  1296. }
  1297. if (get_xvar_num(get_xvar_id("NEXTMAP_MSG")) == 3)
  1298. {
  1299. new nextmap[32]
  1300. get_cvar_string("amx_nextmap", nextmap, 31)
  1301. client_print(id, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", nextmap)
  1302. return PLUGIN_HANDLED
  1303. }
  1304. if (!is_map_valid(map))
  1305. {
  1306. client_print(id, print_chat, "%L", LANG_PLAYER, "MAP_NOT_FOUND_LIST", map)
  1307. return PLUGIN_HANDLED
  1308. }
  1309. if (isLastMaps(map) && !equali(map,current_map))
  1310. {
  1311. client_print(id, print_chat, "%L", LANG_PLAYER, "CANNOT_NOM_LAST_PLAYED", g_MapHistory)
  1312. return PLUGIN_HANDLED
  1313. }
  1314. if (equali(map,current_map))
  1315. {
  1316. client_print(id, print_chat, "%L", LANG_PLAYER, "X_CURR_MAP_EV_EXT", map)
  1317. return PLUGIN_HANDLED
  1318. }
  1319. new isinthelist = 0
  1320. if (get_cvar_num("amx_nominfromfile") == 1)
  1321. {
  1322. for (i = 0; i < g_mapsNum; ++i)
  1323. {
  1324. if (equali(map, g_mapName[i]))
  1325. {
  1326. isinthelist = 1
  1327. break
  1328. }
  1329. }
  1330. }
  1331. else
  1332. {
  1333. if (is_map_valid(map))
  1334. isinthelist = 1
  1335. }
  1336. if (!isinthelist)
  1337. {
  1338. client_print(id, print_chat, "%L", LANG_PLAYER, "NOM_CERTAIN_MAPS_ONLY")
  1339. return PLUGIN_HANDLED
  1340. }
  1341. new maxnom = get_cvar_num("amx_maxnominperplayer")
  1342. if (g_nominMapsNum >= SELECTMAPS || g_nominated[id] >= maxnom)
  1343. {
  1344. if (g_nominated[id] > maxnom)
  1345. {
  1346. client_print(id, print_chat, "%L", LANG_PLAYER, "NOMIN_TOO_MANY", maxnom)
  1347. return PLUGIN_HANDLED
  1348. }
  1349. new plname[32]
  1350. for(i = 0; i < g_nominMapsNum; ++i)
  1351. {
  1352. if (equali(map, g_nominMapName[i]))
  1353. {
  1354. get_user_name(g_whoNominMapNum[i], plname, 31)
  1355. client_print(id, print_chat, "%L", LANG_PLAYER, "MAP_ALREADY_NOMIN_BY", map, plname)
  1356. return PLUGIN_HANDLED
  1357. }
  1358. }
  1359. while(n < g_nominMapsNum && !done && g_nominated[id] > 1)
  1360. {
  1361. if (g_whoNominMapNum[n] == id)
  1362. {
  1363. g_nominated[id]--
  1364. g_nominMapsNum = n
  1365. done = 1
  1366. isreplacement = 1
  1367. }
  1368. ++n
  1369. }
  1370. if (!done)
  1371. {
  1372. n = 0
  1373. while(n < g_nominMapsNum && !done && g_nominated[id] > 0)
  1374. {
  1375. if(g_whoNominMapNum[n] == id)
  1376. {
  1377. g_nominated[id]--
  1378. g_nominMapsNum = n
  1379. done = 1
  1380. isreplacement = 1
  1381. }
  1382. ++n
  1383. }
  1384. }
  1385. if (!done)
  1386. {
  1387. client_print(id, print_chat, "%L", LANG_PLAYER, "MAXIM_NOMIN_REACHED", g_nominMapsNum)
  1388. return PLUGIN_HANDLED
  1389. }
  1390. }
  1391. new plname[32]
  1392. for(i = 0; i < g_nominMapsNum; ++i)
  1393. {
  1394. if (equali(map, g_nominMapName[i]))
  1395. {
  1396. get_user_name(g_whoNominMapNum[i], plname, 31)
  1397. client_print(id, print_chat, "%L", LANG_PLAYER, "MAP_ALREADY_NOMIN_BY", map, plname)
  1398. g_nominMapsNum = temp_nominMapNums
  1399. return PLUGIN_HANDLED
  1400. }
  1401. }
  1402. new name[32]
  1403. get_user_name(id, name, 31)
  1404. if (isreplacement == 1)
  1405. {
  1406. client_print(id, print_chat, "%L", LANG_PLAYER, "YOUR_NOMIN_REPLACED", g_nominMapName[g_nominMapsNum])
  1407. }
  1408. else if (isreplacement == 2)
  1409. {
  1410. client_print(0, print_chat, "%L", LANG_PLAYER, "THE_NOMIN_OF_X_REPLACED", g_nominMapName[g_nominMapsNum])
  1411. }
  1412. ++g_nominated[id]
  1413. console_print(id, "%L", LANG_PLAYER, "NOMIN_MAP_ADDED", map, g_nominMapsNum+1)
  1414. copy(g_nominMapName[g_nominMapsNum], 31, map)
  1415. g_whoNominMapNum[g_nominMapsNum] = id
  1416. if (isreplacement)
  1417. {
  1418. g_nominMapsNum = temp_nominMapNums
  1419. }
  1420. else
  1421. {
  1422. g_nominMapsNum = temp_nominMapNums + 1
  1423. }
  1424. client_print(0, print_chat, "%L", LANG_PLAYER, "X_NOMIN_MAP_SEE_LIST" , name, map)
  1425. return PLUGIN_HANDLED
  1426. }
  1427.  
  1428. load_history(filename[])
  1429. {
  1430. g_MapHistory = get_pcvar_num(pv_amx_map_history)
  1431.  
  1432. if (g_MapHistory < 0)
  1433. {
  1434. g_MapHistory = 0
  1435. set_pcvar_num(pv_amx_map_history, 0)
  1436. }
  1437. else if (g_MapHistory > MAP_HISTORY_MAX)
  1438. {
  1439. g_MapHistory = MAP_HISTORY_MAX
  1440. set_pcvar_num(pv_amx_map_history, MAP_HISTORY_MAX)
  1441. }
  1442.  
  1443. if (!file_exists(filename)) return 0
  1444.  
  1445. new a = 0
  1446. for (new pos = 0; pos < g_MapHistory; pos++)
  1447. read_file(filename,pos,g_hist_mapName[pos],31,a)
  1448.  
  1449. return 1
  1450. }
  1451.  
  1452. loadSettings(filename[])
  1453. {
  1454. if (!file_exists(filename)) return 0
  1455.  
  1456. g_mapsNum = 0
  1457. new szText[32]
  1458. new a = 0, pos = 0, i
  1459. new currentMap[32]
  1460. get_mapname(currentMap,31)
  1461.  
  1462. g_MapHistory = get_pcvar_num(pv_amx_map_history)
  1463.  
  1464. if (g_MapHistory < 0)
  1465. {
  1466. g_MapHistory = 0
  1467. set_pcvar_num(pv_amx_map_history, 0)
  1468. }
  1469. else if (g_MapHistory > MAP_HISTORY_MAX)
  1470. {
  1471. g_MapHistory = MAP_HISTORY_MAX
  1472. set_pcvar_num(pv_amx_map_history, MAP_HISTORY_MAX)
  1473. }
  1474.  
  1475. while(g_mapsNum < MAX_MAPS && (pos = read_file(filename, pos, szText, 31, a)))
  1476. {
  1477. if(!a || szText[0] == ';' || szText[0] == '/') continue
  1478.  
  1479. parse(szText, g_mapName[g_mapsNum], 31)
  1480.  
  1481. replace_all(g_mapName[g_mapsNum], 31, " ", "")
  1482. replace_all(g_mapName[g_mapsNum], 31, ".bsp", "")
  1483.  
  1484. if (is_map_valid(g_mapName[g_mapsNum])
  1485. && !equali(g_mapName[g_mapsNum], g_lastMap)
  1486. && !equali(g_mapName[g_mapsNum], currentMap))
  1487. {
  1488. ++g_mapsNum
  1489. for(i = 0; i < g_MapHistory; ++i)
  1490. {
  1491. if(equali(g_mapName[g_mapsNum-1], g_hist_mapName[i]))
  1492. {
  1493. --g_mapsNum
  1494. break
  1495. }
  1496. }
  1497. }
  1498. }
  1499.  
  1500. return g_mapsNum
  1501. }
  1502.  
  1503.  
  1504. loadMapsFolder()
  1505. {
  1506. g_mapsNum = 0
  1507.  
  1508. new len, pos = 2, i
  1509. new currentMap[32]
  1510. get_mapname(currentMap, 31)
  1511.  
  1512. g_MapHistory = get_pcvar_num(pv_amx_map_history)
  1513.  
  1514. if (g_MapHistory < 0)
  1515. {
  1516. g_MapHistory = 0
  1517. set_pcvar_num(pv_amx_map_history, 0)
  1518. }
  1519. else if (g_MapHistory > MAP_HISTORY_MAX)
  1520. {
  1521. g_MapHistory = MAP_HISTORY_MAX
  1522. set_pcvar_num(pv_amx_map_history, MAP_HISTORY_MAX)
  1523. }
  1524.  
  1525. while(g_mapsNum < MAX_MAPS && (pos = read_dir("maps/", pos, g_mapName[g_mapsNum], 31, len)))
  1526. {
  1527. if (len <= 4 || (len > 4 && !equali(g_mapName[g_mapsNum][len-4], ".bsp", 4))) continue
  1528.  
  1529. g_mapName[g_mapsNum][len-4] = '^0'
  1530. if (is_map_valid(g_mapName[g_mapsNum])
  1531. && !equali(g_mapName[g_mapsNum], g_lastMap)
  1532. && !equali(g_mapName[g_mapsNum], currentMap))
  1533. {
  1534. ++g_mapsNum
  1535. for(i = 0; i < g_MapHistory; ++i)
  1536. {
  1537. if (equali(g_mapName[g_mapsNum-1], g_hist_mapName[i]))
  1538. {
  1539. --g_mapsNum
  1540. break
  1541. }
  1542. }
  1543. }
  1544. }
  1545.  
  1546. return g_mapsNum
  1547. }
  1548.  
  1549. getMapsOnServerNum()
  1550. {
  1551. new len, pos = 2, text[32]
  1552. while((pos = read_dir("maps/", pos, text, 31, len)))
  1553. {
  1554. if (len <= 4 || (len > 4 && !equali(text[len-4], ".bsp", 4))) continue
  1555. text[len-4] = '^0'
  1556. if (is_map_valid(text))
  1557. {
  1558. ++g_mapsOnServerNum
  1559. }
  1560. }
  1561. // log_amx("Found %d maps in maps folder", g_mapsOnServerNum)
  1562. }
  1563.  
  1564. public team_score()
  1565. {
  1566. new team[2]
  1567. read_data(1, team, 1)
  1568. g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
  1569. new winlimit = get_cvar_num("mp_winlimit")
  1570. new maxrounds = get_cvar_num("mp_maxrounds")
  1571. if (maxrounds > 0)
  1572. {
  1573. if ((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]))
  1574. {
  1575. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  1576. set_xvar_num(get_xvar_id("NEXTMAP_ROUNDCOUNT"), (maxrounds - 2) - (g_teamScore[0] + g_teamScore[1]))
  1577. }
  1578. else
  1579. set_xvar_num(get_xvar_id("NEXTMAP_ROUNDCOUNT"), 0)
  1580. }
  1581. if (winlimit > 0)
  1582. {
  1583. new c = winlimit - 2
  1584. if ((c > g_teamScore[0]) && (c > g_teamScore[1]))
  1585. {
  1586. set_xvar_num(get_xvar_id("NEXTMAP_MSG"), 1)
  1587. set_xvar_num(get_xvar_id("NEXTMAP_WINCOUNT"), min(c-g_teamScore[0],c-g_teamScore[1]))
  1588. }
  1589. else
  1590. set_xvar_num(get_xvar_id("NEXTMAP_WINCOUNT"), 0)
  1591. }
  1592. }
  1593.  
  1594. public plugin_end()
  1595. {
  1596. new current_map[32]
  1597. get_mapname(current_map,31 )
  1598. set_localinfo("lastMap",current_map)
  1599.  
  1600. g_MapHistory = get_pcvar_num(pv_amx_map_history)
  1601.  
  1602. if (g_MapHistory < 0)
  1603. {
  1604. g_MapHistory = 0
  1605. set_pcvar_num(pv_amx_map_history, 0)
  1606. }
  1607. else if (g_MapHistory > MAP_HISTORY_MAX)
  1608. {
  1609. g_MapHistory = MAP_HISTORY_MAX
  1610. set_pcvar_num(pv_amx_map_history, MAP_HISTORY_MAX)
  1611. }
  1612.  
  1613.  
  1614. if ((file_exists(g_maphistFile)) && (g_MapHistory > 0))
  1615. {
  1616. new text[32]
  1617. new a = 0
  1618. // shift list up 1
  1619. for (new pos = 0; pos < g_MapHistory; pos++)
  1620. {
  1621. read_file(g_maphistFile,pos+1,text,31,a)
  1622. write_file(g_maphistFile,text,pos)
  1623. }
  1624. }
  1625. write_file(g_maphistFile,current_map,g_MapHistory-1)
  1626. }
  1627.  
  1628. public eNewRound()
  1629. {
  1630. if (!task_exists(987400))
  1631. {
  1632. set_task(1.0,"buyFinished",987400)
  1633. g_buyingtime = true
  1634. }
  1635. }
  1636.  
  1637. public eEndRound()
  1638. {
  1639. if (g_ForceChangeMap)
  1640. {
  1641. g_ForceChangeMap = false
  1642. if (task_exists(6482257)) remove_task(6482257)
  1643. doMapChange()
  1644. }
  1645. else
  1646. {
  1647. if (!task_exists(987400))
  1648. {
  1649. set_task(1.0,"buyFinished",987400)
  1650. }
  1651. g_buyingtime = true
  1652. }
  1653. }
  1654.  
  1655. public buyFinished()
  1656. {
  1657. g_buyingtime = false
  1658. return
  1659. }
  1660.  
  1661. public rock_the_vote(id)
  1662. {
  1663. new Float:rtv_percent = get_pcvar_float(pv_amx_rtv_percent)
  1664. new needed
  1665. new kName[32]
  1666. get_user_name(id,kName,31)
  1667. new timeleft = get_timeleft()
  1668. new Float:minutesplayed = get_gametime() / 60.0
  1669. new Float:wait = get_pcvar_float(pv_amx_rtv_min_time)
  1670. new Float:timelimit = get_cvar_float("mp_timelimit")
  1671. new maxrounds = get_cvar_num("mp_maxrounds")
  1672. new winlimit = get_cvar_num("mp_winlimit")
  1673.  
  1674. if (wait < 1.0)
  1675. wait = 1.0
  1676. else if (wait > 100.0)
  1677. wait = 100.0
  1678.  
  1679. if (rtv_percent < 0.03)
  1680. rtv_percent = 0.03
  1681. else if (rtv_percent > 1.00)
  1682. rtv_percent = 1.00
  1683.  
  1684. needed = floatround(float(g_active_players) * rtv_percent + 0.49)
  1685.  
  1686. if (get_pcvar_num(pv_amx_rtv) == 0)
  1687. {
  1688. client_print(id,print_chat,"%L",LANG_PLAYER,"RTV_DISABLED")
  1689. return
  1690. }
  1691. if (g_inprogress || task_exists(987457))
  1692. {
  1693. client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_BEGINNING")
  1694. return
  1695. }
  1696. if (g_selected || g_vote_finished)
  1697. {
  1698. new smap[32]
  1699. get_cvar_string("amx_nextmap",smap,31)
  1700. client_print(id,print_chat,"%L",LANG_PLAYER,"VOTING_COMPLETED",smap)
  1701. return
  1702. }
  1703. if (g_hasbeenrocked)
  1704. {
  1705. client_print(id,print_chat,"%L",LANG_PLAYER,"MAP_ALREADY_ROCKED")
  1706. return
  1707. }
  1708.  
  1709. if ((timeleft < 120) && (timelimit > 0.0))
  1710. {
  1711. if (timeleft < 1)
  1712. {
  1713. client_print(id,print_chat,"%L",LANG_PLAYER,"NOT_ENOUGH_TIME")
  1714. return
  1715. }
  1716. }
  1717.  
  1718. if (maxrounds > 0)
  1719. {
  1720. if ((maxrounds - 2) <= (g_teamScore[0] + g_teamScore[1]))
  1721. {
  1722. client_print(id,print_chat,"%L",LANG_PLAYER,"NOT_ENOUGH_TIME")
  1723. return
  1724. }
  1725. }
  1726.  
  1727. if (winlimit > 0)
  1728. {
  1729. new c = winlimit - 2
  1730. if ((c <= g_teamScore[0]) || (c <= g_teamScore[1]))
  1731. {
  1732. client_print(id,print_chat,"%L",LANG_PLAYER,"NOT_ENOUGH_TIME")
  1733. return
  1734. }
  1735. }
  1736.  
  1737. if ((minutesplayed + 0.5) < wait)
  1738. {
  1739. if (wait - 0.5 - minutesplayed > 0.0)
  1740. {
  1741. client_print(id,print_chat,"%L",LANG_PLAYER,"RTV_WAIT",
  1742. (floatround(wait + 0.5 - minutesplayed) > 0) ? (floatround(wait + 0.5 - minutesplayed)):(1))
  1743. }
  1744. else
  1745. {
  1746. client_print(id,print_chat,"%L",LANG_PLAYER,"RTV_1MIN")
  1747. }
  1748. return
  1749. }
  1750.  
  1751. if (!g_rocked[id])
  1752. {
  1753. g_rocked[id] = 1
  1754. g_rocks++
  1755. }
  1756. else
  1757. {
  1758. client_print(id,print_chat,"%L",LANG_PLAYER,"MAP_ALREADY_ROCKED")
  1759. return
  1760. }
  1761.  
  1762. if (g_rocks >= needed)
  1763. {
  1764. client_cmd(0, "slot10")
  1765. client_print(0,print_chat,"%L",LANG_PLAYER,"RTV_STARTING", g_rocks)
  1766. set_hudmessage(222, 70,0, -1.0, 0.70, 0, 1.0, 10.0, 0.1, 0.2, 4)
  1767. // show_hudmessage(0,"%L",LANG_PLAYER,"RTV_START",g_rocks )
  1768. g_hasbeenrocked = true
  1769. g_rockthevote = true
  1770. g_inprogress = true
  1771. g_vote_finished = false
  1772. set_task(15.0, "voteNextmap", 987457)
  1773.  
  1774. for(new i = 1; i < 33; ++i)
  1775. {
  1776. g_rocked[i] = 0
  1777. }
  1778. g_rocks = 0
  1779.  
  1780. g_forceVoteTime = 20
  1781. g_forceVote = true
  1782.  
  1783. new Float:vote_time2 = get_cvar_float("amx_vote_time") + 2.0
  1784. set_cvar_float("amx_last_voting", get_gametime() + vote_time2 )
  1785. }
  1786. else
  1787. client_print(0,print_chat,"%L",LANG_PLAYER,"RTV_NEEDED",(needed - g_rocks))
  1788. return
  1789. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement