Raised This Month: $51 Target: $400
 12% 

Map Voting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fean0r
Member
Join Date: Mar 2004
Location: Belfast, UK
Old 05-03-2004 , 06:57   Map Voting
Reply With Quote #1

I loved the old mapchooser OLO had where you could define the votes...

amx_nextmapch de_dust de_inferno de_aztec
amx_nextmapch cs_office cs_italy cs_assault

This was really useful for custom days we had on our server, would anyone be kind enough to make a new plugin that allowed you to define all the votes (then the script selects one of the vote options at random rather than random maps!)

This is OLO's old one...

Code:
/* AMX Mod script. * * (c) Copyright 2002-2003, OLO * This file is provided as is (no warranties). * */ #include <amxmod> #include <amxmisc> /* * On two minutes before the timelimit plugin * displays menu with 5 random maps to select. * One of the options is also map extending. * Map with most votes becomes the nextmap. * * Maps to selected are entered by amx_nextmapch server command: * amx_nextmapch <mapname> ... * * Cvars: * amx_extendmap_max <time in mins.> - max. time for overall extending * amx_extendmap_step <time in mins.> - with what time the map will be extended * * You can specify the map list f.e. in admin.cfg like    amx_nextmapch de_dust de_dust2 de_vegas de_storm de_nuke de_aztec    amx_nextmapch cs_militia de_prodigy cs_office de_piranesi    amx_nextmapch cs_italy de_cbble de_torn de_survivor cs_747 cs_assault    amx_nextmapch de_chateau cs_backalley cs_havana cs_thunder de_vertigo * * NOTE: Nextmap plugin is required for proper working of this plugin. *       Command amx_nextmapch can accept more than one map in command line. */ #define MAX_MAPS_AMOUNT 128 #define MAPS_TO_SELECET 5 new nmaps[MAX_MAPS_AMOUNT][32] new nmaps_num new bool:cstrike_running new nnextmaps[MAPS_TO_SELECET] new nvotes[MAPS_TO_SELECET+2] new nmapstoch new bool:mselected = false new logfilename[256] new teamscore[2] new last_map[32] public check_votes(){    new b = 0       for(new a = 0; a < nmapstoch; ++a)       if (nvotes[b] < nvotes[a])           b = a    if ( nvotes[MAPS_TO_SELECET] > nvotes[b] ) {       new mapname[32]       get_mapname(mapname,31)       new Float:steptime = get_cvar_float("amx_extendmap_step")       set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )              client_print(0,print_chat,"* Choosing finished. Current map will be extended to next %.0f minutes", steptime )       log_to_file(logfilename,"Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",           mapname , steptime )       return PLUGIN_HANDLED    }    if ( nvotes[b] && nvotes[MAPS_TO_SELECET+1] <= nvotes[b] )       set_cvar_string("amx_nextmap", nmaps[nnextmaps[b]] )    new smap[32]    get_cvar_string("amx_nextmap",smap,31)    client_print(0,print_chat,"* Choosing finished. The nextmap will be %s", smap )    log_to_file(logfilename,"Vote: Voting for the nextmap finished. The nextmap will be %s", smap)    return PLUGIN_HANDLED } public vote_count(id,key){    if ( get_cvar_float("amx_vote_answers") ) {       new name[32]       get_user_name(id,name,31)       if ( key == MAPS_TO_SELECET )          client_print(0,print_chat,"* %s chose map extending", name )       else if ( key < MAPS_TO_SELECET )          client_print(0,print_chat,"* %s chose %s", name, nmaps[nnextmaps[key]] )    }    ++nvotes[key]    return PLUGIN_HANDLED } bool:isinmenu(id){    for(new a=0; a<nmapstoch; ++a)       if (id==nnextmaps[a])          return true    return false } public askfornextmap(){         if (nmaps_num == 0){                 remove_task(987456)                 return PLUGIN_HANDLED         }         new mp_winlimit = get_cvar_num("mp_winlimit")         if (mp_winlimit){                 if ((mp_winlimit - 2) > (teamscore[0] + teamscore[1])){                         mselected = false                         return PLUGIN_HANDLED                 }         }         else {                 new timeleft = get_timeleft()                 if (timeleft<1||timeleft>129){                         mselected = false                         return PLUGIN_HANDLED                 }         }         if (mselected)                 return PLUGIN_HANDLED         mselected = true         new menu[512], a, mkeys = (1<<MAPS_TO_SELECET+1)         new pos = copy(menu,511,cstrike_running ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n")         new dmax = (nmaps_num > MAPS_TO_SELECET) ? MAPS_TO_SELECET : nmaps_num         for(nmapstoch = 0;nmapstoch<dmax;++nmapstoch){                 a=random_num(0,nmaps_num-1)                 while( isinmenu(a) )                         if (++a >= nmaps_num) a = 0                 nnextmaps[nmapstoch] = a                 pos += format(menu[pos],511,"%d. %s^n",nmapstoch+1,nmaps[a])                 mkeys |= (1<<nmapstoch)                 nvotes[nmapstoch] = 0         }         menu[pos++]='^n'         nvotes[MAPS_TO_SELECET] = 0         nvotes[MAPS_TO_SELECET+1] = 0            new mapname[32]         get_mapname(mapname,31)         if (!mp_winlimit && get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")){                 pos += format(menu[pos],511,"%d. Extend map %s^n",MAPS_TO_SELECET+1,mapname)                 mkeys |= (1<<MAPS_TO_SELECET)         }         format(menu[pos],511,"%d. None",MAPS_TO_SELECET+2)         show_menu(0,mkeys,menu,15)         set_task(15.0,"check_votes")         client_print(0,print_chat,"* It's time to choose the nextmap...")         client_cmd(0,"spk Gman/Gman_Choose2")         log_to_file(logfilename,"Vote: Voting for the nextmap started")         return PLUGIN_HANDLED } public addmaptolist(id,level,cid){         if (!cmd_access(id,level,cid,2))                 return PLUGIN_HANDLED         new arg[32], argcl = read_argc()         new current_map[32]         get_mapname(current_map,31)         for(new a = 1; a < argcl; ++a){                 read_argv(a,arg,31)                 if (is_map_valid(arg)){                         if (equali(arg,current_map) || equali(arg,last_map))                                 continue                         for(new i = 0; i < nmaps_num; ++i)                                 if (equali(arg,nmaps[i])){                                         console_print(id,"Map ^"%s^" is already in list",arg)                                         return PLUGIN_HANDLED                                 }                         copy(nmaps[nmaps_num++],31,arg)                 }                 else                         console_print(id,"Map ^"%s^" not found or is invalid",arg)         }         return PLUGIN_HANDLED } public team_score(){          new team[2]         read_data(1,team,1)         teamscore[ (team[0]=='C') ? 0 : 1 ] = read_data(2)         return PLUGIN_CONTINUE } public plugin_end(){         new current_map[32]         get_mapname(current_map,31)         set_localinfo("amx_lastmap",current_map)         return PLUGIN_CONTINUE } public plugin_init(){         register_plugin("Nextmap chooser","0.9.2","default")         register_srvcmd("amx_nextmapch","addmaptolist",0,"<mapname> ...")         register_menucmd(register_menuid("AMX Choose nextmap:"),(-1^(-1<<(MAPS_TO_SELECET+2))),"vote_count")         register_cvar("amx_extendmap_max","90")         register_cvar("amx_extendmap_step","15")         new mod_name[32]         get_modname(mod_name,31)         cstrike_running = equal(mod_name,"cstrike") ? true : false                 if (cstrike_running)                 register_event("TeamScore", "team_score", "a")                         set_task(15.0,"askfornextmap",987456,"",0,"b")         get_time("addons/amx/logs/admin%m%d.log",logfilename,255)         get_localinfo("amx_lastmap",last_map,31)         set_localinfo("amx_lastmap","")         return PLUGIN_CONTINUE }
__________________
Fean0r
Fean0r is offline
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 05-03-2004 , 10:22  
Reply With Quote #2

I dont know exactly what you want, but someone could make that above work for you, or you could use Deags' Map Manager located in the plugins forum, I think that might do the same thing that you wanted, if not just reply and I will compile OLO's plugin for you to work on AMXX.
__________________

BigBaller is offline
Fean0r
Member
Join Date: Mar 2004
Location: Belfast, UK
Old 05-03-2004 , 10:43  
Reply With Quote #3

I dont want that map manager as it does nt allow you to define the vote and the above plugin does nt work on amx or amxx (I dont know why though).
__________________
Fean0r
Fean0r is offline
Fean0r
Member
Join Date: Mar 2004
Location: Belfast, UK
Old 05-03-2004 , 10:49  
Reply With Quote #4

For example say I have everything the server load a map the below lines are triggered. (in the amxx.cfg)

amx_addvotemaps de_dust de_dust2 de_inferno
amx_addvotemaps cs_office cs_italy cs_assault
amx_addvotemaps fy_iceworld fy_pool_party fy_lame
amx_addvotemaps awp_city scouztknivez scoutzknivez2

Those lines could be added to votemaps.cfg then when the time comes for the vote the plugin will randomly select 1 line (1-4 in this case) from that .cfg and use that vote so that means I can decide what maps appear in what vote.
__________________
Fean0r
Fean0r is offline
mercury
Member
Join Date: Jun 2004
Old 06-25-2005 , 03:48  
Reply With Quote #5

this is great idea and revolutionary system of managing maps: groups of maps.

for example, if we have in one vote session de_aztec and cs_office, naturally, user's choice will be de_aztec, and as result cs_office never played. i think it's not good and de_aztec should appear among such maps as de_dust and de_dust2, etc.
mercury is offline
S@ndel
Junior Member
Join Date: Mar 2005
Old 10-03-2006 , 05:40   Re: Map Voting
Reply With Quote #6

UP
Great plugin, but didn't work
Compilation failed (
Quote:
//// mapchooser.sma
// \cstrike\addons\amxmodx\scripting\mapchooser. sma(39) : error 021: symbol already defined: "cstrike_running"
// \cstrike\addons\amxmodx\scripting\mapchooser. sma(115) : error 076: syntax error in the expression, or invalid function call
// \cstrike\addons\amxmodx\scripting\mapchooser. sma(192) : error 029: invalid expression, assumed zero
// \cstrike\addons\amxmodx\scripting\mapchooser. sma(194) : error 076: syntax error in the expression, or invalid function call
//
// 4 Errors.
// Could not locate output file compiled\mapchooser.amx (compile failed).
//
// Compilation Time: 0,27 sec
// ----------------------------------------
Some one can fix it ?
Or may be include this (amx_nextmapch * * * *...) in our standart mapchooser?

Sorry for my bad eng

Last edited by S@ndel; 10-03-2006 at 05:46.
S@ndel is offline
Send a message via ICQ to S@ndel
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode