Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

от 100 руб. Custom NextMap Chooser помогите...

, v1.4l (by Safety1st) от 100 руб.
Статус пользователя intercs
сообщение 28.5.2013, 20:35
Сообщение #1


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Ситуация следующая...
Есть плагин Custom NextMap Chooser с финальными доработками от v1.4l (by Safety1st) на оленях:
http://forums.alliedmods.net/showthread.ph...679&page=38

Очень понравился плагин тем, что когда в кваре "___" меньше игроков на сервере, то можно поставить в файле custom_nextmaps_small.ini номинацию маленьких карт, также это классно для ночного режима...
Все очень рады...

Но не работает такое, как запрет номинировать в чате предыдущие карты...
Игрался с кварами и ни в какую...

Подскажите где искать неточности?

КВАРЫ:
Скрытый текст
extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","15")
currentmap_pcvar = register_cvar("map_currentmap_show","1")
lastmap_pcvar = register_cvar("map_lastmap_show","1")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","1")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","40")
rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
lastmap_was_pcvar = register_cvar("qq_lastmap","1")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","1")
delay_time_pcvar = register_cvar("map_delay_time","5")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
amx_nextmap_pcvar = register_cvar("amx_nextmap","")


КОД:
Скрытый текст
Код:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-12
*
* ============
* Changelog:
* ============
*
* v1.4l (by Safety1st)
* - new: last round also for timelimit-based map change. No more waste of time!
* - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
* - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
* - fix: check for round-based limits before allow extending for CS&CZ only
* - change: ML support for last things: HUD & menu
* - change: annoncement HUD looks more pretty
* - new: separate ML records for mods that don't support UTF-8 in HUD
* v1.4k (by Safety1st)
* - new: third argument for amx_nextmap_vote to disable announcement before menu
* - fix: user-initiated map changing now works for mods without rounds
* - some fixes
* v1.4j (by Safety1st)
* - fix: proper ML dictionary using
* - new: colorchat support and separate version without one
* v1.4i (by Safety1st)
* - fix: now rtvtotal calculates correctly for second and subsequent votes
* - fix: if map cannot be nominated info message are showed to player but not to everyone
* - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

* v1.4h (by Safety1st)
* - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
* based on current players quantity: 'normal' or 'small'
* - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
* - fix: in case of no timelimit for map option 'Extend map' isn't showed
* - fix: after choosing nextmap players get correct message to their rtv
* - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
* - change: user-initiated map changing occurs at the end of round with a short delay
* - ! new: increase timelimit if it might elapse earlier than the current round
* - players can vote for 'Don't change map' in case of user-initiated rtv
* - new: added multilingual support (incomplete)
* - a few cosmetic changes
*
* v1.4g (by ~UN!CORN~)
* - Change map change method to change after round end.
*
* v1.4f (by ~UN!CORN~)
* - Added 3 custom files for map votes, depending on players and gungame status.
* - Added empty server map change in case if no one voted.
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED 20
#define MAX_TRIES 50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2 // 1 - change now, 0 - change at the end of limit or limit-based rtv
;new bool:lastround // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"votemap",
"/votemap",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}

new say_commands2[][32] =
{
"nominate",
"/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_dictionary("customnextmap.txt")
enabled_pcvar = register_cvar("map_enabled","1")

if(get_pcvar_num(enabled_pcvar))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")

cstrike = cstrike_running()
if(cstrike)
{
register_event("TeamScore", "team_score", "a")
register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
}

register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

set_task(15.0,"CheckLimits",1337,"",0,"b")

extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","15")
currentmap_pcvar = register_cvar("map_currentmap_show","1")
lastmap_pcvar = register_cvar("map_lastmap_show","1")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","1")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","40")
rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
lastmap_was_pcvar = register_cvar("qq_lastmap","1")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","1")
delay_time_pcvar = register_cvar("map_delay_time","5")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
amx_nextmap_pcvar = register_cvar("amx_nextmap","")

get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}

public plugin_cfg()
{
if(get_pcvar_num(enabled_pcvar))
{
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

mp_timelimit = get_cvar_pointer("mp_timelimit")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
g_coloredMenus = colored_menus()
}
}

public RoundEnd()
{
// it changes map only in case of user-initiated rtv
// AMXX nextmap base plugin takes care of limit-based change
if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
// freeze the game and show the scoreboard
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()

// change the map after "chattime" is over
set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}

public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED

if(!voting)
{
new arg1[8] = "1" // allow extend
new arg2[8] = "1" // change now
new arg3[8] = "1" // show announcement
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
if(read_argc()>=4)
{
read_argv(3,arg3,7)
}
}
}

client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

if(str_to_num(arg2)) voterocked2=true
else
{
voterocked2=false
lastround=false
}
make_menu(str_to_num(arg1),str_to_num(arg3))

}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

if(get_cvar_num("gg_enabled"))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
}
else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
}
else
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
}

for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")

format(menu,1999,"^n")

new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]

for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1

format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}

new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}

if(add_extend && cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
new maxrounds = get_pcvar_num(mp_maxrounds)
if(winlimit + maxrounds != 0)
add_extend=0
}

if(add_extend)
{
if (!voterocked2)
{
if(extended<get_pcvar_num(extended_pcvar))
{
new mapname[32]
get_mapname(mapname,31)
format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
keys |= (1<<8)
}
}
else
{
format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

if(show_announcement)
{
num = get_pcvar_num(delay_time_pcvar)
if(num>1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
}
}
else num=1

set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

voting=true
voterocked=-1.0
}

public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
//clear place
set_hudmessage(.channel=3)
show_hudmessage(0,"")
set_hudmessage(.channel=4)
show_hudmessage(0,"")

client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
return PLUGIN_HANDLED // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)

new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}

for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}

if(is_map_valid2(text)) return saynominate(id,text);

return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
else if(voterocked==-2.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
}
else
{
rtv[id]=true
rtvtotal++

new num2, players[32]
get_players(players,num2,"ch")

new name[32]
get_user_name(id,name,31)

new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

if(num3<=0)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
voterocked2=true
make_menu(1,1)
}
else
{
if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
}
}
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}

return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
}
else if(is_map_valid2(nom_map))
{
if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
return PLUGIN_CONTINUE
}

for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
return PLUGIN_CONTINUE
}
}

format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++

new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
}

return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;

return 0;
}

public CheckLimits()
{
if(voterocked==-1.0 || voterocked==-2.0)
return ;

new bool:continuea=false
lastround=true

if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
lastround=false
continuea=true
}
}

new maxrounds = get_pcvar_num(mp_maxrounds)

if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
lastround=false
continuea=true
}
}
}

new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
continuea=true

if(!continuea)
return ;

remove_task(1337)
voterocked2=false
make_menu(1,1)

return ;
}

public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar))
if (!voterocked2)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
else
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}

public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
if(!voterocked2)
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)

new ran
do {
ran = random_num( 1, 7 )
} while (!is_map_valid(maps[ran]))
format(cur_nextmap,31,"%s",maps[ran])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
lastround=false
voterocked=-2.0
}
else
{
voterocked=get_gametime()
voterocked2=false
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"CheckLimits",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
voterocked2=false
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
format(cur_nextmap,31,"%s",maps[winner[0]])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
voterocked=-2.0

if(cstrike)
{
if(voterocked2 || lastround)
{
new players[32],playerCnt
get_players(players,playerCnt,"ch")
if(playerCnt <= 1)
{
// at most there is only one player on the server, so no need to stay around
Delayb4ChangeMap()
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"LAST_ROUND")

// remove timelimit
set_pcvar_num(mp_timelimit,0)
}
}
}
else if(voterocked2)
set_task(4.5,"Delayb4ChangeMap")
}

for(new i=0;i<=32;i++) rtv[i]=false
rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}


И ещё подскажите... В какой строке надо что-то тыкнуть, чтобы плагин идеально сочетался и с КСДМ сервером, а то раунд бесконечный и последний рауд на КСДМ не бывает...

Отредактировал: intercs, - 1.6.2013, 21:58
Прикрепленные файлы:
Прикрепленный файл  Safet1st.rar ( 8,1 килобайт ) Кол-во скачиваний: 14
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя intercs
сообщение 28.5.2013, 22:20
Сообщение #2


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

up-)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Safety1st
сообщение 30.5.2013, 0:24
Сообщение #3
Стаж: 14 лет
Город: Moscow

Сообщений: 7228
Благодарностей: 8071
Полезность: 196

Код
currentmap_pcvar = register_cvar("map_currentmap_show","1")
lastmap_pcvar = register_cvar("map_lastmap_show","1")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","1")

Эти квары отвечают за показ в меню голосования и номинирование текущей и 2-х предыдущих карт. 0 надо ставить для запрета.

Цитата(intercs @ 28.5.2013, 22:35) *
В какой строке надо что-то тыкнуть, чтобы плагин идеально сочетался и с КСДМ сервером, а то раунд бесконечный и последний рауд на КСДМ не бывает...

Чтобы убрать 'последний раунд' нужно вместо
Код
        if(cstrike)
        {
            if(voterocked2 || lastround)
            {
                new players[32],playerCnt
                get_players(players,playerCnt,"ch")
                if(playerCnt <= 1)
                {
                    // at most there is only one player on the server, so no need to stay around
                    Delayb4ChangeMap()
                }
                else
                {
                    client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"LAST_ROUND")

                    // remove timelimit
                    set_pcvar_num(mp_timelimit,0)
                }
            }
        }
        else if(voterocked2)
            set_task(4.5,"Delayb4ChangeMap")

поставить
Код
        if(voterocked2)
            set_task(4.5,"Delayb4ChangeMap")
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 30.5.2013, 17:16
Сообщение #4


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Спасибо огромное ты как всегда не пожалел своего времени и очень точно ответил...

Т.е., я правильно понимаю?
currentmap_pcvar = register_cvar("map_currentmap_show","0")
lastmap_pcvar = register_cvar("map_lastmap_show","0")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")

Вроде работает...

А за что отвечают эти квары?
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")

amx_nextmap_pcvar = register_cvar("amx_nextmap","") И этот за что, что именно в него вписывать?

Отредактировал: intercs, - 30.5.2013, 18:35
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Safety1st
сообщение 30.5.2013, 19:50
Сообщение #5
Стаж: 14 лет
Город: Moscow

Сообщений: 7228
Благодарностей: 8071
Полезность: 196

Цитата(intercs @ 30.5.2013, 19:16) *
Т.е., я правильно понимаю?
currentmap_pcvar = register_cvar("map_currentmap_show","0")
lastmap_pcvar = register_cvar("map_lastmap_show","0")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")

Нет. В коде не нужно для этого ничего менять. Настройки плагинов задаются в amxx.cfg обычно. Нужно написать там:
Код
map_currentmap_show 0
map_lastmap_show 0
map_lastlastmap_show 0


Цитата(intercs @ 30.5.2013, 19:16) *
А за что отвечают эти квары?
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")

amx_nextmap_pcvar = register_cvar("amx_nextmap","") И этот за что, что именно в него вписывать?

Вписывать ничего не нужно. Эти cvar'ы не предназначены для настройки, только для внутреннего использования сервером.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 30.5.2013, 20:14
Сообщение #6


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Спасибо. Всё понял-)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 31.5.2013, 23:19
Сообщение #7


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

А можно ли не дать +100 рубей с позволения, с целью не делать примочку приватной, а ради примочки в паблик и сделать такое по возможности:

- Впаять в исходник ещё один новый квар "число игроков", что когда на сервере ещё меньше людей в течении 3-х минут, как в плагине no_players_map, то карта бы менялась на de_dust2_2x2 и ещё бы на ней безлимитное время? А там пусть пишут rtv или админ сменит, когда народу будет норм...

Я думаю тогда и изобретать ничего уже не надо будет и это будет самый лучший плагин по смене карт.

Вдруг пригодится для примочки:

No Players Map
Код:
#include <amxmodx>

new g_num, cv_clients, g_maxplayers

public plugin_init()
{
register_plugin("No Players Map", "0.1", "X-factor")
cv_clients = register_cvar("nomap_players", "12")
g_maxplayers = get_maxplayers()

set_task(180.0, "check_players", 0, _, _, "b") //через сколько после запуска сервера начинать проверку кол-ва игроков
}

public check_clients()
{
new id
g_num = 0

for (id = 1; id <= g_maxplayers; id++)
{
if (is_user_connected(id) && !is_user_hltv(id))
g_num++
}
return g_num
}

public check_players()
{
new currentMap[32]
new map[] = "de_dust2_2x2"
get_mapname(currentMap, 31)

if (check_clients() < get_pcvar_num(cv_clients) && !equali(map, currentMap))
{
set_task(30.0, "change_map", 0, map, charsmax(map))
client_print(0, print_chat, "[АВТО_СМЕНА_КАРТЫ] Мало игроков! Через 30 секунд карта сменится на %s!", map)
console_print(0, "[АВТО_СМЕНА_КАРТЫ] MaJIo urpokoB! KapTa ABToMaTu4ecku CMeHuTc9I! %s!", map)
}
return PLUGIN_CONTINUE
}

public change_map(map[])
{
server_cmd("changelevel %s", map)
}



А ПОКА НИЖЕ ВЫЛОЖУ ДЛЯ ВСЕХ ВОТ ЧТО:
ИСХОДНИК ДЛЯ ПАБЛИКА, ГДЕ НЕТ БЕСКОНЕЧНОГО РАУНДА:
Custom NextMap Chooser PUBLIC (ПОСЛЕДНИЙ РАУНД!!!)
Код
/*
*   _______     _      _  __          __
*  | _____/    | |    | | \ \   __   / /
*  | |         | |    | |  | | /  \ | |
*  | |         | |____| |  | |/ __ \| |
*  | |   ___   | ______ |  |   /  \   |
*  | |  |_  |  | |    | |  |  /    \  |
*  | |    | |  | |    | |  | |      | |
*  | |____| |  | |    | |  | |      | |
*  |_______/   |_|    |_|  \_/      \_/
*
*
*
*  Last Edited: 05-16-12
*
*  ============
*   Changelog:
*  ============
*
*  v1.4l (by Safety1st)
*    - new: last round also for timelimit-based map change. No more waste of time!
*    - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
*    - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
*    - fix: check for round-based limits before allow extending for CS&CZ only
*    - change: ML support for last things: HUD & menu
*    - change: annoncement HUD looks more pretty
*    - new: separate ML records for mods that don't support UTF-8 in HUD
*  v1.4k (by Safety1st)
*    - new: third argument for amx_nextmap_vote to disable announcement before menu
*    - fix: user-initiated map changing now works for mods without rounds
*    - some fixes
*  v1.4j (by Safety1st)
*    - fix: proper ML dictionary using
*    - new: colorchat support and separate version without one
*  v1.4i (by Safety1st)
*    - fix: now rtvtotal calculates correctly for second and subsequent votes
*    - fix: if map cannot be nominated info message are showed to player but not to everyone
*    - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

*  v1.4h (by Safety1st)
*    - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
*      based on current players quantity: 'normal' or 'small'
*    - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
*    - fix: in case of no timelimit for map option 'Extend map' isn't showed
*    - fix: after choosing nextmap players get correct message to their rtv
*    - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
*    - change: user-initiated map changing occurs at the end of round with a short delay
*    - ! new: increase timelimit if it might elapse earlier than the current round
*    - players can vote for 'Don't change map' in case of user-initiated rtv
*    - new: added multilingual support (incomplete)
*    - a few cosmetic changes
*
*  v1.4g (by ~UN!CORN~)
*    - Change map change method to change after round end.
*
*  v1.4f (by ~UN!CORN~)
*    - Added 3 custom files for map votes, depending on players and gungame status.
*    - Added empty server map change in case if no one voted.
*
*  v1.4e
*    -is_map_valid() broken, hardcoded a bug fix.
*
*  v1.4d
*    -Bug Fixes
*
*  v1.4c
*    -nominate command changed
*
*  v1.4b
*    -GG Compadability Beta
*
*  v1.4
*    -Added Nominating
*
*  v1.1 - 1.3
*    -Bug Fixes
*    -Added RTV
*
*  v1.0
*    -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED    20
#define MAX_TRIES    50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked    // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2    // 1 - change now, 0 - change at the end of limit or limit-based rtv
new bool:lastround    // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
    "rockthevote",
    "rock the vote",
    "votemap",
    "/votemap",
    "rtv",
    "/rockthevote",
    "/rock the vote",
    "/rtv"
}

new say_commands2[][32] =
{
    "nominate",
    "/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
    register_plugin(PLUGIN,VERSION,AUTHOR)
    register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    register_dictionary("customnextmap.txt")
    enabled_pcvar = register_cvar("map_enabled","1")

    if(get_pcvar_num(enabled_pcvar))
    {
        register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n     [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

        register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
        register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
        register_clcmd("say","say_hook")
        register_clcmd("say_team","say_hook")

        cstrike = cstrike_running()
        if(cstrike)
        {
            register_event("TeamScore", "team_score", "a")
            register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
        }

        register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

        set_task(15.0,"CheckLimits",1337,"",0,"b")

        extended_pcvar = register_cvar("map_extend_max","3")
        extendtime_pcvar = register_cvar("map_extend_time","15")
        currentmap_pcvar = register_cvar("map_currentmap_show","0")
        lastmap_pcvar = register_cvar("map_lastmap_show","0")
        lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")
        showvotes_pcvar = register_cvar("map_show_votes","1")
        rtv_percent_pcvar = register_cvar("map_rtv_percent","40")
        rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
        lastmap_was_pcvar = register_cvar("qq_lastmap","")
        lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
        delay_time_pcvar = register_cvar("map_delay_time","5")
        delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
        maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
        amx_nextmap_pcvar = register_cvar("amx_nextmap","")

        get_pcvar_string(lastmap_was_pcvar,lastmap,31)
        get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
        get_mapname(currentmap,31)
    }
}

public plugin_cfg()
{
    if(get_pcvar_num(enabled_pcvar))
    {
        if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

        mp_timelimit = get_cvar_pointer("mp_timelimit")
        if(cstrike)
        {
            mp_winlimit = get_cvar_pointer("mp_winlimit")
            mp_maxrounds = get_cvar_pointer("mp_maxrounds")
        }
        g_coloredMenus = colored_menus()
    }
}

public RoundEnd()
{
    // it changes map only in case of user-initiated rtv
    //  AMXX nextmap base plugin takes care of limit-based change
    if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
        set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
    // freeze the game and show the scoreboard
    message_begin(MSG_ALL, SVC_INTERMISSION)
    message_end()

    // change the map after "chattime" is over
    set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
    server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
    if(rtv[id])
    {
        rtv[id]=false
        has_nominated[id]=false
        rtvtotal--
    }
}

public cmd_nextmap(id,level,cid)
{
    if(!cmd_access(id,level,cid,1))
        return PLUGIN_HANDLED

    if(!voting)
    {
        new arg1[8] = "1"    // allow extend
        new arg2[8] = "1"    // change now
        new arg3[8] = "1"    // show announcement
        if(read_argc()>=2)
        {
            read_argv(1,arg1,7)
            if(read_argc()>=3)
            {
                read_argv(2,arg2,7)
                if(read_argc()>=4)
                {
                    read_argv(3,arg3,7)
                }
            }
        }

        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

        if(str_to_num(arg2)) voterocked2=true
        else
        {
            voterocked2=false
            lastround=false
        }
        make_menu(str_to_num(arg1),str_to_num(arg3))

    }
    else
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
    }
    return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

    if(get_cvar_num("gg_enabled"))
    {
        get_configsdir(configfile,199)
        format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
    }
    else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
    {
        get_configsdir(configfile,199)
        format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
    }
    else
    {
        get_configsdir(configfile,199)
        format(configfile,199,"%s/custom_nextmaps.ini",configfile)
    }

    for(new i=0;i<10;i++) votes[i]=0
    for(new i=0;i<9;i++) format(maps[i],31,"")

    format(menu,1999,"^n")

    new Fsize = file_size(configfile,1)
    new read[32], trash, string[8]
    new numbers[17]

    for(new i=1;i<9;i++)
    {
        numbers[i]=0
        numbers[17-i]=0
        for(new i2=0;i2<Fsize;i2++)
        {
            read_file(configfile,i2,read,31,trash)
            format(string,7,"[%d]",i)
            if(equali(read,string)) numbers[i]=i2+1
                
            format(string,7,"[/%d]",i)
            if(equali(read,string)) numbers[17-i]=i2-1
        }
    }

    new tries
    keys = (1<<9)
    new j
    for(new i=1;i<9;i++)
    {
        format(maps[i],31,"")
        if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
        {
            tries=0
            while(tries<MAX_TRIES)
            {
                read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
                if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
                if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
                {
                    for(j=1;j<i;j++)
                    {
                        if(equali(read,maps[j]))
                        {
                            j = 0
                            break;
                        }
                    }
                    if(!j) break;
                    format(maps[i],31,"%s",read)
                    format(menu,1999,"%s^n%d. %s",menu,i,read)
                    switch(i)
                    {
                        case 1: keys |= (1<<0)
                        case 2: keys |= (1<<1)
                        case 3: keys |= (1<<2)
                        case 4: keys |= (1<<3)
                        case 5: keys |= (1<<4)
                        case 6: keys |= (1<<5)
                        case 7: keys |= (1<<6)
                        case 8: keys |= (1<<7)
                    }
                    break;
                }
                tries++
            }
        }
    }

    if(add_extend && cstrike)
    {
        new winlimit = get_pcvar_num(mp_winlimit)
        new maxrounds = get_pcvar_num(mp_maxrounds)
        if(winlimit + maxrounds != 0)
            add_extend=0
    }
    
    if(add_extend)
    {
        if (!voterocked2)
        {
            if(extended<get_pcvar_num(extended_pcvar))
            {
                new mapname[32]
                get_mapname(mapname,31)
                format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
                keys |= (1<<8)
            }
        }
        else
        {
            format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
            keys |= (1<<8)
        }
    }
    format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

    if(show_announcement)
    {
        num = get_pcvar_num(delay_time_pcvar)
        if(num>1)
        {
            set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
            show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

            set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
            show_hudmessage(0,menu)
        }
    }
    else num=1

    set_task(1.0,"Send_Menu",0,"",0,"a",num)
    set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

    voting=true
    voterocked=-1.0
}

public Send_Menu()
{
    if(num!=1)
    {
        set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
        show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

        set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
        show_hudmessage(0,menu)
        num--
    }
    else
    {
        //clear place
        set_hudmessage(.channel=3)
        show_hudmessage(0,"")
        set_hudmessage(.channel=4)
        show_hudmessage(0,"")
        
        client_cmd(0,"spk Gman/Gman_Choose2")
        format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
        show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
    }
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
    if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
    else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
    return PLUGIN_HANDLED    // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
    new text[64]
    read_args(text,63)
    remove_quotes(text)

    new string[32]
    for(new i=0;i<sizeof(say_commands);i++)
    {
        format(string,31,"%s",say_commands[i])
        if(containi(text,string)==0) return sayrockthevote(id);
    }

    for(new i=0;i<sizeof(say_commands2);i++)
    {
        format(string,31,"%s ",say_commands2[i])
        if(containi(text,string)==0)
        {
            replace(text,63,string,"")
            return saynominate(id,text);
        }
    }

    if(is_map_valid2(text)) return saynominate(id,text);

    return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
    if(voterocked==-1.0)
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
    }
    else if(voterocked==-2.0)
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
    }
    else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
    {
        if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
        {
            if(rtv[id])
            {
                client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
            }
            else
            {
                rtv[id]=true
                rtvtotal++

                new num2, players[32]
                get_players(players,num2,"ch")

                new name[32]
                get_user_name(id,name,31)

                new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

                if(num3<=0)
                {
                    client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
                    client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
                    voterocked2=true
                    make_menu(1,1)
                }
                else
                {
                    if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
                    else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
                }
            }
        }
        else
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
        }
    }
    else if(voterocked>0.0)
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
    }
    else
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
    }

    return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
    if(has_nominated[id])
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
    }
    else if(is_map_valid2(nom_map))
    {
        if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
            return PLUGIN_CONTINUE
        }
        else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
            return PLUGIN_CONTINUE
        }
        else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
            return PLUGIN_CONTINUE
        }

        for(new i=0;i<num_nominated;i++)
        {
            if(equali(nominated[i],nom_map))
            {
                client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
                return PLUGIN_CONTINUE
            }
        }

        format(nominated[num_nominated],31,"%s",nom_map)
        num_nominated++

        new name[32]
        get_user_name(id,name,31)
        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
        has_nominated[id] = true
    }
    else
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
    }

    return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
    if(is_map_valid(map) &&
    containi(map,"<")==-1 &&
    containi(map,"\")==-1 &&
    containi(map,"/")==-1 &&
    containi(map,">")==-1 &&
    containi(map,"?")==-1 &&
    containi(map,"|")==-1 &&
    containi(map,"*")==-1 &&
    containi(map,":")==-1 &&
    containi(map,"^"")==-1
    )
        return 1;

    return 0;
}

public CheckLimits()
{
    if(voterocked==-1.0 || voterocked==-2.0)
        return;

    new bool:continuea=false
    lastround=true

    if(cstrike)
    {
        new winlimit = get_pcvar_num(mp_winlimit)
        if(winlimit)
        {
            new c = winlimit - 2
            if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
            {
                lastround=false
                continuea=true
            }
        }

        new maxrounds = get_pcvar_num(mp_maxrounds)
    
        if(maxrounds)
        {
            if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
            {
                lastround=false
                continuea=true
            }
        }
    }

    new timeleft = get_timeleft()
    if(!(timeleft < 1 || timeleft > 129))
        continuea=true

    if(!continuea)
        return;

    remove_task(1337)
    voterocked2=false
    make_menu(1,1)

    return;
}

public VoteCount(id,key)
{
    if(voting)
    {
        new name[32]
        get_user_name(id,name,31)
        if(key==8)
        {
            if(get_pcvar_num(showvotes_pcvar))
            if (!voterocked2)
                client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
            else
                client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
            votes[9]++
        }
        else if(key==9)
        {
            if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
        }
        else if(strlen(maps[key+1]))
        {
            if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
            votes[key+1]++
        }
        else
        {
            show_menu(id,keys,menu,-1,"CustomNextMap")
        }
    }
    return PLUGIN_HANDLED
}

public VoteTally(num)
{
    voting=false
    new winner[2]
    for(new i=1;i<10;i++)
    {
        if(votes[i]>winner[1])
        {
            winner[0]=i
            winner[1]=votes[i]
        }
        votes[i]=0
    }
    if(!winner[1])
    {
        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
        if(!voterocked2)
        {
            new mapname[32]
            get_pcvar_string(lastmap_was_pcvar,mapname,31)
            set_pcvar_string(lastlastmap_was_pcvar,mapname)
            get_mapname(mapname,31)
            set_pcvar_string(lastmap_was_pcvar,mapname)
            
            new ran
            do {
            ran = random_num( 1, 7 )
            } while (!is_map_valid(maps[ran]))
            format(cur_nextmap,31,"%s",maps[ran])
            client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
            set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
            lastround=false
            voterocked=-2.0
        }
        else
        {
            voterocked=get_gametime()
            voterocked2=false
        }
    }
    else if(winner[0]==9)
    {
        if(!voterocked2)
        {
            client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
            set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
            set_task(15.0,"CheckLimits",1337,"",0,"b")
            extended++
        }
        else
        {
            client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
            voterocked2=false
        }
        voterocked=get_gametime()
    }
    else
    {
        new mapname[32]
        get_pcvar_string(lastmap_was_pcvar,mapname,31)
        set_pcvar_string(lastlastmap_was_pcvar,mapname)
        get_mapname(mapname,31)
        set_pcvar_string(lastmap_was_pcvar,mapname)
        format(cur_nextmap,31,"%s",maps[winner[0]])
        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
        set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
        voterocked=-2.0
        
        if(cstrike)
        {
            if(voterocked2 || lastround)
            {
                new players[32],playerCnt
                get_players(players,playerCnt,"ch")
                if(playerCnt <= 1)
                {
                    // at most there is only one player on the server, so no need to stay around
                    Delayb4ChangeMap()
                }
                else
                {
                    client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"LAST_ROUND")

                    // remove timelimit
                    set_pcvar_num(mp_timelimit,0)
                }
            }
        }
        else if(voterocked2)
            set_task(4.5,"Delayb4ChangeMap")
    }
    
    for(new i=0;i<=32;i++) rtv[i]=false
    rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
    new team[2]
    read_data(1,team,1)
    g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}


ИСХОДНИК ДЛЯ КСДМ СЕРВЕРОВ, ГДЕ ЕСТЬ БЕСКОНЕЧНЫЙ РАУНД:
Custom NextMap Chooser CSDM (после выбора карты ещё продолжается игра 2 минуты и карта сменится - для серверов с бесконечными раундами)
Код
/*
*   _______     _      _  __          __
*  | _____/    | |    | | \ \   __   / /
*  | |         | |    | |  | | /  \ | |
*  | |         | |____| |  | |/ __ \| |
*  | |   ___   | ______ |  |   /  \   |
*  | |  |_  |  | |    | |  |  /    \  |
*  | |    | |  | |    | |  | |      | |
*  | |____| |  | |    | |  | |      | |
*  |_______/   |_|    |_|  \_/      \_/
*
*
*
*  Last Edited: 05-16-12
*
*  ============
*   Changelog:
*  ============
*
*  v1.4l (by Safety1st)
*    - new: last round also for timelimit-based map change. No more waste of time!
*    - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
*    - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
*    - fix: check for round-based limits before allow extending for CS&CZ only
*    - change: ML support for last things: HUD & menu
*    - change: annoncement HUD looks more pretty
*    - new: separate ML records for mods that don't support UTF-8 in HUD
*  v1.4k (by Safety1st)
*    - new: third argument for amx_nextmap_vote to disable announcement before menu
*    - fix: user-initiated map changing now works for mods without rounds
*    - some fixes
*  v1.4j (by Safety1st)
*    - fix: proper ML dictionary using
*    - new: colorchat support and separate version without one
*  v1.4i (by Safety1st)
*    - fix: now rtvtotal calculates correctly for second and subsequent votes
*    - fix: if map cannot be nominated info message are showed to player but not to everyone
*    - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

*  v1.4h (by Safety1st)
*    - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
*      based on current players quantity: 'normal' or 'small'
*    - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
*    - fix: in case of no timelimit for map option 'Extend map' isn't showed
*    - fix: after choosing nextmap players get correct message to their rtv
*    - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
*    - change: user-initiated map changing occurs at the end of round with a short delay
*    - ! new: increase timelimit if it might elapse earlier than the current round
*    - players can vote for 'Don't change map' in case of user-initiated rtv
*    - new: added multilingual support (incomplete)
*    - a few cosmetic changes
*
*  v1.4g (by ~UN!CORN~)
*    - Change map change method to change after round end.
*
*  v1.4f (by ~UN!CORN~)
*    - Added 3 custom files for map votes, depending on players and gungame status.
*    - Added empty server map change in case if no one voted.
*
*  v1.4e
*    -is_map_valid() broken, hardcoded a bug fix.
*
*  v1.4d
*    -Bug Fixes
*
*  v1.4c
*    -nominate command changed
*
*  v1.4b
*    -GG Compadability Beta
*
*  v1.4
*    -Added Nominating
*
*  v1.1 - 1.3
*    -Bug Fixes
*    -Added RTV
*
*  v1.0
*    -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED    20
#define MAX_TRIES    50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked    // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2    // 1 - change now, 0 - change at the end of limit or limit-based rtv
new bool:lastround    // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
    "rockthevote",
    "rock the vote",
    "votemap",
    "/votemap",
    "rtv",
    "/rockthevote",
    "/rock the vote",
    "/rtv"
}

new say_commands2[][32] =
{
    "nominate",
    "/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
    register_plugin(PLUGIN,VERSION,AUTHOR)
    register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    register_dictionary("customnextmap.txt")
    enabled_pcvar = register_cvar("map_enabled","1")

    if(get_pcvar_num(enabled_pcvar))
    {
        register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n     [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

        register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
        register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
        register_clcmd("say","say_hook")
        register_clcmd("say_team","say_hook")

        cstrike = cstrike_running()
        if(cstrike)
        {
            register_event("TeamScore", "team_score", "a")
            register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
        }

        register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

        set_task(15.0,"CheckLimits",1337,"",0,"b")

        extended_pcvar = register_cvar("map_extend_max","3")
        extendtime_pcvar = register_cvar("map_extend_time","15")
        currentmap_pcvar = register_cvar("map_currentmap_show","0")
        lastmap_pcvar = register_cvar("map_lastmap_show","0")
        lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")
        showvotes_pcvar = register_cvar("map_show_votes","1")
        rtv_percent_pcvar = register_cvar("map_rtv_percent","37")
        rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
        lastmap_was_pcvar = register_cvar("qq_lastmap","")
        lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
        delay_time_pcvar = register_cvar("map_delay_time","5")
        delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
        maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
        amx_nextmap_pcvar = register_cvar("amx_nextmap","")

        get_pcvar_string(lastmap_was_pcvar,lastmap,31)
        get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
        get_mapname(currentmap,31)
    }
}

public plugin_cfg()
{
    if(get_pcvar_num(enabled_pcvar))
    {
        if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

        mp_timelimit = get_cvar_pointer("mp_timelimit")
        if(cstrike)
        {
            mp_winlimit = get_cvar_pointer("mp_winlimit")
            mp_maxrounds = get_cvar_pointer("mp_maxrounds")
        }
        g_coloredMenus = colored_menus()
    }
}

public RoundEnd()
{
    // it changes map only in case of user-initiated rtv
    //  AMXX nextmap base plugin takes care of limit-based change
    if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
        set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
    // freeze the game and show the scoreboard
    message_begin(MSG_ALL, SVC_INTERMISSION)
    message_end()

    // change the map after "chattime" is over
    set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
    server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
    if(rtv[id])
    {
        rtv[id]=false
        has_nominated[id]=false
        rtvtotal--
    }
}

public cmd_nextmap(id,level,cid)
{
    if(!cmd_access(id,level,cid,1))
        return PLUGIN_HANDLED

    if(!voting)
    {
        new arg1[8] = "1"    // allow extend
        new arg2[8] = "1"    // change now
        new arg3[8] = "1"    // show announcement
        if(read_argc()>=2)
        {
            read_argv(1,arg1,7)
            if(read_argc()>=3)
            {
                read_argv(2,arg2,7)
                if(read_argc()>=4)
                {
                    read_argv(3,arg3,7)
                }
            }
        }

        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

        if(str_to_num(arg2)) voterocked2=true
        else
        {
            voterocked2=false
            lastround=false
        }
        make_menu(str_to_num(arg1),str_to_num(arg3))

    }
    else
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
    }
    return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

    if(get_cvar_num("gg_enabled"))
    {
        get_configsdir(configfile,199)
        format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
    }
    else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
    {
        get_configsdir(configfile,199)
        format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
    }
    else
    {
        get_configsdir(configfile,199)
        format(configfile,199,"%s/custom_nextmaps.ini",configfile)
    }

    for(new i=0;i<10;i++) votes[i]=0
    for(new i=0;i<9;i++) format(maps[i],31,"")

    format(menu,1999,"^n")

    new Fsize = file_size(configfile,1)
    new read[32], trash, string[8]
    new numbers[17]

    for(new i=1;i<9;i++)
    {
        numbers[i]=0
        numbers[17-i]=0
        for(new i2=0;i2<Fsize;i2++)
        {
            read_file(configfile,i2,read,31,trash)
            format(string,7,"[%d]",i)
            if(equali(read,string)) numbers[i]=i2+1
                
            format(string,7,"[/%d]",i)
            if(equali(read,string)) numbers[17-i]=i2-1
        }
    }

    new tries
    keys = (1<<9)
    new j
    for(new i=1;i<9;i++)
    {
        format(maps[i],31,"")
        if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
        {
            tries=0
            while(tries<MAX_TRIES)
            {
                read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
                if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
                if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
                {
                    for(j=1;j<i;j++)
                    {
                        if(equali(read,maps[j]))
                        {
                            j = 0
                            break;
                        }
                    }
                    if(!j) break;
                    format(maps[i],31,"%s",read)
                    format(menu,1999,"%s^n%d. %s",menu,i,read)
                    switch(i)
                    {
                        case 1: keys |= (1<<0)
                        case 2: keys |= (1<<1)
                        case 3: keys |= (1<<2)
                        case 4: keys |= (1<<3)
                        case 5: keys |= (1<<4)
                        case 6: keys |= (1<<5)
                        case 7: keys |= (1<<6)
                        case 8: keys |= (1<<7)
                    }
                    break;
                }
                tries++
            }
        }
    }

    if(add_extend && cstrike)
    {
        new winlimit = get_pcvar_num(mp_winlimit)
        new maxrounds = get_pcvar_num(mp_maxrounds)
        if(winlimit + maxrounds != 0)
            add_extend=0
    }
    
    if(add_extend)
    {
        if (!voterocked2)
        {
            if(extended<get_pcvar_num(extended_pcvar))
            {
                new mapname[32]
                get_mapname(mapname,31)
                format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
                keys |= (1<<8)
            }
        }
        else
        {
            format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
            keys |= (1<<8)
        }
    }
    format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

    if(show_announcement)
    {
        num = get_pcvar_num(delay_time_pcvar)
        if(num>1)
        {
            set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
            show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

            set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
            show_hudmessage(0,menu)
        }
    }
    else num=1

    set_task(1.0,"Send_Menu",0,"",0,"a",num)
    set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

    voting=true
    voterocked=-1.0
}

public Send_Menu()
{
    if(num!=1)
    {
        set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
        show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

        set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
        show_hudmessage(0,menu)
        num--
    }
    else
    {
        //clear place
        set_hudmessage(.channel=3)
        show_hudmessage(0,"")
        set_hudmessage(.channel=4)
        show_hudmessage(0,"")
        
        client_cmd(0,"spk Gman/Gman_Choose2")
        format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
        show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
    }
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
    if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
    else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
    return PLUGIN_HANDLED    // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
    new text[64]
    read_args(text,63)
    remove_quotes(text)

    new string[32]
    for(new i=0;i<sizeof(say_commands);i++)
    {
        format(string,31,"%s",say_commands[i])
        if(containi(text,string)==0) return sayrockthevote(id);
    }

    for(new i=0;i<sizeof(say_commands2);i++)
    {
        format(string,31,"%s ",say_commands2[i])
        if(containi(text,string)==0)
        {
            replace(text,63,string,"")
            return saynominate(id,text);
        }
    }

    if(is_map_valid2(text)) return saynominate(id,text);

    return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
    if(voterocked==-1.0)
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
    }
    else if(voterocked==-2.0)
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
    }
    else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
    {
        if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
        {
            if(rtv[id])
            {
                client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
            }
            else
            {
                rtv[id]=true
                rtvtotal++

                new num2, players[32]
                get_players(players,num2,"ch")

                new name[32]
                get_user_name(id,name,31)

                new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

                if(num3<=0)
                {
                    client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
                    client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
                    voterocked2=true
                    make_menu(1,1)
                }
                else
                {
                    if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
                    else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
                }
            }
        }
        else
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
        }
    }
    else if(voterocked>0.0)
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
    }
    else
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
    }

    return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
    if(has_nominated[id])
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
    }
    else if(is_map_valid2(nom_map))
    {
        if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
            return PLUGIN_CONTINUE
        }
        else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
            return PLUGIN_CONTINUE
        }
        else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
        {
            client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
            return PLUGIN_CONTINUE
        }

        for(new i=0;i<num_nominated;i++)
        {
            if(equali(nominated[i],nom_map))
            {
                client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
                return PLUGIN_CONTINUE
            }
        }

        format(nominated[num_nominated],31,"%s",nom_map)
        num_nominated++

        new name[32]
        get_user_name(id,name,31)
        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
        has_nominated[id] = true
    }
    else
    {
        client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
    }

    return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
    if(is_map_valid(map) &&
    containi(map,"<")==-1 &&
    containi(map,"\")==-1 &&
    containi(map,"/")==-1 &&
    containi(map,">")==-1 &&
    containi(map,"?")==-1 &&
    containi(map,"|")==-1 &&
    containi(map,"*")==-1 &&
    containi(map,":")==-1 &&
    containi(map,"^"")==-1
    )
        return 1;

    return 0;
}

public CheckLimits()
{
    if(voterocked==-1.0 || voterocked==-2.0)
        return;

    new bool:continuea=false
    lastround=true

    if(cstrike)
    {
        new winlimit = get_pcvar_num(mp_winlimit)
        if(winlimit)
        {
            new c = winlimit - 2
            if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
            {
                lastround=false
                continuea=true
            }
        }

        new maxrounds = get_pcvar_num(mp_maxrounds)
    
        if(maxrounds)
        {
            if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
            {
                lastround=false
                continuea=true
            }
        }
    }

    new timeleft = get_timeleft()
    if(!(timeleft < 1 || timeleft > 129))
        continuea=true

    if(!continuea)
        return;

    remove_task(1337)
    voterocked2=false
    make_menu(1,1)

    return;
}

public VoteCount(id,key)
{
    if(voting)
    {
        new name[32]
        get_user_name(id,name,31)
        if(key==8)
        {
            if(get_pcvar_num(showvotes_pcvar))
            if (!voterocked2)
                client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
            else
                client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
            votes[9]++
        }
        else if(key==9)
        {
            if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
        }
        else if(strlen(maps[key+1]))
        {
            if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
            votes[key+1]++
        }
        else
        {
            show_menu(id,keys,menu,-1,"CustomNextMap")
        }
    }
    return PLUGIN_HANDLED
}

public VoteTally(num)
{
    voting=false
    new winner[2]
    for(new i=1;i<10;i++)
    {
        if(votes[i]>winner[1])
        {
            winner[0]=i
            winner[1]=votes[i]
        }
        votes[i]=0
    }
    if(!winner[1])
    {
        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
        if(!voterocked2)
        {
            new mapname[32]
            get_pcvar_string(lastmap_was_pcvar,mapname,31)
            set_pcvar_string(lastlastmap_was_pcvar,mapname)
            get_mapname(mapname,31)
            set_pcvar_string(lastmap_was_pcvar,mapname)
            
            new ran
            do {
            ran = random_num( 1, 7 )
            } while (!is_map_valid(maps[ran]))
            format(cur_nextmap,31,"%s",maps[ran])
            client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
            set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
            lastround=false
            voterocked=-2.0
        }
        else
        {
            voterocked=get_gametime()
            voterocked2=false
        }
    }
    else if(winner[0]==9)
    {
        if(!voterocked2)
        {
            client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
            set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
            set_task(15.0,"CheckLimits",1337,"",0,"b")
            extended++
        }
        else
        {
            client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
            voterocked2=false
        }
        voterocked=get_gametime()
    }
    else
    {
        new mapname[32]
        get_pcvar_string(lastmap_was_pcvar,mapname,31)
        set_pcvar_string(lastlastmap_was_pcvar,mapname)
        get_mapname(mapname,31)
        set_pcvar_string(lastmap_was_pcvar,mapname)
        format(cur_nextmap,31,"%s",maps[winner[0]])
        client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
        set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
        voterocked=-2.0
        if(voterocked2)
        set_task(4.5,"Delayb4ChangeMap")
    }
    
    for(new i=0;i<=32;i++) rtv[i]=false
    rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
    new team[2]
    read_data(1,team,1)
    g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}


ТЕКСТОВИК (ПЕРЕВОД):
customnextmap.txt
Код
[en]
NEXT_MAP = Next map: %s.
NOT_CHOSEN = Next map is not chosen yet.
NOMINATED = %s nominated %s for vote.
CANNOTNOMINATE = You have already nominated a map for vote.
CANNOTNOMINATE_C = Cannot nominate the current map for vote.
CANNOTNOMINATE_P = Cannot nominate the previous map for vote.
CANNOTNOMINATE_PP = Cannot nominate the previous to previous map for vote.
CANNOTNOMINATE_ALREADY = That map has already been nominated for vote by other player.
CANNOTNOMINATE_DONTEXIST = That map does not exist on server.
RTV_LAST = %s has rocked the vote to change map.
RTV_NEEDED = %s has rocked the vote. %d more players are needed to change map.
RTV_NEEDED_1 = %s has rocked the vote. 1 more player is needed to change map.
CANNOTRTV_START = Cannot rock the vote until %d seconds after map start (%d more seconds).
CANNOTRTV_DELAY = Cannot rock the vote again for another %d seconds.
CANNOTRTV_ALREADY = You have already rocked the vote.
VOTE_ADMIN = An admin has started the vote for map!
VOTE_ROCKED = The vote for map has been rocked!
VOTED = %s voted for %s.
VOTED_KEEP = %s voted for map keeping.
VOTED_EXTEND = %s voted for map extension.
DIDNTCARE = %s didn't care.
NOVOTES = No one voted.
NEXT_MAP_CHOSEN = Voting complete! Next map: %s.
CHANGE_WHEN = Last round! The map will change at round end.
NEXT_MAP_CHOSEN_RANDOM = No one voted. Random map chosen! Next map: %s.
MAP_KEEPING = Map keeping won. No new map.
MAP_EXTENDING = Map extending won. Extending map for %d minutes.
VOTE_PROGRESS = Map vote already in progress.
RTV_OFF = Rock the vote is disabled.
VOTE_MENU_IN = Choice through  %d  sec.
VOTE_MENU = Make a choice
KEEP = Leave this map!
DONTCARE = I will not vote...
EXTEND = Extend the map for 15 minutes!
LAST_ROUND = Last round!

[de]
NEXT_MAP = Naechste map

[sr]
NEXT_MAP = Sledeca mapa

[tr]
NEXT_MAP = Diger map

[fr]
NEXT_MAP = Prochaine carte

[sv]
NEXT_MAP = N'a'sta karta

[da]
NEXT_MAP = Naeste bane

[pl]
NEXT_MAP = Nastepna mapa

[nl]
NEXT_MAP = Volgende map

[es]
NEXT_MAP = Proximo mapa

[bp]
NEXT_MAP = Proximo mapa

[cz]
NEXT_MAP = Dalsi mapa

[fi]
NEXT_MAP = Seuraava mappi

[ls]
NEXT_MAP = N3xt m4p

[bg]
NEXT_MAP = Sledva6tata karta

[ro]
NEXT_MAP = Urmatoarea harta

[hu]
NEXT_MAP = A kovetkezo palya

[lt]
NEXT_MAP = Kitas zemelapis

[sk]
NEXT_MAP = Dalsia mapa

[mk]
NEXT_MAP = Slednata mapa ke bide

[ru]
NEXT_MAP = Следующая карта: %s.
NOT_CHOSEN = Следующая карта ещё не выбрана.
NOMINATED = %s номинировал %s.
CANNOTNOMINATE = Вы уже номинировали карту для голосования.
CANNOTNOMINATE_C = Нельзя номинировать для голосования текущую карту.
CANNOTNOMINATE_P = Нельзя номинировать для голосования предыдущую карту.
CANNOTNOMINATE_PP = Нельзя номинировать для голосования предпредыдущую карту.
CANNOTNOMINATE_ALREADY = Карта уже была номинирована для голосования другим игроком.
CANNOTNOMINATE_DONTEXIST = Такой карты нет на сервере.
RTV_LAST = %s предложил сменить карту.
RTV_NEEDED = %s предложил сменить карту. Надо /rtv ещё %d игроков.
RTV_NEEDED_1 = %s предложил сменить карту. Нужен /rtv ещё 1 игрока.
CANNOTRTV_START = Предлагать сменить карту нельзя первые %d секунд (осталось %d сек.).
CANNOTRTV_DELAY = Предложить сменить карту можно будет через %d секунд.
CANNOTRTV_ALREADY = Вы уже предложили сменить карту.
VOTE_ADMIN = Админ стартовал досрочное голосование за карту!
VOTE_ROCKED = Будет досрочное голосование за карту!
VOTED = %s проголосовал за %s.
VOTED_KEEP = %s против смены карты.
VOTED_EXTEND = %s проголосовал за продление карты.
DIDNTCARE = Игроку %s без разницы.
NOVOTES = Никто не проголосовал.
NEXT_MAP_CHOSEN = Голосование завершено! Следующая карта: %s.
CHANGE_WHEN = Последний раунд! После него карта поменяется.
NEXT_MAP_CHOSEN_RANDOM = Никто не проголосовал. Будет рандомная карта: %s.
MAP_KEEPING = Голосование завершено. Смены карты не будет!
MAP_EXTENDING = Голосование завершено. Текущая карта продлена на %d минут.
VOTE_PROGRESS = Голосование за карту уже идёт.
RTV_OFF = Досрочное голосование за карту отключено.
VOTE_MENU_IN = Выбор произойдёт через  %d  сек.
VOTE_MENU = СДЕЛАЙТЕ ВЫБОР
KEEP = ОСТАВИТЬ ЭТУ КАРТУ!
DONTCARE = Я не буду голосовать...
EXTEND = ПРОДЛИТЬ КАРТУ НА 15 МИНУТ!
LAST_ROUND = ЭТО ПОСЛЕДНИЙ РАУНД!!! ПОСЛЕ СМЕНЫ КАРТЫ БУДЕТ 1 РАЗМИНОЧНЫЙ РАУНД!


Пример custom_nextmaps.ini
Скрытый текст
Код
[1]
de_dust2
de_cbble
de_clan1_mill_32
de_kgb_2012
de_tuscan
[/1]

[2]
de_byfly
de_dune2
de_inferno
de_dually
de_mirage32
[/2]

[3]
de_steely2
as_oilrig
de_westwood
de_train
$3000$_b5
[/3]

[4]
de_pf_dust4
de_nuke
de_fastdust_beta2
awp_india
de_aztec_old
[/4]

[5]
cs_mansion_32
cs_italy
cs_office
de_piranesi
fy_snow
[/5]

[6]
de_forbidden_zone
35hp_32
de_kabul
de_russka32
de_dust2002
[/6]

[7]
%nominated%
[/7]

[8]
%nominated%
[/8]


Пример custom_nextmaps_small.ini
Скрытый текст
Код
[1]
de_dust2_2x2
[/1]

[2]
cs_mansion_32
[/2]

[3]
de_pf_dust4
fy_iceworld16_final
[/3]

[4]
fy_new_pool_day2
[/4]

[5]
$3000$_b5
[/5]

[6]
fy_snow
awp_india
[/6]

[7]
35hp_32
[/7]

[8]
%nominated%
[/8]


Отредактировал: intercs, - 31.5.2013, 23:31
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 1.6.2013, 14:02
Сообщение #8


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

up или всё же без +100 руб не обойтись?)

Отредактировал: intercs, - 1.6.2013, 14:02
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 1.6.2013, 21:55
Сообщение #9


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

ок, назчначаю сумму (чтобы не нарушать правила форума, переместите если хотите тему в разел - КУПЛЮ) = от 100+ рублей:

ЕСТЬ КОД (файлы прикреплю ниже):


Скрытый текст
Код:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-12
*
* ============
* Changelog:
* ============
*
* v1.4l (by Safety1st)
* - new: last round also for timelimit-based map change. No more waste of time!
* - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
* - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
* - fix: check for round-based limits before allow extending for CS&CZ only
* - change: ML support for last things: HUD & menu
* - change: annoncement HUD looks more pretty
* - new: separate ML records for mods that don't support UTF-8 in HUD
* v1.4k (by Safety1st)
* - new: third argument for amx_nextmap_vote to disable announcement before menu
* - fix: user-initiated map changing now works for mods without rounds
* - some fixes
* v1.4j (by Safety1st)
* - fix: proper ML dictionary using
* - new: colorchat support and separate version without one
* v1.4i (by Safety1st)
* - fix: now rtvtotal calculates correctly for second and subsequent votes
* - fix: if map cannot be nominated info message are showed to player but not to everyone
* - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

* v1.4h (by Safety1st)
* - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
* based on current players quantity: 'normal' or 'small'
* - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
* - fix: in case of no timelimit for map option 'Extend map' isn't showed
* - fix: after choosing nextmap players get correct message to their rtv
* - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
* - change: user-initiated map changing occurs at the end of round with a short delay
* - ! new: increase timelimit if it might elapse earlier than the current round
* - players can vote for 'Don't change map' in case of user-initiated rtv
* - new: added multilingual support (incomplete)
* - a few cosmetic changes
*
* v1.4g (by ~UN!CORN~)
* - Change map change method to change after round end.
*
* v1.4f (by ~UN!CORN~)
* - Added 3 custom files for map votes, depending on players and gungame status.
* - Added empty server map change in case if no one voted.
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED 20
#define MAX_TRIES 50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2 // 1 - change now, 0 - change at the end of limit or limit-based rtv
new bool:lastround // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"votemap",
"/votemap",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}

new say_commands2[][32] =
{
"nominate",
"/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_dictionary("customnextmap.txt")
enabled_pcvar = register_cvar("map_enabled","1")

if(get_pcvar_num(enabled_pcvar))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")

cstrike = cstrike_running()
if(cstrike)
{
register_event("TeamScore", "team_score", "a")
register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
}

register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

set_task(15.0,"CheckLimits",1337,"",0,"b")

extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","15")
currentmap_pcvar = register_cvar("map_currentmap_show","0")
lastmap_pcvar = register_cvar("map_lastmap_show","0")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","40")
rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","5")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
amx_nextmap_pcvar = register_cvar("amx_nextmap","")

get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}

public plugin_cfg()
{
if(get_pcvar_num(enabled_pcvar))
{
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

mp_timelimit = get_cvar_pointer("mp_timelimit")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
g_coloredMenus = colored_menus()
}
}

public RoundEnd()
{
// it changes map only in case of user-initiated rtv
// AMXX nextmap base plugin takes care of limit-based change
if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
// freeze the game and show the scoreboard
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()

// change the map after "chattime" is over
set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}

public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED

if(!voting)
{
new arg1[8] = "1" // allow extend
new arg2[8] = "1" // change now
new arg3[8] = "1" // show announcement
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
if(read_argc()>=4)
{
read_argv(3,arg3,7)
}
}
}

client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

if(str_to_num(arg2)) voterocked2=true
else
{
voterocked2=false
lastround=false
}
make_menu(str_to_num(arg1),str_to_num(arg3))

}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

if(get_cvar_num("gg_enabled"))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
}
else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
}
else
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
}

for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")

format(menu,1999,"^n")

new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]

for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1

format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}

new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}

if(add_extend && cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
new maxrounds = get_pcvar_num(mp_maxrounds)
if(winlimit + maxrounds != 0)
add_extend=0
}

if(add_extend)
{
if (!voterocked2)
{
if(extended<get_pcvar_num(extended_pcvar))
{
new mapname[32]
get_mapname(mapname,31)
format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
keys |= (1<<8)
}
}
else
{
format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

if(show_announcement)
{
num = get_pcvar_num(delay_time_pcvar)
if(num>1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
}
}
else num=1

set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

voting=true
voterocked=-1.0
}

public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
//clear place
set_hudmessage(.channel=3)
show_hudmessage(0,"")
set_hudmessage(.channel=4)
show_hudmessage(0,"")

client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
return PLUGIN_HANDLED // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)

new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}

for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}

if(is_map_valid2(text)) return saynominate(id,text);

return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
else if(voterocked==-2.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
}
else
{
rtv[id]=true
rtvtotal++

new num2, players[32]
get_players(players,num2,"ch")

new name[32]
get_user_name(id,name,31)

new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

if(num3<=0)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
voterocked2=true
make_menu(1,1)
}
else
{
if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
}
}
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}

return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
}
else if(is_map_valid2(nom_map))
{
if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
return PLUGIN_CONTINUE
}

for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
return PLUGIN_CONTINUE
}
}

format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++

new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
}

return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;

return 0;
}

public CheckLimits()
{
if(voterocked==-1.0 || voterocked==-2.0)
return ;

new bool:continuea=false
lastround=true

if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
lastround=false
continuea=true
}
}

new maxrounds = get_pcvar_num(mp_maxrounds)

if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
lastround=false
continuea=true
}
}
}

new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
continuea=true

if(!continuea)
return ;

remove_task(1337)
voterocked2=false
make_menu(1,1)

return ;
}

public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar))
if (!voterocked2)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
else
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}

public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
if(!voterocked2)
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)

new ran
do {
ran = random_num( 1, 7 )
} while (!is_map_valid(maps[ran]))
format(cur_nextmap,31,"%s",maps[ran])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
lastround=false
voterocked=-2.0
}
else
{
voterocked=get_gametime()
voterocked2=false
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"CheckLimits",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
voterocked2=false
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
format(cur_nextmap,31,"%s",maps[winner[0]])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
voterocked=-2.0

if(cstrike)
{
if(voterocked2 || lastround)
{
new players[32],playerCnt
get_players(players,playerCnt,"ch")
if(playerCnt <= 1)
{
// at most there is only one player on the server, so no need to stay around
Delayb4ChangeMap()
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"LAST_ROUND")

// remove timelimit
set_pcvar_num(mp_timelimit,0)
}
}
}
else if(voterocked2)
set_task(4.5,"Delayb4ChangeMap")
}

for(new i=0;i<=32;i++) rtv[i]=false
rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}


В этом плагине, если никто не проголосовал или если сервер пустой, то плагин, т.к. никто не выбрал никакую карту, назначает рандомную карту и происходит смена карты на эту рандомную.
А НАДО:
1) Вместе рандома сделать, чтоб назначалась не рандомная, а de_dust2_2x2. Т.е. если сервер пустой или никто не проголосовал, то карта будет назначена de_dust2_2x2.

Это всё-)

Отредактировал: intercs, - 1.6.2013, 21:59
Прикрепленные файлы:
Прикрепленный файл  Safet1st.rar ( 8,21 килобайт ) Кол-во скачиваний: 5
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 1.6.2013, 22:37
Сообщение #10


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

Код:
         new ran
do {
ran = random_num( 1, 7 )
} while (!is_map_valid(maps[ran]))
format(cur_nextmap,31,"%s",maps[ran])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)

=>
set_pcvar_string(amx_nextmap_pcvar, "de_dust2_2x2")


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 1.6.2013, 22:50
Сообщение #11


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Цитата(mazdan @ 2.6.2013, 0:37) *
Код:
         new ran
do {
ran = random_num( 1, 7 )
} while (!is_map_valid(maps[ran]))
format(cur_nextmap,31,"%s",maps[ran])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)

=>
set_pcvar_string(amx_nextmap_pcvar, "de_dust2_2x2")


Спасибо огромное.
Можно кошелёк на всеобщее обозрение в целях перечисления денежных средств в количестве 100 злотых?)
Маздану грех не положить денег в ночь на Ивана Купала...

Отредактировал: intercs, - 1.6.2013, 22:51
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 1.6.2013, 22:53
Сообщение #12


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

да ни к чему это, 10 секундное дело - еще не факт что заработает, я плагин то не смотрел толком. Не парьтесь.
Цитата
и деньги тут не при чем - я ими пользоваться не умею.



Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 1.6.2013, 22:58
Сообщение #13


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Тогда будем все с нетерпением тогда ждать лекарства от нового сплоита, который обсуждается в теме ЗАЩИТА СЕРВЕР и если оно будет бесплатным в любом случае закинем денег в целях благодарности, которые возможно пойдут в ФОНД - ПОМОГИ 2010КОНТЕР И ДРУГИМ СКАЗОЧНЫМ СПЛОИТ-ЗВЕРЮШКАМ ЗАКОПАТЬ СЕБЯ ЗАЖИВО-)

Отредактировал: intercs, - 1.6.2013, 22:59
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя sambo
сообщение 2.6.2013, 13:25
Сообщение #14


Стаж: 14 лет

Сообщений: 847
Благодарностей: 200
Полезность: 477

Цитата(Safety1st @ 30.5.2013, 20:50) *
Нет. В коде не нужно для этого ничего менять. Настройки плагинов задаются в amxx.cfg обычно. Нужно написать там:
Код
map_currentmap_show 0
map_lastmap_show 0
map_lastlastmap_show 0



Вписывать ничего не нужно. Эти cvar'ы не предназначены для настройки, только для внутреннего использования сервером.


НЕ хочет на гг работать (
Вписывал gg_vote_custom "amx_nextmap_vote 0 0" и просто gg_vote_custom "amx_nextmap_vote"
Выводит голосование с пустым списком карт , есть только продлить и все равно . После окончания голосования сервер виснет если за игру не было номинирована карта .
На простых картах норм работает .
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 2.6.2013, 14:09
Сообщение #15


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Цитата(sambo @ 2.6.2013, 15:25) *
НЕ хочет на гг работать (
Вписывал gg_vote_custom "amx_nextmap_vote 0 0" и просто gg_vote_custom "amx_nextmap_vote"
Выводит голосование с пустым списком карт , есть только продлить и все равно . После окончания голосования сервер виснет если за игру не было номинирована карта .
На простых картах норм работает .


Надо создать файл custom_nextmaps_gungame.ini и туда запихнуть названия карт, как на примере custom_nextmaps_small.ini или custom_nextmaps.ini, а виснет как раз потом, что нет этого файла, т.к. плагин пытается найти этот файл с картами, а его нет, вот поэтому ещё и происходит такое, что список при выборе карт = пустой.

Вот же в исходнике для ГанГейма:

get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
}
else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
}
else
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)


пример custom_nextmaps_gungame.ini
[1]
de_dust2
de_cbble
de_clan1_mill_32
de_kgb_2012
de_tuscan
[/1]

[2]
de_byfly
de_dune2
de_inferno
de_dually
de_mirage32
[/2]

[3]
de_steely2
as_oilrig
de_westwood
de_train
$3000$_b5
[/3]

[4]
de_pf_dust4
de_nuke
de_fastdust_beta2
awp_india
de_aztec_old
[/4]

[5]
cs_mansion_32
cs_italy
cs_office
de_piranesi
fy_snow
[/5]

[6]
de_forbidden_zone
35hp_32
de_kabul
de_russka32
de_dust2002
[/6]

[7]
%nominated%
[/7]

[8]
%nominated%
[/8]


Примечание: %nominated% = это значит, что в списке на выбор в 7 или 8 будет номинированная во время игры игроками карта: там в чате de_dust2 de_inferno и тд.

Отредактировал: intercs, - 2.6.2013, 14:12
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя sambo
сообщение 2.6.2013, 19:14
Сообщение #16


Стаж: 14 лет

Сообщений: 847
Благодарностей: 200
Полезность: 477

intercs,
Кривои он все равно . На гг теперь с голосованием норм но при смене на обычную карту : ртв и голосование не меняет карту , пишет раундтаим не ограничено и бесконечная карта + после гг не пашет список маленьких карт .
По ходу подоидет ток для гг или паб а гг+паб нет .
Пришлось мапчусер4 вернуть .
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 2.6.2013, 19:19
Сообщение #17


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Цитата(mazdan @ 2.6.2013, 0:37) *
Код:
         new ran
do {
ran = random_num( 1, 7 )
} while (!is_map_valid(maps[ran]))
format(cur_nextmap,31,"%s",maps[ran])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN_RANDOM",maps[ran])
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)

=>
set_pcvar_string(amx_nextmap_pcvar, "de_dust2_2x2")



а это для кого выше писалось? Это надо заменить, чтоб не было бесконечного раунда...

Сейчас выложу целый код своего исходника, где всё идеально работает, как на ГГ, так и на КСДМ серверах:

Скрытый текст
Код:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-12
*
* ============
* Changelog:
* ============
*
* v1.4l (by Safety1st)
* - new: last round also for timelimit-based map change. No more waste of time!
* - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
* - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
* - fix: check for round-based limits before allow extending for CS&CZ only
* - change: ML support for last things: HUD & menu
* - change: annoncement HUD looks more pretty
* - new: separate ML records for mods that don't support UTF-8 in HUD
* v1.4k (by Safety1st)
* - new: third argument for amx_nextmap_vote to disable announcement before menu
* - fix: user-initiated map changing now works for mods without rounds
* - some fixes
* v1.4j (by Safety1st)
* - fix: proper ML dictionary using
* - new: colorchat support and separate version without one
* v1.4i (by Safety1st)
* - fix: now rtvtotal calculates correctly for second and subsequent votes
* - fix: if map cannot be nominated info message are showed to player but not to everyone
* - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

* v1.4h (by Safety1st)
* - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
* based on current players quantity: 'normal' or 'small'
* - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
* - fix: in case of no timelimit for map option 'Extend map' isn't showed
* - fix: after choosing nextmap players get correct message to their rtv
* - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
* - change: user-initiated map changing occurs at the end of round with a short delay
* - ! new: increase timelimit if it might elapse earlier than the current round
* - players can vote for 'Don't change map' in case of user-initiated rtv
* - new: added multilingual support (incomplete)
* - a few cosmetic changes
*
* v1.4g (by ~UN!CORN~)
* - Change map change method to change after round end.
*
* v1.4f (by ~UN!CORN~)
* - Added 3 custom files for map votes, depending on players and gungame status.
* - Added empty server map change in case if no one voted.
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED 20
#define MAX_TRIES 50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2 // 1 - change now, 0 - change at the end of limit or limit-based rtv
new bool:lastround // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"votemap",
"/votemap",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}

new say_commands2[][32] =
{
"nominate",
"/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_dictionary("customnextmap.txt")
enabled_pcvar = register_cvar("map_enabled","1")

if(get_pcvar_num(enabled_pcvar))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")

cstrike = cstrike_running()
if(cstrike)
{
register_event("TeamScore", "team_score", "a")
register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
}

register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

set_task(15.0,"CheckLimits",1337,"",0,"b")

extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","15")
currentmap_pcvar = register_cvar("map_currentmap_show","0")
lastmap_pcvar = register_cvar("map_lastmap_show","0")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","37")
rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","5")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
amx_nextmap_pcvar = register_cvar("amx_nextmap","")

get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}

public plugin_cfg()
{
if(get_pcvar_num(enabled_pcvar))
{
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

mp_timelimit = get_cvar_pointer("mp_timelimit")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
g_coloredMenus = colored_menus()
}
}

public RoundEnd()
{
// it changes map only in case of user-initiated rtv
// AMXX nextmap base plugin takes care of limit-based change
if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
// freeze the game and show the scoreboard
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()

// change the map after "chattime" is over
set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}

public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED

if(!voting)
{
new arg1[8] = "1" // allow extend
new arg2[8] = "1" // change now
new arg3[8] = "1" // show announcement
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
if(read_argc()>=4)
{
read_argv(3,arg3,7)
}
}
}

client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

if(str_to_num(arg2)) voterocked2=true
else
{
voterocked2=false
lastround=false
}
make_menu(str_to_num(arg1),str_to_num(arg3))

}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

if(get_cvar_num("gg_enabled"))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
}
else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
}
else
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
}

for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")

format(menu,1999,"^n")

new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]

for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1

format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}

new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}

if(add_extend && cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
new maxrounds = get_pcvar_num(mp_maxrounds)
if(winlimit + maxrounds != 0)
add_extend=0
}

if(add_extend)
{
if (!voterocked2)
{
if(extended<get_pcvar_num(extended_pcvar))
{
new mapname[32]
get_mapname(mapname,31)
format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
keys |= (1<<8)
}
}
else
{
format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

if(show_announcement)
{
num = get_pcvar_num(delay_time_pcvar)
if(num>1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
}
}
else num=1

set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

voting=true
voterocked=-1.0
}

public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
//clear place
set_hudmessage(.channel=3)
show_hudmessage(0,"")
set_hudmessage(.channel=4)
show_hudmessage(0,"")

client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
return PLUGIN_HANDLED // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)

new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}

for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}

if(is_map_valid2(text)) return saynominate(id,text);

return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
else if(voterocked==-2.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
}
else
{
rtv[id]=true
rtvtotal++

new num2, players[32]
get_players(players,num2,"ch")

new name[32]
get_user_name(id,name,31)

new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

if(num3<=0)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
voterocked2=true
make_menu(1,1)
}
else
{
if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
}
}
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}

return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
}
else if(is_map_valid2(nom_map))
{
if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
return PLUGIN_CONTINUE
}

for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
return PLUGIN_CONTINUE
}
}

format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++

new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
}

return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;

return 0;
}

public CheckLimits()
{
if(voterocked==-1.0 || voterocked==-2.0)
return ;

new bool:continuea=false
lastround=true

if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
lastround=false
continuea=true
}
}

new maxrounds = get_pcvar_num(mp_maxrounds)

if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
lastround=false
continuea=true
}
}
}

new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
continuea=true

if(!continuea)
return ;

remove_task(1337)
voterocked2=false
make_menu(1,1)

return ;
}

public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar))
if (!voterocked2)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
else
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}

public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
if(!voterocked2)
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
set_pcvar_string(amx_nextmap_pcvar, "de_dust2")
lastround=false
voterocked=-2.0
}
else
{
voterocked=get_gametime()
voterocked2=false
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"CheckLimits",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
voterocked2=false
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
format(cur_nextmap,31,"%s",maps[winner[0]])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
voterocked=-2.0
if(voterocked2)
set_task(4.5,"Delayb4ChangeMap")
}

for(new i=0;i<=32;i++) rtv[i]=false
rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}


Скомпиль и пользуйся с удовольствием. Я ставил давно ещё себе мапшосер4, но после советов Сафетиста мне нафиг не нужны никакие мапшосеры-) Этот плагин идеален! Позже закажу его оптимизацию у кого-нибудь. А то у меня много заказов, я аж уже сам запутался куда деньги дел и на что-)))

Отредактировал: intercs, - 2.6.2013, 19:20
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя sambo
сообщение 2.6.2013, 19:25
Сообщение #18


Стаж: 14 лет

Сообщений: 847
Благодарностей: 200
Полезность: 477

Цитата(intercs @ 2.6.2013, 20:19) *
а это для кого выше писалось? Это надо заменить, чтоб не было бесконечного раунда...

Сейчас выложу целый код своего исходника, где всё идеально работает, как на ГГ, так и на КСДМ серверах:

Скрытый текст
Код:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-12
*
* ============
* Changelog:
* ============
*
* v1.4l (by Safety1st)
* - new: last round also for timelimit-based map change. No more waste of time!
* - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
* - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
* - fix: check for round-based limits before allow extending for CS&CZ only
* - change: ML support for last things: HUD & menu
* - change: annoncement HUD looks more pretty
* - new: separate ML records for mods that don't support UTF-8 in HUD
* v1.4k (by Safety1st)
* - new: third argument for amx_nextmap_vote to disable announcement before menu
* - fix: user-initiated map changing now works for mods without rounds
* - some fixes
* v1.4j (by Safety1st)
* - fix: proper ML dictionary using
* - new: colorchat support and separate version without one
* v1.4i (by Safety1st)
* - fix: now rtvtotal calculates correctly for second and subsequent votes
* - fix: if map cannot be nominated info message are showed to player but not to everyone
* - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

* v1.4h (by Safety1st)
* - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
* based on current players quantity: 'normal' or 'small'
* - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
* - fix: in case of no timelimit for map option 'Extend map' isn't showed
* - fix: after choosing nextmap players get correct message to their rtv
* - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
* - change: user-initiated map changing occurs at the end of round with a short delay
* - ! new: increase timelimit if it might elapse earlier than the current round
* - players can vote for 'Don't change map' in case of user-initiated rtv
* - new: added multilingual support (incomplete)
* - a few cosmetic changes
*
* v1.4g (by ~UN!CORN~)
* - Change map change method to change after round end.
*
* v1.4f (by ~UN!CORN~)
* - Added 3 custom files for map votes, depending on players and gungame status.
* - Added empty server map change in case if no one voted.
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED 20
#define MAX_TRIES 50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2 // 1 - change now, 0 - change at the end of limit or limit-based rtv
new bool:lastround // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"votemap",
"/votemap",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}

new say_commands2[][32] =
{
"nominate",
"/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_dictionary("customnextmap.txt")
enabled_pcvar = register_cvar("map_enabled","1")

if(get_pcvar_num(enabled_pcvar))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")

cstrike = cstrike_running()
if(cstrike)
{
register_event("TeamScore", "team_score", "a")
register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
}

register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

set_task(15.0,"CheckLimits",1337,"",0,"b")

extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","15")
currentmap_pcvar = register_cvar("map_currentmap_show","0")
lastmap_pcvar = register_cvar("map_lastmap_show","0")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","37")
rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","5")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
amx_nextmap_pcvar = register_cvar("amx_nextmap","")

get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}

public plugin_cfg()
{
if(get_pcvar_num(enabled_pcvar))
{
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

mp_timelimit = get_cvar_pointer("mp_timelimit")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
g_coloredMenus = colored_menus()
}
}

public RoundEnd()
{
// it changes map only in case of user-initiated rtv
// AMXX nextmap base plugin takes care of limit-based change
if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
// freeze the game and show the scoreboard
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()

// change the map after "chattime" is over
set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}

public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED

if(!voting)
{
new arg1[8] = "1" // allow extend
new arg2[8] = "1" // change now
new arg3[8] = "1" // show announcement
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
if(read_argc()>=4)
{
read_argv(3,arg3,7)
}
}
}

client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

if(str_to_num(arg2)) voterocked2=true
else
{
voterocked2=false
lastround=false
}
make_menu(str_to_num(arg1),str_to_num(arg3))

}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

if(get_cvar_num("gg_enabled"))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
}
else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
}
else
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
}

for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")

format(menu,1999,"^n")

new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]

for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1

format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}

new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}

if(add_extend && cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
new maxrounds = get_pcvar_num(mp_maxrounds)
if(winlimit + maxrounds != 0)
add_extend=0
}

if(add_extend)
{
if (!voterocked2)
{
if(extended<get_pcvar_num(extended_pcvar))
{
new mapname[32]
get_mapname(mapname,31)
format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
keys |= (1<<8)
}
}
else
{
format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

if(show_announcement)
{
num = get_pcvar_num(delay_time_pcvar)
if(num>1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
}
}
else num=1

set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

voting=true
voterocked=-1.0
}

public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
//clear place
set_hudmessage(.channel=3)
show_hudmessage(0,"")
set_hudmessage(.channel=4)
show_hudmessage(0,"")

client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
return PLUGIN_HANDLED // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)

new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}

for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}

if(is_map_valid2(text)) return saynominate(id,text);

return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
else if(voterocked==-2.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
}
else
{
rtv[id]=true
rtvtotal++

new num2, players[32]
get_players(players,num2,"ch")

new name[32]
get_user_name(id,name,31)

new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

if(num3<=0)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
voterocked2=true
make_menu(1,1)
}
else
{
if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
}
}
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}

return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
}
else if(is_map_valid2(nom_map))
{
if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
return PLUGIN_CONTINUE
}

for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
return PLUGIN_CONTINUE
}
}

format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++

new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
}

return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;

return 0;
}

public CheckLimits()
{
if(voterocked==-1.0 || voterocked==-2.0)
return ;

new bool:continuea=false
lastround=true

if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
lastround=false
continuea=true
}
}

new maxrounds = get_pcvar_num(mp_maxrounds)

if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
lastround=false
continuea=true
}
}
}

new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
continuea=true

if(!continuea)
return ;

remove_task(1337)
voterocked2=false
make_menu(1,1)

return ;
}

public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar))
if (!voterocked2)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
else
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}

public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
if(!voterocked2)
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
set_pcvar_string(amx_nextmap_pcvar, "de_dust2")
lastround=false
voterocked=-2.0
}
else
{
voterocked=get_gametime()
voterocked2=false
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"CheckLimits",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
voterocked2=false
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
format(cur_nextmap,31,"%s",maps[winner[0]])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
voterocked=-2.0
if(voterocked2)
set_task(4.5,"Delayb4ChangeMap")
}

for(new i=0;i<=32;i++) rtv[i]=false
rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}


Скомпиль и пользуйся с удовольствием. Я ставил давно ещё себе мапшосер4, но после советов Сафетиста мне нафиг не нужны никакие мапшосеры-) Этот плагин идеален! Позже закажу его оптимизацию у кого-нибудь. А то у меня много заказов, я аж уже сам запутался куда деньги дел и на что-)))


Это к раунду не имеет отношения . Замена сделает что карта даст2х2 поставиться если не сервере нет игроков .
У меня паблик но на некоторых картах грузиться гг мод , этот мапчусер криво пашет при таком раскладе .

С ним пишет ошибки в лог
06/02/2013 - 20:16:09: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20130602.log")
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


Отредактировал: sambo, - 2.6.2013, 19:29
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя intercs
сообщение 2.6.2013, 19:34
Сообщение #19


Стаж: 13 лет

Сообщений: 727
Благодарностей: 408
Полезность: 504

Цитата(sambo @ 2.6.2013, 21:25) *
Это к раунду не имеет отношения . Замена сделает что карта даст2х2 поставиться если не сервере нет игроков .
У меня паблик но на некоторых картах грузиться гг мод , этот мапчусер криво пашет при таком раскладе .

С ним пишет ошибки в лог
06/02/2013 - 20:16:09: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20130602.log")
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/02/2013 - 20:16:09: String formatted incorrectly - parameter 7 (total 6)
L 06/02/2013 - 20:16:09: [AMXX] Run time error 25 (plugin "nextmap.amxx") - debug not enabled!
L 06/02/2013 - 20:16:09: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


Я ничерта не понял...

1) Надо отключить нафиг нетмап и мапшосер и мапшосер4 всемте с второстепенными ртв плагинами, т.к. в этом плагине уже всё итак это есть.
2) поставит ьна сервер скомпилированный исходник:
Скрытый текст
Код:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-12
*
* ============
* Changelog:
* ============
*
* v1.4l (by Safety1st)
* - new: last round also for timelimit-based map change. No more waste of time!
* - new: finally pause and score before map changing (it was used 'Galileo' plugin code)
* - new: instant map changing if there is only 1 alive player (it was used 'Galileo' plugin code)
* - fix: check for round-based limits before allow extending for CS&CZ only
* - change: ML support for last things: HUD & menu
* - change: annoncement HUD looks more pretty
* - new: separate ML records for mods that don't support UTF-8 in HUD
* v1.4k (by Safety1st)
* - new: third argument for amx_nextmap_vote to disable announcement before menu
* - fix: user-initiated map changing now works for mods without rounds
* - some fixes
* v1.4j (by Safety1st)
* - fix: proper ML dictionary using
* - new: colorchat support and separate version without one
* v1.4i (by Safety1st)
* - fix: now rtvtotal calculates correctly for second and subsequent votes
* - fix: if map cannot be nominated info message are showed to player but not to everyone
* - change: complete ML support for ENG and RUS except menu (credits to Gam3ronE and TRUE RED)

* v1.4h (by Safety1st)
* - new: added cvar (map_max_players_2_use_small_maps, default 15) for determination which ini plugin should use
* based on current players quantity: 'normal' or 'small'
* - new: added possibility to show also current map in menu (defined by "map_currentmap_show" cvar, off by default)
* - fix: in case of no timelimit for map option 'Extend map' isn't showed
* - fix: after choosing nextmap players get correct message to their rtv
* - change: timelimit-based map changing is handled by AMXX nextmap base plugin as it is for AMXX mapchooser base one
* - change: user-initiated map changing occurs at the end of round with a short delay
* - ! new: increase timelimit if it might elapse earlier than the current round
* - players can vote for 'Don't change map' in case of user-initiated rtv
* - new: added multilingual support (incomplete)
* - a few cosmetic changes
*
* v1.4g (by ~UN!CORN~)
* - Change map change method to change after round end.
*
* v1.4f (by ~UN!CORN~)
* - Added 3 custom files for map votes, depending on players and gungame status.
* - Added empty server map change in case if no one voted.
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/

#define PLUGIN "Custom NextMap Chooser"
#define VERSION "1.4l"
#define AUTHOR "GHW_Chronic/AMXX Community"

#include <amxmodx>
#include <amxmisc>

#define MAX_NOMINATED 20
#define MAX_TRIES 50

new configfile[200]

new menu[2000]
new keys
new pref[] = "[MAPS]"

new g_teamScore[2]

new bool:voting
new votes[10]
new maps[9][32]

new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]

new mp_winlimit,mp_maxrounds,mp_timelimit

new enabled_pcvar
new extended_pcvar
new extendtime_pcvar
new currentmap_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new maxplayers2usesmallmaps_pcvar
new amx_nextmap_pcvar

new extended

new cur_nextmap[32]

new cstrike
new g_coloredMenus
new bool:rtv[33]
new rtvtotal

new Float:voterocked // -1.0 - voting currently is in process (menu & tally queued), -2.0 - voting over, nextmap chosen
new bool:voterocked2 // 1 - change now, 0 - change at the end of limit or limit-based rtv
new bool:lastround // we should force map end at current round by HLDS if exist time-based limit for map

new num

new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"votemap",
"/votemap",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}

new say_commands2[][32] =
{
"nominate",
"/nominate"
}

new lastmap[32]
new lastlastmap[32]
new currentmap[32]

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_cvar("customnextmap",VERSION,FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_dictionary("customnextmap.txt")
enabled_pcvar = register_cvar("map_enabled","1")

if(get_pcvar_num(enabled_pcvar))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"- starts a vote for next map^n [1|0-allow extend, def. 1] [change: 1-now (def.)|0-at the end] [1|0-announce, def. 1]")

register_clcmd("say nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say_team nextmap","sayNextMap", 0, "- displays nextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")

cstrike = cstrike_running()
if(cstrike)
{
register_event("TeamScore", "team_score", "a")
register_logevent("RoundEnd",2,"0=World triggered","1=Round_End")
}

register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")

set_task(15.0,"CheckLimits",1337,"",0,"b")

extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","15")
currentmap_pcvar = register_cvar("map_currentmap_show","0")
lastmap_pcvar = register_cvar("map_lastmap_show","0")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","0")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","37")
rtv_wait_pcvar = register_cvar("map_rtv_wait","30")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","5")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","18")
maxplayers2usesmallmaps_pcvar = register_cvar("map_max_players_2_use_small_maps","14")
amx_nextmap_pcvar = register_cvar("amx_nextmap","")

get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}

public plugin_cfg()
{
if(get_pcvar_num(enabled_pcvar))
{
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")

mp_timelimit = get_cvar_pointer("mp_timelimit")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
g_coloredMenus = colored_menus()
}
}

public RoundEnd()
{
// it changes map only in case of user-initiated rtv
// AMXX nextmap base plugin takes care of limit-based change
if(get_cvar_num("gg_enabled") == 0 && voterocked==-2.0 && (voterocked2 || lastround))
set_task(4.5,"Delayb4ChangeMap")
}

public Delayb4ChangeMap()
{
// freeze the game and show the scoreboard
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()

// change the map after "chattime" is over
set_task(floatmax(get_cvar_float("mp_chattime"), 2.0), "ChangeMap")
}

public ChangeMap()
{
server_cmd("changelevel %s", cur_nextmap)
}

public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}

public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED

if(!voting)
{
new arg1[8] = "1" // allow extend
new arg2[8] = "1" // change now
new arg3[8] = "1" // show announcement
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
if(read_argc()>=4)
{
read_argv(3,arg3,7)
}
}
}

client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ADMIN")

if(str_to_num(arg2)) voterocked2=true
else
{
voterocked2=false
lastround=false
}
make_menu(str_to_num(arg1),str_to_num(arg3))

}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
return PLUGIN_HANDLED
}

public make_menu(add_extend,show_announcement)
{

if(get_cvar_num("gg_enabled"))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_gungame.ini",configfile)
}
else if(get_playersnum() <= get_pcvar_num(maxplayers2usesmallmaps_pcvar))
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps_small.ini",configfile)
}
else
{
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
}

for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")

format(menu,1999,"^n")

new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]

for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1

format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}

new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && (get_pcvar_num(currentmap_pcvar) || !equali(read,currentmap)) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}

if(add_extend && cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
new maxrounds = get_pcvar_num(mp_maxrounds)
if(winlimit + maxrounds != 0)
add_extend=0
}

if(add_extend)
{
if (!voterocked2)
{
if(extended<get_pcvar_num(extended_pcvar))
{
new mapname[32]
get_mapname(mapname,31)
format(menu,1999,"%s^n^n9. %L %s",menu,LANG_PLAYER,g_coloredMenus ? "EXTEND" : "EXTEND_ANSI",mapname)
keys |= (1<<8)
}
}
else
{
format(menu,1999,"%s^n^n9. %L",menu,LANG_PLAYER,g_coloredMenus ? "KEEP" : "KEEP_ANSI")
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. %L",menu,LANG_PLAYER,g_coloredMenus ? "DONTCARE" : "DONTCARE_ANSI")

if(show_announcement)
{
num = get_pcvar_num(delay_time_pcvar)
if(num>1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
}
}
else num=1

set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)

voting=true
voterocked=-1.0
}

public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,2.0,0.0,0.0,3)
show_hudmessage(0,"%L:",LANG_PLAYER,g_coloredMenus ? "VOTE_MENU_IN" : "VOTE_MENU_IN_ANSI",num-1)

set_hudmessage(255,255,255,0.03,0.42,0,6.0,2.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
//clear place
set_hudmessage(.channel=3)
show_hudmessage(0,"")
set_hudmessage(.channel=4)
show_hudmessage(0,"")

client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,g_coloredMenus ? "\r%L:\w%s" : "%L:%s" ,LANG_PLAYER,g_coloredMenus ? "VOTE_MENU" : "VOTE_MENU_ANSI",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}

//From the AMXX nextmap base file
public sayNextMap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"%L",LANG_PLAYER,"NEXT_MAP",cur_nextmap)
else client_print(0,print_chat,"%L",LANG_PLAYER,"NOT_CHOSEN")
return PLUGIN_HANDLED // command must NOT be proccessed again by AMXX nextmap base plugin if it was placed below in plugins.ini
}

public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)

new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}

for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}

if(is_map_valid2(text)) return saynominate(id,text);

return PLUGIN_CONTINUE
}

public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_PROGRESS")
}
else if(voterocked==-2.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_ALREADY")
}
else
{
rtv[id]=true
rtvtotal++

new num2, players[32]
get_players(players,num2,"ch")

new name[32]
get_user_name(id,name,31)

new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)

if(num3<=0)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_LAST",name)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTE_ROCKED")
voterocked2=true
make_menu(1,1)
}
else
{
if(num3!=1) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED",name,num3)
else client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_NEEDED_1",name)
}
}
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"RTV_OFF")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_DELAY",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTRTV_START",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}

return PLUGIN_CONTINUE
}

public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE")
}
else if(is_map_valid2(nom_map))
{
if(!get_pcvar_num(currentmap_pcvar) && equali(nom_map,currentmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_C")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_P")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_PP")
return PLUGIN_CONTINUE
}

for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_ALREADY")
return PLUGIN_CONTINUE
}
}

format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++

new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOMINATED",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(id,print_chat,"%s %L",pref,LANG_PLAYER,"CANNOTNOMINATE_DONTEXIST")
}

return PLUGIN_CONTINUE
}

public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;

return 0;
}

public CheckLimits()
{
if(voterocked==-1.0 || voterocked==-2.0)
return ;

new bool:continuea=false
lastround=true

if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
lastround=false
continuea=true
}
}

new maxrounds = get_pcvar_num(mp_maxrounds)

if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
lastround=false
continuea=true
}
}
}

new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
continuea=true

if(!continuea)
return ;

remove_task(1337)
voterocked2=false
make_menu(1,1)

return ;
}

public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar))
if (!voterocked2)
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_EXTEND",name)
else
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED_KEEP",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"DIDNTCARE",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"VOTED",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}

public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NOVOTES")
if(!voterocked2)
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
set_pcvar_string(amx_nextmap_pcvar, "de_dust2")
lastround=false
voterocked=-2.0
}
else
{
voterocked=get_gametime()
voterocked2=false
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_EXTENDING",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"CheckLimits",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"MAP_KEEPING")
voterocked2=false
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_pcvar_string(lastmap_was_pcvar,mapname,31)
set_pcvar_string(lastlastmap_was_pcvar,mapname)
get_mapname(mapname,31)
set_pcvar_string(lastmap_was_pcvar,mapname)
format(cur_nextmap,31,"%s",maps[winner[0]])
client_print(0,print_chat,"%s %L",pref,LANG_PLAYER,"NEXT_MAP_CHOSEN",cur_nextmap)
set_pcvar_string(amx_nextmap_pcvar,cur_nextmap)
voterocked=-2.0
if(voterocked2)
set_task(4.5,"Delayb4ChangeMap")
}

for(new i=0;i<=32;i++) rtv[i]=false
rtvtotal=0
}

//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}

3) залить фалы: текстовик и нехтмапс_.ини там всякие, которые выше в этой теме и вуаля... ВСЁ - Всё в итоге будет работать!

Какой ещё гангаме... Если у Вас Паблик, то удалите нафиг файл с сервера custom_nextmaps_gungame.ini и карты из этого файла не будут номинироваться!

Это всё... thank_you2.gif
---------------------------

А всё уяснил... Так распределите карты ГанГаме и пабликовские карты между этими 3 файлами .ини и радуйтесь жизни...

А ЭТА ЗАМЕНА ЧТО Я СКИНУЛ, сделает так, что после выбора карты всеми будет дано ещё 2 минуты игры и карта сменится на выбранную и не будет "Нет лимита времени", т.к. в исходнике в пункте 2) всё уже доведенно до ума.

Вообщем ставьте код, который в пункте 2 и будет Вам счастье!

Отредактировал: intercs, - 2.6.2013, 19:47
Прикрепленные файлы:
Прикрепленный файл  GHW_Custom_Nextmap_Safet1stCSDM2.sma ( 19,9 килобайт ) Кол-во скачиваний: 4
Прикрепленный файл  Файлы_и_исходник__где_после_выбора_карты_даётся_ещё_2_минуты_игры.rar ( 8,15 килобайт ) Кол-во скачиваний: 11
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: