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

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

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

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

> Правила форума

Этот раздел, как вы могли заметить по названию, предназначен для решения вопросов по поводу уже существующих модов и плагинов.
Пожалуйста, если у вас проблема с написанием плагина, не путайте этот раздел с разделом по скриптингу.
Для поиска плагинов и модов существует соответствующий раздел.

Название темы должно соответствовать содержанию. Темы с названием типа "Помогите", "Вопрос", "парни подскажите..." - будут удалены.
Все темы, не относящиеся к "Вопросам по модам и плагинам", будут удалены или перемещены в соответствующий раздел.

Правила оформления темы:
1. Помимо заголовка не забудьте верно сформулировать свой вопрос.
2. Выложите исходник (в тег кода + ) или ссылку на плагин который вызывает у вас вопросы.
3. Выложите лог с ошибками (если имеется) под спойлер

Ошибка. Нельзя сменить карту.

, inside
Статус пользователя kupuk96
сообщение 1.11.2010, 14:30
Сообщение #1


Стаж: 15 лет

Сообщений: 456
Благодарностей: 139
Полезность: 554

привет всем)
значит ошибка у меня такая:
нельзя сменить карту и сделать голосование за карту.
стоят все флаги.
в чём может быть проблема?
вот список плагинов:
plugins.ini
advanced_bans.amxx
csf_opengl32.amxx
csf_anticheat.amxx
admin.amxx
adminchat.amxx
admincmd.amxx
adminvote.amxx
admin_name.amxx
admin_vgk.amxx
ad_manager.amxx
amx_hpk.amxx
anti_fullupdate_spam2.amxx
auto_rr.amxx
cmdmenu.amxx
FullSpawns.amxx
game_destroyer.amxx
he_selfdamage.amxx
imessage.amxx
info_rank.amxx
mapchooser.amxx
mapsmenu.amxx
menufront.amxx
miscstats.amxx
nextmap.amxx
no_reklama_advanced.amxx
pbk.amxx
plmenu.amxx
restmenu.amxx
sillyc4.amxx
statscfg.amxx
statsx_shell.amxx
timeleft.amxx
voteban.amxx

что-то менял в mapchooser, посмотрите мб дело в нём
mapchooser.sma
/*
Nextmap Chooser
Интегрированы: Lastround & RockTheVote

Использован код следующих плагинов, за что их авторам большая благодарность:
1. Nextmap Chooser Plugin
by the AMX Mod X Development Team
originally developed by OLO

2. RockTheVote v1.8
Made by DA

Переменные:
amx_extendmap_max (default: 45) - Максимальная длительность карты в минутах
amx_extendmap_step (default: 15) - Время продления карты за 1 раз в минутах
amx_vote_time (default: 15) - Длительность голосования в секундах
amx_vote_delay (default: 15) - Отсрочка голосования в минутах от начала карты
amx_votemap_ratio (default: 0.6) - Процент голосов для начала голосования
(по-умолчанию 60%)
amx_lastround (default: 1) - Производить смену карты по окончании раунда.

Rebuilding by UFPS.Team
*/


#include <amxmodx>
#include <amxmisc>

#define PLUGIN_NAME "Nextmap Chooser"
#define PLUGIN_VERSION "1.9"
#define PLUGIN_AUTHOR "UFPS.Team"

#define SELECTMAPS 6
#define MAPS_MAX 128
#define AUTO_LANG -76

#define charsmax(%1) (sizeof(%1)-1)


new g_mapNums
new g_mapName [MAPS_MAX][32]

new g_nextName [SELECTMAPS]
new g_voteCount [SELECTMAPS + 2]
new g_mapVoteNum
new g_teamScore [2]
new g_lastMap [32]
new g_rtv_count
new g_rtv_vote [33]

new g_MENU [512]
new g_MENU_keys = ( 1 << SELECTMAPS + 1 )
new g_MENU_name [64]
new g_MENU_title [128]

new const speak[][] = { "one", "two", "three", "four", "five" }

new g_coloredMenus = 0
new bool:g_rtv = false
new bool:g_lastround = false
new bool:g_changemap = false
new bool:g_selected = false
new Float:g_timelimit = 0.0

new pcv_lastround
new pcv_extendmap_max
new pcv_extendmap_step
new pcv_vote_time
new pcv_vote_delay
new pcv_votemap_ratio
new pcv_amx_nextmap
new pcv_mp_chattime
new pcv_mp_timelimit
new pcv_mp_winlimit
new pcv_mp_maxrounds


public plugin_init( )
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )

register_dictionary ( "common.txt" )
register_dictionary ( "lastround.txt" )
register_dictionary ( "mapchooser.txt" )

register_clcmd( "say rockthevote", "cmd_say_rtv" )
register_clcmd( "say /rockthevote", "cmd_say_rtv" )
register_clcmd( "say rtv", "cmd_say_rtv" )
register_clcmd( "say /rtv", "cmd_say_rtv" )

register_clcmd( "say_team rockthevote", "cmd_say_rtv" )
register_clcmd( "say_team /rockthevote", "cmd_say_rtv" )
register_clcmd( "say_team rtv", "cmd_say_rtv" )
register_clcmd( "say_team /rtv", "cmd_say_rtv" )

pcv_vote_time = pcvar_register( "amx_vote_time", "15" )
pcv_vote_delay = pcvar_register( "amx_vote_delay", "15" )
pcv_votemap_ratio = pcvar_register( "amx_votemap_ratio", "0.6" )
pcv_extendmap_max = pcvar_register( "amx_extendmap_max", "45" )
pcv_extendmap_step = pcvar_register( "amx_extendmap_step", "15" )

pcv_mp_chattime = get_cvar_pointer( "mp_chattime" )
pcv_mp_timelimit = get_cvar_pointer( "mp_timelimit" )
pcv_mp_winlimit = get_cvar_pointer( "mp_winlimit" )
pcv_mp_maxrounds = get_cvar_pointer( "mp_maxrounds" )
pcv_amx_nextmap = get_cvar_pointer( "amx_nextmap" )

if( !pcv_amx_nextmap )
pcv_amx_nextmap = register_cvar( "amx_nextmap", "", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_SPONLY )

if( cstrike_running( ) )
{
pcv_lastround = register_cvar( "amx_lastround", "1" )
register_event( "TeamScore", "team_score", "a" )
register_logevent( "evRoundStart", 2, "0=World triggered", "1=Round_Start" )
}

register_event( "30", "mapChange", "a" )

g_coloredMenus = colored_menus( )

get_localinfo( "lastMap", g_lastMap, charsmax( g_lastMap ) )
set_localinfo( "lastMap", "" )

set_cvar_float( "sv_restart", 1.0 )
}

public plugin_cfg( )
{
new mapcycle[64]
get_configsdir( mapcycle, charsmax( mapcycle ) )
format( mapcycle, charsmax( mapcycle ), "%s/maps.ini", mapcycle )

if( !file_exists( mapcycle ) )
get_cvar_string( "mapcyclefile", mapcycle, charsmax( mapcycle ) )

if( !file_exists( mapcycle ) )
copy( mapcycle, charsmax( mapcycle ), "mapcycle.txt" )

if( loadSettings( mapcycle) )
set_task( 15.0, "voteNextmap", 987456, "", 0, "b" )

formatex( g_MENU_name, charsmax( g_MENU_name ), "%L", "en", "CHOOSE_NEXTM" )
register_menucmd( register_menuid( g_MENU_name ), ( -1 ^ ( -1 << ( SELECTMAPS + 2 ) ) ), "countVote" )
}

public countVote( id, key )
{
if( get_cvar_float( "amx_vote_answers" ) )
{
new name[32]
get_user_name( id, name, charsmax( name ) )

if( key == SELECTMAPS )
client_print( 0, print_chat, "%L", LANG_PLAYER, "CHOSE_EXT", name )

else if( key < SELECTMAPS )
{
new map[32]
copy( map, charsmax( map ), g_mapName[g_nextName[key]] )
client_print( 0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, map )
}
}

g_voteCount[key]++

return PLUGIN_HANDLED
}

public voteNextmap( )
{
if( !g_mapNums ) return 0

new winlimit = get_pcvar_num( pcv_mp_winlimit )
new maxrounds = get_pcvar_num( pcv_mp_maxrounds )

if( g_rtv )
{
winlimit = 0
maxrounds = -1
}

if( winlimit )
{
new c = winlimit - 2

if( ( c > g_teamScore[0] ) && ( c > g_teamScore[1] ) )
{
g_selected = false
return 0
}
}

else if( maxrounds )
{
if( ( maxrounds - 2 ) > ( g_teamScore[0] + g_teamScore[1] ) )
{
g_selected = false
return 0
}
}

else
{
new timeleft = get_timeleft( )

if( timeleft < 1 || timeleft > 129 )
{
g_selected = false
return 0
}
}

if( g_selected ) return 0

g_selected = true

new pos, a

g_MENU_keys = ( 1 << SELECTMAPS + 1 )

new dmax = clamp( g_mapNums, 0, SELECTMAPS )

for( g_mapVoteNum = 0; g_mapVoteNum < dmax; g_mapVoteNum++ )
{
a = random_num( 0, g_mapNums - 1 )

while( isInMenu( a ) ) { if( ++a >= g_mapNums ) a = 0; }

g_nextName[g_mapVoteNum] = a
pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %s^n", g_mapVoteNum + 1, g_mapName[a] )
g_MENU_keys |= ( 1 << g_mapVoteNum )
g_voteCount[g_mapVoteNum] = 0
}

g_MENU[pos++] = '^n'
g_voteCount[SELECTMAPS] = 0
g_voteCount[SELECTMAPS + 1] = 0

new mapname[32]
get_mapname( mapname, charsmax( mapname ) )

if( ( winlimit + maxrounds ) == 0 && ( get_pcvar_float( pcv_mp_timelimit ) < get_pcvar_float( pcv_extendmap_max ) ) )
{
pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname )
g_MENU_keys |= ( 1 << SELECTMAPS )
}

format( g_MENU[pos], charsmax( g_MENU ), "%d. %L", SELECTMAPS + 2, LANG_SERVER, "NONE" )
set_task( 1.0, "countDown", 5 )

return 1
}

stock bool:isInMenu( id )
{
for( new a; a < g_mapVoteNum; a++ )
if( id == g_nextName[a] ) return true

return false
}

public countDown( timer )
{
if( timer )
{
client_cmd( 0 ,"spk ^"fvox/%s^"", speak[timer-1] )
say_hudmessage( 0, 64, 64, 64, 0.025, -1.0, 0, 0.0, 1.03, 0.0, 0.0, 4, "%L %L", AUTO_LANG, "CHOOSE_NEXTM", AUTO_LANG, "VOTE_COUNTER", timer, g_MENU )
set_task(1.0, "countDown", --timer)
}

else
set_task( 0.01, "showMenu" )
}

public showMenu( )
{
new Float:votetime = floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 )

new menu[512], players[32], player, num
get_players( players, num, "ch" )

for( new i; i < num; i++ )
{
player = players[i]

formatex( g_MENU_title, charsmax( g_MENU_title ), g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", player, "CHOOSE_NEXTM" )
formatex( menu, charsmax( menu ), "%s%s", g_MENU_title, g_MENU )
show_menu( player, g_MENU_keys, menu, floatround( votetime ), g_MENU_name )
}

set_task( votetime + 0.5, "checkVotes" )

client_print( 0, print_chat, "%L", LANG_PLAYER, "TIME_CHOOSE" )
client_cmd( 0, "spk Gman/Gman_Choose%d", random_num( 1, 2 ) )
log_amx( "Vote: Voting for the nextmap started" )
}

public checkVotes( )
{
new b = 0

for( new a; a < g_mapVoteNum; ++a )
if( g_voteCount[b] < g_voteCount[a] ) b = a

if( g_voteCount[SELECTMAPS] > g_voteCount[b] && g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS + 1] )
{
if( !g_timelimit )
g_timelimit = get_pcvar_float( pcv_mp_timelimit )

new Float:steptime = get_pcvar_float( pcv_extendmap_step )

new mapname[32]
get_mapname( mapname, charsmax( mapname ) )

set_pcvar_float( pcv_mp_timelimit, get_pcvar_float( pcv_mp_timelimit ) + steptime )
client_print( 0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
log_amx( "Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime )

return
}

new smap[32]
if( g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b] )
{
copy( smap, charsmax( smap ), g_mapName[g_nextName[b]] )
set_pcvar_string( pcv_amx_nextmap, smap )
}

get_pcvar_string( pcv_amx_nextmap, smap, charsmax( smap ) )
client_print( 0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
log_amx( "Vote: Voting for the nextmap finished. The nextmap will be %s", smap )

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

if( g_rtv )
{
if( pcv_lastround && get_pcvar_num( pcv_lastround ) )
{
if( !g_timelimit )
g_timelimit = get_pcvar_float( pcv_mp_timelimit )

set_pcvar_float( pcv_mp_timelimit, 0.0 )

g_rtv = false
g_changemap = true
g_lastround = false

say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" )

return
}

else
g_rtv = false
}

else if( num > 1 )
{
if( pcv_lastround )
{
set_task( 90.0 - floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 ), "initiateLastRound", 23478, "", 0, "d" )
return
}
}

set_task( 1.0, "delayMapChange" )
}

public initiateLastRound( )
{
if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE

if( !g_timelimit )
g_timelimit = get_pcvar_float( pcv_mp_timelimit )

g_lastround = true
set_pcvar_float( pcv_mp_timelimit, 0.0 )

say_hudmessage( 0, 100, 200, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_COMING" )

return PLUGIN_CONTINUE
}

public evRoundStart( )
{
if( !pcv_lastround ) return PLUGIN_CONTINUE

if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE

if( g_lastround )
{
g_changemap = true
g_lastround = false

say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" )
}

else if( g_changemap )
{
/*
message_begin ( MSG_ALL, SVC_INTERMISSION )
message_end ( )
*/

set_pcvar_float( pcv_mp_timelimit, 0.01 )
}

return PLUGIN_CONTINUE
}

public mapChange ( )
{
new Float:chattime = get_pcvar_float ( pcv_mp_chattime )

if ( chattime < 3.0 )
{
chattime = 3.0
set_pcvar_float ( pcv_mp_chattime, chattime )
}

set_task( chattime - 1.0, "delayMapChange" )

return PLUGIN_CONTINUE
}

public delayMapChange( )
{
new nextmap[32]
get_pcvar_string( pcv_amx_nextmap, nextmap, charsmax( nextmap ) )
server_cmd( "changelevel %s", nextmap )
}

loadSettings( filename[] )
{
if( !file_exists( filename ) )
{
log_amx( "Mapcycle file ^"%s^" not found", filename )
return 0
}

g_mapNums = 0

new currentMap[32], map[32], string[256]
get_mapname( currentMap, charsmax( currentMap ) )

new file = fopen( filename, "r" )

while( !feof( file ) )
{
fgets( file, string, charsmax( string ) )

if
(
( string[0] != ';' ) &&
( string[0] != '/' ) &&
parse( string, map, charsmax( map ) ) &&
isValidMap( map, charsmax( map ), currentMap ) &&
isMapCycle( map ) == -1
)
{
copy( g_mapName[g_mapNums++], charsmax( g_mapName[] ), map )
}

}

fclose( file )

return g_mapNums
}

stock bool:isValidMap( map[], const len, const currentMap[] )
{
remove_quotes ( map )
strtolower( map )

while( replace( map, len, "/", "" ) ) {}
while( replace( map, len, "\", "" ) ) {}
while( replace( map, len, ":", "" ) ) {}
while( replace( map, len, "*", "" ) ) {}
while( replace( map, len, "?", "" ) ) {}
while( replace( map, len, ">", "" ) ) {}
while( replace( map, len, "<", "" ) ) {}
while( replace( map, len, "|", "" ) ) {}
while( replace( map, len, ".", "" ) ) {}

if( is_map_valid( map ) && !equali( map, g_lastMap ) && !equali( map, currentMap ) ) return true

return false
}

stock isMapCycle( map[] )
{
for( new i; i < g_mapNums; i++ )
if( equali( g_mapName[i], map ) ) return i

return -1
}

public team_score( )
{
new team[2]

read_data( 1, team, 1 )
g_teamScore[( team[0]=='C' ) ? 0 : 1] = read_data( 2 )
}

public pcvar_register( const pcvar_name[], const pcvar_value[] )
{
new pcvar_index = get_cvar_pointer( pcvar_name )

if( !pcvar_index )
pcvar_index = register_cvar( pcvar_name, pcvar_value )

return pcvar_index
}

stock say_hudmessage( id, red=255, green=255, blue=255, Float:x=0.05, Float:y=0.45, effects=0, Float:fxtime=6.0, Float:holdtime=5.0, Float:fadeintime=0.5, Float:fadeouttime=0.15, channel=4, msg[], any:... )
{
new arg_num = numargs()
new arg_langid[16], arg_langcount

for( new i = 12; i < arg_num; i++ )
if( getarg( i ) == AUTO_LANG )
arg_langid[arg_langcount++] = i

new players[32], player, num

if( id )
{
players[0] = id
num = 1
}

else
get_players( players, num )

set_hudmessage( red, green, blue, x, y, effects, fxtime, holdtime, fadeintime, fadeouttime, channel )

new message[512]

for( new i; i < num; i++ )
{
player = players[i]

if( !is_user_connected( player ) ) continue

for( new j; j < arg_langcount; j++ )
setarg( arg_langid[j], 0, player )

vformat( message, charsmax( message ), msg, 14 )
show_hudmessage( player, message )
}
}

public cmd_say_rtv( id )
{
if( get_gametime( ) < ( get_pcvar_float( pcv_vote_delay ) * 60.0 ) )
{
new timeleft = floatround( get_pcvar_float( pcv_vote_delay ) * 60.0 - get_gametime( ) )

client_print( id, print_chat, "%L", id, "RTV_NOTALLOWED", timeleft / 60, timeleft % 60 )
}

else
{
if( g_rtv_vote[id - 1] == id ) client_print( id, print_chat, "%L", id, "RTV_ALREADY" )

else
{
g_rtv_vote[id - 1] = id
g_rtv_count++

static players[32], num
get_players( players, num, "ch" )

new Float:voteratio = floatclamp( get_pcvar_float ( pcv_votemap_ratio ), 0.0, 1.0 )

num = floatround( voteratio * num )

if( num <= g_rtv_count )
{
g_rtv = true
voteNextmap( )

return PLUGIN_CONTINUE
}

static name[32]
get_user_name( id, name, charsmax( name ) )

client_print( 0, print_chat, "%L", LANG_PLAYER, "RTV_ADDVOTE", name, num - g_rtv_count, floatround( voteratio * 100.0 ) )
}
}

return PLUGIN_CONTINUE
}

public client_disconnect( id )
{
if( g_rtv_vote[id - 1] == id )
{
g_rtv_vote[id - 1] = 0
g_rtv_count--
}
}

public plugin_end( )
{
if( g_timelimit )
set_pcvar_float( pcv_mp_timelimit, g_timelimit )

new current_map[32]
get_mapname( current_map, charsmax( current_map ) )

set_localinfo( "lastMap", current_map )

return PLUGIN_CONTINUE
}
и
mapsmenu.sma
/* AMX Mod X
* Maps Menu Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/

#include <amxmodx>
#include <amxmisc>

new Array:g_mapName;
new g_mapNums
new g_menuPosition[33]

new g_voteCount[5]

new g_voteSelected[33][4]
new g_voteSelectedNum[33]

new g_coloredMenus

new g_choosed

public plugin_init()
{
register_plugin("Maps Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("mapsmenu.txt")
register_dictionary("common.txt")
register_clcmd("amx_mapmenu", "cmdMapsMenu", ADMIN_MAP, "- displays changelevel menu")
register_clcmd("amx_votemapmenu", "cmdVoteMapMenu", ADMIN_VOTE, "- displays votemap menu")

register_menucmd(register_menuid("Changelevel Menu"), 1023, "actionMapsMenu")
register_menucmd(register_menuid("Which map do you want?"), 527, "voteCount")
register_menucmd(register_menuid("Change map to"), 527, "voteCount")
register_menucmd(register_menuid("Votemap Menu"), 1023, "actionVoteMapMenu")
register_menucmd(register_menuid("The winner: "), 3, "actionResult")

g_mapName=ArrayCreate(32);

new maps_ini_file[64];
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);

if (!file_exists(maps_ini_file))
get_cvar_string("mapcyclefile", maps_ini_file, sizeof(maps_ini_file) - 1);

if (!file_exists(maps_ini_file))
format(maps_ini_file, 63, "mapcycle.txt")

load_settings(maps_ini_file)

g_coloredMenus = colored_menus()
}

public autoRefuse()
{
log_amx("Vote: %L", "en", "RESULT_REF")
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_REF")
}

public actionResult(id, key)
{
remove_task(4545454)

switch (key)
{
case 0:
{
new _modName[10]
get_modname(_modName, 9)

if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}

new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));

set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1)
log_amx("Vote: %L", "en", "RESULT_ACC")
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_ACC")
}
case 1: autoRefuse()
}

return PLUGIN_HANDLED
}

public checkVotes(id)
{
id -= 34567
new num, ppl[32], a = 0

get_players(ppl, num, "c")
if (num == 0) num = 1
g_choosed = -1

for (new i = 0; i < g_voteSelectedNum[id]; ++i)
if (g_voteCount[a] < g_voteCount[i])
a = i

new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3] + g_voteCount[4]
new iRatio = votesNum ? floatround(get_cvar_float("amx_votemap_ratio") * float(votesNum), floatround_ceil) : 1
new iResult = g_voteCount[a]

if (iResult >= iRatio)
{
g_choosed = g_voteSelected[id][a]
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
client_print(0, print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", tempMap);
log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", tempMap);
}

if (g_choosed != -1)
{
if (is_user_connected(id))
{
new menuBody[512]
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", tempMap)

len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT")
format(menuBody[len], 511-len, "^n1. %L^n2. %L", id, "YES", id, "NO")

show_menu(id, 0x03, menuBody, 10, "The winner: ")
set_task(10.0, "autoRefuse", 4545454)
} else {
new _modName[10]
get_modname(_modName, 9)

if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1)
}
} else {
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTE_FAILED")
log_amx("Vote: %L", "en", "VOTE_FAILED")
}

remove_task(34567 + id)
}

public voteCount(id, key)
{
if (key > 3)
{
client_print(0, print_chat, "%L", LANG_PLAYER, "VOT_CANC")
remove_task(34567 + id)
set_cvar_float("amx_last_voting", get_gametime())
log_amx("Vote: Cancel vote session")

return PLUGIN_HANDLED
}

if (get_cvar_float("amx_vote_answers"))
{
new name[32]

get_user_name(id, name, 31)
client_print(0, print_chat, "%L", LANG_PLAYER, "X_VOTED_FOR", name, key + 1)
}

++g_voteCount[key]

return PLUGIN_HANDLED
}

isMapSelected(id, pos)
{
for (new a = 0; a < g_voteSelectedNum[id]; ++a)
if (g_voteSelected[id][a] == pos)
return 1
return 0
}

displayVoteMapsMenu(id, pos)
{
if (pos < 0)
return

new menuBody[512], b = 0, start = pos * 7

if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0

new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "VOTEMAP_MENU", pos + 1, (g_mapNums / 7 + ((g_mapNums % 7) ? 1 : 0)))
new end = start + 7, keys = MENU_KEY_0

if (end > g_mapNums)
end = g_mapNums

new tempMap[32];
for (new a = start; a < end; ++a)
{
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));
if (g_voteSelectedNum[id] == 4 || isMapSelected(id, pos * 7 + b))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, tempMap)
else
len += format(menuBody[len], 511-len, "#. %s^n", tempMap)
} else {
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, tempMap)
}
}

if (g_voteSelectedNum[id])
{
keys |= MENU_KEY_8
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "START_VOT")
}
else
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\d8. %L^n\w" : "^n#. %L^n", id, "START_VOT")

if (end != g_mapNums)
{
len += format(menuBody[len], 511-len, "^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
len += format(menuBody[len], 511-len, "^n0. %L^n", id, pos ? "BACK" : "EXIT")

if (g_voteSelectedNum[id])
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\y%L:^n\w" : "^n%L:^n", id, "SEL_MAPS")
else
len += format(menuBody[len], 511-len, "^n^n")

for (new c = 0; c < 4; c++)
{
if (c < g_voteSelectedNum[id])
{
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], 511-len, "%s^n", tempMap)
}
else
len += format(menuBody[len], 511-len, "^n")
}

new menuName[64]
format(menuName, 63, "%L", "en", "VOTEMAP_MENU")

show_menu(id, keys, menuBody, -1, menuName)
}

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

if (get_cvar_float("amx_last_voting") > get_gametime())
{
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
return PLUGIN_HANDLED
}

g_voteSelectedNum[id] = 0

if (g_mapNums)
{
displayVoteMapsMenu(id, g_menuPosition[id] = 0)
} else {
console_print(id, "%L", id, "NO_MAPS_MENU")
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
}

return PLUGIN_HANDLED
}

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

if (g_mapNums)
{
displayMapsMenu(id, g_menuPosition[id] = 0)
} else {
console_print(id, "%L", id, "NO_MAPS_MENU")
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
}

return PLUGIN_HANDLED
}

public delayedChange(mapname[])
server_cmd("changelevel %s", mapname)

public actionVoteMapMenu(id, key)
{
new tempMap[32];
switch (key)
{
case 7:
{
new Float:voting = get_cvar_float("amx_last_voting")

if (voting > get_gametime())
{
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
return PLUGIN_HANDLED
}

if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
client_print(id, print_chat, "%L", id, "VOT_NOW_ALLOW")
return PLUGIN_HANDLED
}

g_voteCount = {0, 0, 0, 0, 0}

new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
new iVoteTime = floatround(vote_time)

set_task(vote_time, "checkVotes", 34567 + id)

new menuBody[512]
new players[32]
new pnum, keys, len

get_players(players, pnum)

if (g_voteSelectedNum[id] > 1)
{
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")

for (new c = 0; c < g_voteSelectedNum[id]; ++c)
{
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], 511, "%d. %s^n", c + 1, tempMap)
keys |= (1<<c)
}

keys |= (1<<8)
len += format(menuBody[len], 511, "^n9. %L^n", id, "NONE")
} else {
ArrayGetString(g_mapName, g_voteSelected[id][0], tempMap, charsmax(tempMap));
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", tempMap, id, "YES", id, "NO")
keys = MENU_KEY_1|MENU_KEY_2
}

new menuName[64]
format(menuName, 63, "%L", "en", "WHICH_MAP")

for (new b = 0; b < pnum; ++b)
if (players[b] != id)
show_menu(players[b], keys, menuBody, iVoteTime, menuName)

format(menuBody[len], 511, "^n0. %L", id, "CANC_VOTE")
keys |= MENU_KEY_0
show_menu(id, keys, menuBody, iVoteTime, menuName)

new authid[32], name[32]

get_user_authid(id, authid, 31)
get_user_name(id, name, 31)

show_activity_key("ADMIN_V_MAP_1", "ADMIN_V_MAP_2", name);

new tempMapA[32];
new tempMapB[32];
new tempMapC[32];
new tempMapD[32];
if (g_voteSelectedNum[id] > 0)
{
ArrayGetString(g_mapName, g_voteSelected[id][0], tempMapA, charsmax(tempMapA));
}
else
{
copy(tempMapA, charsmax(tempMapA), "");
}
if (g_voteSelectedNum[id] > 1)
{
ArrayGetString(g_mapName, g_voteSelected[id][1], tempMapB, charsmax(tempMapB));
}
else
{
copy(tempMapB, charsmax(tempMapB), "");
}
if (g_voteSelectedNum[id] > 2)
{
ArrayGetString(g_mapName, g_voteSelected[id][2], tempMapC, charsmax(tempMapC));
}
else
{
copy(tempMapC, charsmax(tempMapC), "");
}
if (g_voteSelectedNum[id] > 3)
{
ArrayGetString(g_mapName, g_voteSelected[id][3], tempMapD, charsmax(tempMapD));
}
else
{
copy(tempMapD, charsmax(tempMapD), "");
}

log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
name, get_user_userid(id), authid,
tempMapA, tempMapB, tempMapC, tempMapD)
}
case 8: displayVoteMapsMenu(id, ++g_menuPosition[id])
case 9: displayVoteMapsMenu(id, --g_menuPosition[id])
default:
{
g_voteSelected[id][g_voteSelectedNum[id]++] = g_menuPosition[id] * 7 + key
displayVoteMapsMenu(id, g_menuPosition[id])
}
}

return PLUGIN_HANDLED
}

public actionMapsMenu(id, key)
{
switch (key)
{
case 8: displayMapsMenu(id, ++g_menuPosition[id])
case 9: displayMapsMenu(id, --g_menuPosition[id])
default:
{
new a = g_menuPosition[id] * 8 + key
new _modName[10]

get_modname(_modName, 9)
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}

new authid[32], name[32]

get_user_authid(id, authid, 31)
get_user_name(id, name, 31)

new tempMap[32];
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));

show_activity_key("ADMIN_CHANGEL_1", "ADMIN_CHANGEL_2", name, tempMap);

log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, tempMap)
set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1)
/* displayMapsMenu(id, g_menuPosition[id]) */
}
}

return PLUGIN_HANDLED
}

displayMapsMenu(id, pos)
{
if (pos < 0)
return

new menuBody[512]
new tempMap[32]
new start = pos * 8
new b = 0

if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0

new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CHANGLE_MENU", pos + 1, (g_mapNums / 8 + ((g_mapNums % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0

if (end > g_mapNums)
end = g_mapNums

for (new a = start; a < end; ++a)
{
keys |= (1<<b)
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, tempMap)
}

if (end != g_mapNums)
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")

new menuName[64]
format(menuName, 63, "%L", "en", "CHANGLE_MENU")

show_menu(id, keys, menuBody, -1, menuName)
}
stock bool:ValidMap(mapname[])
{
if ( is_map_valid(mapname) )
{
return true;
}
// If the is_map_valid check failed, check the end of the string
new len = strlen(mapname) - 4;

// The mapname was too short to possibly house the .bsp extension
if (len < 0)
{
return false;
}
if ( equali(mapname[len], ".bsp") )
{
// If the ending was .bsp, then cut it off.
// the string is byref'ed, so this copies back to the loaded text.
mapname[len] = '^0';

// recheck
if ( is_map_valid(mapname) )
{
return true;
}
}

return false;
}

load_settings(filename[])
{
new fp = fopen(filename, "r");

if (!fp)
{
return 0;
}


new text[256];
new tempMap[32];

while (!feof(fp))
{
fgets(fp, text, charsmax(text));

if (text[0] == ';')
{
continue;
}
if (parse(text, tempMap, charsmax(tempMap)) < 1)
{
continue;
}
if (!ValidMap(tempMap))
{
continue;
}

ArrayPushString(g_mapName, tempMap);
g_mapNums++;
}

return 1;
}

ps.gif Если не туда написал - не бейте :)

Отредактировал: kupuk96, - 1.11.2010, 14:35
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Archipelago
сообщение 1.11.2010, 14:40
Сообщение #2


Стаж: 16 лет

Сообщений: 520
Благодарностей: 67
Полезность: 21

Цитата(kupuk96 @ 1.11.2010, 14:30) *
привет всем)
значит ошибка у меня такая:
нельзя сменить карту и сделать голосование за карту.
стоят все флаги.
в чём может быть проблема?
вот список плагинов:
plugins.ini
advanced_bans.amxx
csf_opengl32.amxx
csf_anticheat.amxx
admin.amxx
adminchat.amxx
admincmd.amxx
adminvote.amxx
admin_name.amxx
admin_vgk.amxx
ad_manager.amxx
amx_hpk.amxx
anti_fullupdate_spam2.amxx
auto_rr.amxx
cmdmenu.amxx
FullSpawns.amxx
game_destroyer.amxx
he_selfdamage.amxx
imessage.amxx
info_rank.amxx
mapchooser.amxx
mapsmenu.amxx
menufront.amxx
miscstats.amxx
nextmap.amxx
no_reklama_advanced.amxx
pbk.amxx
plmenu.amxx
restmenu.amxx
sillyc4.amxx
statscfg.amxx
statsx_shell.amxx
timeleft.amxx
voteban.amxx

что-то менял в mapchooser, посмотрите мб дело в нём
mapchooser.sma
/*
Nextmap Chooser
Интегрированы: Lastround & RockTheVote

Использован код следующих плагинов, за что их авторам большая благодарность:
1. Nextmap Chooser Plugin
by the AMX Mod X Development Team
originally developed by OLO

2. RockTheVote v1.8
Made by DA

Переменные:
amx_extendmap_max (default: 45) - Максимальная длительность карты в минутах
amx_extendmap_step (default: 15) - Время продления карты за 1 раз в минутах
amx_vote_time (default: 15) - Длительность голосования в секундах
amx_vote_delay (default: 15) - Отсрочка голосования в минутах от начала карты
amx_votemap_ratio (default: 0.6) - Процент голосов для начала голосования
(по-умолчанию 60%)
amx_lastround (default: 1) - Производить смену карты по окончании раунда.

Rebuilding by UFPS.Team
*/


#include <amxmodx>
#include <amxmisc>

#define PLUGIN_NAME "Nextmap Chooser"
#define PLUGIN_VERSION "1.9"
#define PLUGIN_AUTHOR "UFPS.Team"

#define SELECTMAPS 6
#define MAPS_MAX 128
#define AUTO_LANG -76

#define charsmax(%1) (sizeof(%1)-1)


new g_mapNums
new g_mapName [MAPS_MAX][32]

new g_nextName [SELECTMAPS]
new g_voteCount [SELECTMAPS + 2]
new g_mapVoteNum
new g_teamScore [2]
new g_lastMap [32]
new g_rtv_count
new g_rtv_vote [33]

new g_MENU [512]
new g_MENU_keys = ( 1 << SELECTMAPS + 1 )
new g_MENU_name [64]
new g_MENU_title [128]

new const speak[][] = { "one", "two", "three", "four", "five" }

new g_coloredMenus = 0
new bool:g_rtv = false
new bool:g_lastround = false
new bool:g_changemap = false
new bool:g_selected = false
new Float:g_timelimit = 0.0

new pcv_lastround
new pcv_extendmap_max
new pcv_extendmap_step
new pcv_vote_time
new pcv_vote_delay
new pcv_votemap_ratio
new pcv_amx_nextmap
new pcv_mp_chattime
new pcv_mp_timelimit
new pcv_mp_winlimit
new pcv_mp_maxrounds


public plugin_init( )
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )

register_dictionary ( "common.txt" )
register_dictionary ( "lastround.txt" )
register_dictionary ( "mapchooser.txt" )

register_clcmd( "say rockthevote", "cmd_say_rtv" )
register_clcmd( "say /rockthevote", "cmd_say_rtv" )
register_clcmd( "say rtv", "cmd_say_rtv" )
register_clcmd( "say /rtv", "cmd_say_rtv" )

register_clcmd( "say_team rockthevote", "cmd_say_rtv" )
register_clcmd( "say_team /rockthevote", "cmd_say_rtv" )
register_clcmd( "say_team rtv", "cmd_say_rtv" )
register_clcmd( "say_team /rtv", "cmd_say_rtv" )

pcv_vote_time = pcvar_register( "amx_vote_time", "15" )
pcv_vote_delay = pcvar_register( "amx_vote_delay", "15" )
pcv_votemap_ratio = pcvar_register( "amx_votemap_ratio", "0.6" )
pcv_extendmap_max = pcvar_register( "amx_extendmap_max", "45" )
pcv_extendmap_step = pcvar_register( "amx_extendmap_step", "15" )

pcv_mp_chattime = get_cvar_pointer( "mp_chattime" )
pcv_mp_timelimit = get_cvar_pointer( "mp_timelimit" )
pcv_mp_winlimit = get_cvar_pointer( "mp_winlimit" )
pcv_mp_maxrounds = get_cvar_pointer( "mp_maxrounds" )
pcv_amx_nextmap = get_cvar_pointer( "amx_nextmap" )

if( !pcv_amx_nextmap )
pcv_amx_nextmap = register_cvar( "amx_nextmap", "", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_SPONLY )

if( cstrike_running( ) )
{
pcv_lastround = register_cvar( "amx_lastround", "1" )
register_event( "TeamScore", "team_score", "a" )
register_logevent( "evRoundStart", 2, "0=World triggered", "1=Round_Start" )
}

register_event( "30", "mapChange", "a" )

g_coloredMenus = colored_menus( )

get_localinfo( "lastMap", g_lastMap, charsmax( g_lastMap ) )
set_localinfo( "lastMap", "" )

set_cvar_float( "sv_restart", 1.0 )
}

public plugin_cfg( )
{
new mapcycle[64]
get_configsdir( mapcycle, charsmax( mapcycle ) )
format( mapcycle, charsmax( mapcycle ), "%s/maps.ini", mapcycle )

if( !file_exists( mapcycle ) )
get_cvar_string( "mapcyclefile", mapcycle, charsmax( mapcycle ) )

if( !file_exists( mapcycle ) )
copy( mapcycle, charsmax( mapcycle ), "mapcycle.txt" )

if( loadSettings( mapcycle) )
set_task( 15.0, "voteNextmap", 987456, "", 0, "b" )

formatex( g_MENU_name, charsmax( g_MENU_name ), "%L", "en", "CHOOSE_NEXTM" )
register_menucmd( register_menuid( g_MENU_name ), ( -1 ^ ( -1 << ( SELECTMAPS + 2 ) ) ), "countVote" )
}

public countVote( id, key )
{
if( get_cvar_float( "amx_vote_answers" ) )
{
new name[32]
get_user_name( id, name, charsmax( name ) )

if( key == SELECTMAPS )
client_print( 0, print_chat, "%L", LANG_PLAYER, "CHOSE_EXT", name )

else if( key < SELECTMAPS )
{
new map[32]
copy( map, charsmax( map ), g_mapName[g_nextName[key]] )
client_print( 0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, map )
}
}

g_voteCount[key]++

return PLUGIN_HANDLED
}

public voteNextmap( )
{
if( !g_mapNums ) return 0

new winlimit = get_pcvar_num( pcv_mp_winlimit )
new maxrounds = get_pcvar_num( pcv_mp_maxrounds )

if( g_rtv )
{
winlimit = 0
maxrounds = -1
}

if( winlimit )
{
new c = winlimit - 2

if( ( c > g_teamScore[0] ) && ( c > g_teamScore[1] ) )
{
g_selected = false
return 0
}
}

else if( maxrounds )
{
if( ( maxrounds - 2 ) > ( g_teamScore[0] + g_teamScore[1] ) )
{
g_selected = false
return 0
}
}

else
{
new timeleft = get_timeleft( )

if( timeleft < 1 || timeleft > 129 )
{
g_selected = false
return 0
}
}

if( g_selected ) return 0

g_selected = true

new pos, a

g_MENU_keys = ( 1 << SELECTMAPS + 1 )

new dmax = clamp( g_mapNums, 0, SELECTMAPS )

for( g_mapVoteNum = 0; g_mapVoteNum < dmax; g_mapVoteNum++ )
{
a = random_num( 0, g_mapNums - 1 )

while( isInMenu( a ) ) { if( ++a >= g_mapNums ) a = 0; }

g_nextName[g_mapVoteNum] = a
pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %s^n", g_mapVoteNum + 1, g_mapName[a] )
g_MENU_keys |= ( 1 << g_mapVoteNum )
g_voteCount[g_mapVoteNum] = 0
}

g_MENU[pos++] = '^n'
g_voteCount[SELECTMAPS] = 0
g_voteCount[SELECTMAPS + 1] = 0

new mapname[32]
get_mapname( mapname, charsmax( mapname ) )

if( ( winlimit + maxrounds ) == 0 && ( get_pcvar_float( pcv_mp_timelimit ) < get_pcvar_float( pcv_extendmap_max ) ) )
{
pos += format( g_MENU[pos], charsmax( g_MENU ), "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname )
g_MENU_keys |= ( 1 << SELECTMAPS )
}

format( g_MENU[pos], charsmax( g_MENU ), "%d. %L", SELECTMAPS + 2, LANG_SERVER, "NONE" )
set_task( 1.0, "countDown", 5 )

return 1
}

stock bool:isInMenu( id )
{
for( new a; a < g_mapVoteNum; a++ )
if( id == g_nextName[a] ) return true

return false
}

public countDown( timer )
{
if( timer )
{
client_cmd( 0 ,"spk ^"fvox/%s^"", speak[timer-1] )
say_hudmessage( 0, 64, 64, 64, 0.025, -1.0, 0, 0.0, 1.03, 0.0, 0.0, 4, "%L %L", AUTO_LANG, "CHOOSE_NEXTM", AUTO_LANG, "VOTE_COUNTER", timer, g_MENU )
set_task(1.0, "countDown", --timer)
}

else
set_task( 0.01, "showMenu" )
}

public showMenu( )
{
new Float:votetime = floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 )

new menu[512], players[32], player, num
get_players( players, num, "ch" )

for( new i; i < num; i++ )
{
player = players[i]

formatex( g_MENU_title, charsmax( g_MENU_title ), g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", player, "CHOOSE_NEXTM" )
formatex( menu, charsmax( menu ), "%s%s", g_MENU_title, g_MENU )
show_menu( player, g_MENU_keys, menu, floatround( votetime ), g_MENU_name )
}

set_task( votetime + 0.5, "checkVotes" )

client_print( 0, print_chat, "%L", LANG_PLAYER, "TIME_CHOOSE" )
client_cmd( 0, "spk Gman/Gman_Choose%d", random_num( 1, 2 ) )
log_amx( "Vote: Voting for the nextmap started" )
}

public checkVotes( )
{
new b = 0

for( new a; a < g_mapVoteNum; ++a )
if( g_voteCount[b] < g_voteCount[a] ) b = a

if( g_voteCount[SELECTMAPS] > g_voteCount[b] && g_voteCount[SELECTMAPS] > g_voteCount[SELECTMAPS + 1] )
{
if( !g_timelimit )
g_timelimit = get_pcvar_float( pcv_mp_timelimit )

new Float:steptime = get_pcvar_float( pcv_extendmap_step )

new mapname[32]
get_mapname( mapname, charsmax( mapname ) )

set_pcvar_float( pcv_mp_timelimit, get_pcvar_float( pcv_mp_timelimit ) + steptime )
client_print( 0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
log_amx( "Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime )

return
}

new smap[32]
if( g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b] )
{
copy( smap, charsmax( smap ), g_mapName[g_nextName[b]] )
set_pcvar_string( pcv_amx_nextmap, smap )
}

get_pcvar_string( pcv_amx_nextmap, smap, charsmax( smap ) )
client_print( 0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
log_amx( "Vote: Voting for the nextmap finished. The nextmap will be %s", smap )

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

if( g_rtv )
{
if( pcv_lastround && get_pcvar_num( pcv_lastround ) )
{
if( !g_timelimit )
g_timelimit = get_pcvar_float( pcv_mp_timelimit )

set_pcvar_float( pcv_mp_timelimit, 0.0 )

g_rtv = false
g_changemap = true
g_lastround = false

say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" )

return
}

else
g_rtv = false
}

else if( num > 1 )
{
if( pcv_lastround )
{
set_task( 90.0 - floatclamp( get_pcvar_float ( pcv_vote_time ), 10.0, 60.0 ), "initiateLastRound", 23478, "", 0, "d" )
return
}
}

set_task( 1.0, "delayMapChange" )
}

public initiateLastRound( )
{
if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE

if( !g_timelimit )
g_timelimit = get_pcvar_float( pcv_mp_timelimit )

g_lastround = true
set_pcvar_float( pcv_mp_timelimit, 0.0 )

say_hudmessage( 0, 100, 200, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_COMING" )

return PLUGIN_CONTINUE
}

public evRoundStart( )
{
if( !pcv_lastround ) return PLUGIN_CONTINUE

if( !get_pcvar_num( pcv_lastround ) ) return PLUGIN_CONTINUE

if( g_lastround )
{
g_changemap = true
g_lastround = false

say_hudmessage( 0, 210, 0, 0, 0.02, 0.21, 1, 20.0, 10.0, 0.5, 0.15, 4, "%L", AUTO_LANG, "FINAL_ROUND" )
}

else if( g_changemap )
{
/*
message_begin ( MSG_ALL, SVC_INTERMISSION )
message_end ( )
*/

set_pcvar_float( pcv_mp_timelimit, 0.01 )
}

return PLUGIN_CONTINUE
}

public mapChange ( )
{
new Float:chattime = get_pcvar_float ( pcv_mp_chattime )

if ( chattime < 3.0 )
{
chattime = 3.0
set_pcvar_float ( pcv_mp_chattime, chattime )
}

set_task( chattime - 1.0, "delayMapChange" )

return PLUGIN_CONTINUE
}

public delayMapChange( )
{
new nextmap[32]
get_pcvar_string( pcv_amx_nextmap, nextmap, charsmax( nextmap ) )
server_cmd( "changelevel %s", nextmap )
}

loadSettings( filename[] )
{
if( !file_exists( filename ) )
{
log_amx( "Mapcycle file ^"%s^" not found", filename )
return 0
}

g_mapNums = 0

new currentMap[32], map[32], string[256]
get_mapname( currentMap, charsmax( currentMap ) )

new file = fopen( filename, "r" )

while( !feof( file ) )
{
fgets( file, string, charsmax( string ) )

if
(
( string[0] != ';' ) &&
( string[0] != '/' ) &&
parse( string, map, charsmax( map ) ) &&
isValidMap( map, charsmax( map ), currentMap ) &&
isMapCycle( map ) == -1
)
{
copy( g_mapName[g_mapNums++], charsmax( g_mapName[] ), map )
}

}

fclose( file )

return g_mapNums
}

stock bool:isValidMap( map[], const len, const currentMap[] )
{
remove_quotes ( map )
strtolower( map )

while( replace( map, len, "/", "" ) ) {}
while( replace( map, len, "\", "" ) ) {}
while( replace( map, len, ":", "" ) ) {}
while( replace( map, len, "*", "" ) ) {}
while( replace( map, len, "?", "" ) ) {}
while( replace( map, len, ">", "" ) ) {}
while( replace( map, len, "<", "" ) ) {}
while( replace( map, len, "|", "" ) ) {}
while( replace( map, len, ".", "" ) ) {}

if( is_map_valid( map ) && !equali( map, g_lastMap ) && !equali( map, currentMap ) ) return true

return false
}

stock isMapCycle( map[] )
{
for( new i; i < g_mapNums; i++ )
if( equali( g_mapName[i], map ) ) return i

return -1
}

public team_score( )
{
new team[2]

read_data( 1, team, 1 )
g_teamScore[( team[0]=='C' ) ? 0 : 1] = read_data( 2 )
}

public pcvar_register( const pcvar_name[], const pcvar_value[] )
{
new pcvar_index = get_cvar_pointer( pcvar_name )

if( !pcvar_index )
pcvar_index = register_cvar( pcvar_name, pcvar_value )

return pcvar_index
}

stock say_hudmessage( id, red=255, green=255, blue=255, Float:x=0.05, Float:y=0.45, effects=0, Float:fxtime=6.0, Float:holdtime=5.0, Float:fadeintime=0.5, Float:fadeouttime=0.15, channel=4, msg[], any:... )
{
new arg_num = numargs()
new arg_langid[16], arg_langcount

for( new i = 12; i < arg_num; i++ )
if( getarg( i ) == AUTO_LANG )
arg_langid[arg_langcount++] = i

new players[32], player, num

if( id )
{
players[0] = id
num = 1
}

else
get_players( players, num )

set_hudmessage( red, green, blue, x, y, effects, fxtime, holdtime, fadeintime, fadeouttime, channel )

new message[512]

for( new i; i < num; i++ )
{
player = players[i]

if( !is_user_connected( player ) ) continue

for( new j; j < arg_langcount; j++ )
setarg( arg_langid[j], 0, player )

vformat( message, charsmax( message ), msg, 14 )
show_hudmessage( player, message )
}
}

public cmd_say_rtv( id )
{
if( get_gametime( ) < ( get_pcvar_float( pcv_vote_delay ) * 60.0 ) )
{
new timeleft = floatround( get_pcvar_float( pcv_vote_delay ) * 60.0 - get_gametime( ) )

client_print( id, print_chat, "%L", id, "RTV_NOTALLOWED", timeleft / 60, timeleft % 60 )
}

else
{
if( g_rtv_vote[id - 1] == id ) client_print( id, print_chat, "%L", id, "RTV_ALREADY" )

else
{
g_rtv_vote[id - 1] = id
g_rtv_count++

static players[32], num
get_players( players, num, "ch" )

new Float:voteratio = floatclamp( get_pcvar_float ( pcv_votemap_ratio ), 0.0, 1.0 )

num = floatround( voteratio * num )

if( num <= g_rtv_count )
{
g_rtv = true
voteNextmap( )

return PLUGIN_CONTINUE
}

static name[32]
get_user_name( id, name, charsmax( name ) )

client_print( 0, print_chat, "%L", LANG_PLAYER, "RTV_ADDVOTE", name, num - g_rtv_count, floatround( voteratio * 100.0 ) )
}
}

return PLUGIN_CONTINUE
}

public client_disconnect( id )
{
if( g_rtv_vote[id - 1] == id )
{
g_rtv_vote[id - 1] = 0
g_rtv_count--
}
}

public plugin_end( )
{
if( g_timelimit )
set_pcvar_float( pcv_mp_timelimit, g_timelimit )

new current_map[32]
get_mapname( current_map, charsmax( current_map ) )

set_localinfo( "lastMap", current_map )

return PLUGIN_CONTINUE
}
и
mapsmenu.sma
/* AMX Mod X
* Maps Menu Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/

#include <amxmodx>
#include <amxmisc>

new Array:g_mapName;
new g_mapNums
new g_menuPosition[33]

new g_voteCount[5]

new g_voteSelected[33][4]
new g_voteSelectedNum[33]

new g_coloredMenus

new g_choosed

public plugin_init()
{
register_plugin("Maps Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("mapsmenu.txt")
register_dictionary("common.txt")
register_clcmd("amx_mapmenu", "cmdMapsMenu", ADMIN_MAP, "- displays changelevel menu")
register_clcmd("amx_votemapmenu", "cmdVoteMapMenu", ADMIN_VOTE, "- displays votemap menu")

register_menucmd(register_menuid("Changelevel Menu"), 1023, "actionMapsMenu")
register_menucmd(register_menuid("Which map do you want?"), 527, "voteCount")
register_menucmd(register_menuid("Change map to"), 527, "voteCount")
register_menucmd(register_menuid("Votemap Menu"), 1023, "actionVoteMapMenu")
register_menucmd(register_menuid("The winner: "), 3, "actionResult")

g_mapName=ArrayCreate(32);

new maps_ini_file[64];
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);

if (!file_exists(maps_ini_file))
get_cvar_string("mapcyclefile", maps_ini_file, sizeof(maps_ini_file) - 1);

if (!file_exists(maps_ini_file))
format(maps_ini_file, 63, "mapcycle.txt")

load_settings(maps_ini_file)

g_coloredMenus = colored_menus()
}

public autoRefuse()
{
log_amx("Vote: %L", "en", "RESULT_REF")
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_REF")
}

public actionResult(id, key)
{
remove_task(4545454)

switch (key)
{
case 0:
{
new _modName[10]
get_modname(_modName, 9)

if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}

new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));

set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1)
log_amx("Vote: %L", "en", "RESULT_ACC")
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_ACC")
}
case 1: autoRefuse()
}

return PLUGIN_HANDLED
}

public checkVotes(id)
{
id -= 34567
new num, ppl[32], a = 0

get_players(ppl, num, "c")
if (num == 0) num = 1
g_choosed = -1

for (new i = 0; i < g_voteSelectedNum[id]; ++i)
if (g_voteCount[a] < g_voteCount[i])
a = i

new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3] + g_voteCount[4]
new iRatio = votesNum ? floatround(get_cvar_float("amx_votemap_ratio") * float(votesNum), floatround_ceil) : 1
new iResult = g_voteCount[a]

if (iResult >= iRatio)
{
g_choosed = g_voteSelected[id][a]
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
client_print(0, print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", tempMap);
log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", tempMap);
}

if (g_choosed != -1)
{
if (is_user_connected(id))
{
new menuBody[512]
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", tempMap)

len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT")
format(menuBody[len], 511-len, "^n1. %L^n2. %L", id, "YES", id, "NO")

show_menu(id, 0x03, menuBody, 10, "The winner: ")
set_task(10.0, "autoRefuse", 4545454)
} else {
new _modName[10]
get_modname(_modName, 9)

if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1)
}
} else {
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTE_FAILED")
log_amx("Vote: %L", "en", "VOTE_FAILED")
}

remove_task(34567 + id)
}

public voteCount(id, key)
{
if (key > 3)
{
client_print(0, print_chat, "%L", LANG_PLAYER, "VOT_CANC")
remove_task(34567 + id)
set_cvar_float("amx_last_voting", get_gametime())
log_amx("Vote: Cancel vote session")

return PLUGIN_HANDLED
}

if (get_cvar_float("amx_vote_answers"))
{
new name[32]

get_user_name(id, name, 31)
client_print(0, print_chat, "%L", LANG_PLAYER, "X_VOTED_FOR", name, key + 1)
}

++g_voteCount[key]

return PLUGIN_HANDLED
}

isMapSelected(id, pos)
{
for (new a = 0; a < g_voteSelectedNum[id]; ++a)
if (g_voteSelected[id][a] == pos)
return 1
return 0
}

displayVoteMapsMenu(id, pos)
{
if (pos < 0)
return

new menuBody[512], b = 0, start = pos * 7

if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0

new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "VOTEMAP_MENU", pos + 1, (g_mapNums / 7 + ((g_mapNums % 7) ? 1 : 0)))
new end = start + 7, keys = MENU_KEY_0

if (end > g_mapNums)
end = g_mapNums

new tempMap[32];
for (new a = start; a < end; ++a)
{
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));
if (g_voteSelectedNum[id] == 4 || isMapSelected(id, pos * 7 + b))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, tempMap)
else
len += format(menuBody[len], 511-len, "#. %s^n", tempMap)
} else {
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, tempMap)
}
}

if (g_voteSelectedNum[id])
{
keys |= MENU_KEY_8
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "START_VOT")
}
else
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\d8. %L^n\w" : "^n#. %L^n", id, "START_VOT")

if (end != g_mapNums)
{
len += format(menuBody[len], 511-len, "^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
len += format(menuBody[len], 511-len, "^n0. %L^n", id, pos ? "BACK" : "EXIT")

if (g_voteSelectedNum[id])
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\y%L:^n\w" : "^n%L:^n", id, "SEL_MAPS")
else
len += format(menuBody[len], 511-len, "^n^n")

for (new c = 0; c < 4; c++)
{
if (c < g_voteSelectedNum[id])
{
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], 511-len, "%s^n", tempMap)
}
else
len += format(menuBody[len], 511-len, "^n")
}

new menuName[64]
format(menuName, 63, "%L", "en", "VOTEMAP_MENU")

show_menu(id, keys, menuBody, -1, menuName)
}

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

if (get_cvar_float("amx_last_voting") > get_gametime())
{
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
return PLUGIN_HANDLED
}

g_voteSelectedNum[id] = 0

if (g_mapNums)
{
displayVoteMapsMenu(id, g_menuPosition[id] = 0)
} else {
console_print(id, "%L", id, "NO_MAPS_MENU")
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
}

return PLUGIN_HANDLED
}

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

if (g_mapNums)
{
displayMapsMenu(id, g_menuPosition[id] = 0)
} else {
console_print(id, "%L", id, "NO_MAPS_MENU")
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
}

return PLUGIN_HANDLED
}

public delayedChange(mapname[])
server_cmd("changelevel %s", mapname)

public actionVoteMapMenu(id, key)
{
new tempMap[32];
switch (key)
{
case 7:
{
new Float:voting = get_cvar_float("amx_last_voting")

if (voting > get_gametime())
{
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
return PLUGIN_HANDLED
}

if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
client_print(id, print_chat, "%L", id, "VOT_NOW_ALLOW")
return PLUGIN_HANDLED
}

g_voteCount = {0, 0, 0, 0, 0}

new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
new iVoteTime = floatround(vote_time)

set_task(vote_time, "checkVotes", 34567 + id)

new menuBody[512]
new players[32]
new pnum, keys, len

get_players(players, pnum)

if (g_voteSelectedNum[id] > 1)
{
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")

for (new c = 0; c < g_voteSelectedNum[id]; ++c)
{
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], 511, "%d. %s^n", c + 1, tempMap)
keys |= (1<<c)
}

keys |= (1<<8)
len += format(menuBody[len], 511, "^n9. %L^n", id, "NONE")
} else {
ArrayGetString(g_mapName, g_voteSelected[id][0], tempMap, charsmax(tempMap));
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", tempMap, id, "YES", id, "NO")
keys = MENU_KEY_1|MENU_KEY_2
}

new menuName[64]
format(menuName, 63, "%L", "en", "WHICH_MAP")

for (new b = 0; b < pnum; ++b)
if (players[b] != id)
show_menu(players[b], keys, menuBody, iVoteTime, menuName)

format(menuBody[len], 511, "^n0. %L", id, "CANC_VOTE")
keys |= MENU_KEY_0
show_menu(id, keys, menuBody, iVoteTime, menuName)

new authid[32], name[32]

get_user_authid(id, authid, 31)
get_user_name(id, name, 31)

show_activity_key("ADMIN_V_MAP_1", "ADMIN_V_MAP_2", name);

new tempMapA[32];
new tempMapB[32];
new tempMapC[32];
new tempMapD[32];
if (g_voteSelectedNum[id] > 0)
{
ArrayGetString(g_mapName, g_voteSelected[id][0], tempMapA, charsmax(tempMapA));
}
else
{
copy(tempMapA, charsmax(tempMapA), "");
}
if (g_voteSelectedNum[id] > 1)
{
ArrayGetString(g_mapName, g_voteSelected[id][1], tempMapB, charsmax(tempMapB));
}
else
{
copy(tempMapB, charsmax(tempMapB), "");
}
if (g_voteSelectedNum[id] > 2)
{
ArrayGetString(g_mapName, g_voteSelected[id][2], tempMapC, charsmax(tempMapC));
}
else
{
copy(tempMapC, charsmax(tempMapC), "");
}
if (g_voteSelectedNum[id] > 3)
{
ArrayGetString(g_mapName, g_voteSelected[id][3], tempMapD, charsmax(tempMapD));
}
else
{
copy(tempMapD, charsmax(tempMapD), "");
}

log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
name, get_user_userid(id), authid,
tempMapA, tempMapB, tempMapC, tempMapD)
}
case 8: displayVoteMapsMenu(id, ++g_menuPosition[id])
case 9: displayVoteMapsMenu(id, --g_menuPosition[id])
default:
{
g_voteSelected[id][g_voteSelectedNum[id]++] = g_menuPosition[id] * 7 + key
displayVoteMapsMenu(id, g_menuPosition[id])
}
}

return PLUGIN_HANDLED
}

public actionMapsMenu(id, key)
{
switch (key)
{
case 8: displayMapsMenu(id, ++g_menuPosition[id])
case 9: displayMapsMenu(id, --g_menuPosition[id])
default:
{
new a = g_menuPosition[id] * 8 + key
new _modName[10]

get_modname(_modName, 9)
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}

new authid[32], name[32]

get_user_authid(id, authid, 31)
get_user_name(id, name, 31)

new tempMap[32];
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));

show_activity_key("ADMIN_CHANGEL_1", "ADMIN_CHANGEL_2", name, tempMap);

log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, tempMap)
set_task(2.0, "delayedChange", 0, tempMap, strlen(tempMap) + 1)
/* displayMapsMenu(id, g_menuPosition[id]) */
}
}

return PLUGIN_HANDLED
}

displayMapsMenu(id, pos)
{
if (pos < 0)
return

new menuBody[512]
new tempMap[32]
new start = pos * 8
new b = 0

if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0

new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CHANGLE_MENU", pos + 1, (g_mapNums / 8 + ((g_mapNums % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0

if (end > g_mapNums)
end = g_mapNums

for (new a = start; a < end; ++a)
{
keys |= (1<<b)
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, tempMap)
}

if (end != g_mapNums)
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")

new menuName[64]
format(menuName, 63, "%L", "en", "CHANGLE_MENU")

show_menu(id, keys, menuBody, -1, menuName)
}
stock bool:ValidMap(mapname[])
{
if ( is_map_valid(mapname) )
{
return true;
}
// If the is_map_valid check failed, check the end of the string
new len = strlen(mapname) - 4;

// The mapname was too short to possibly house the .bsp extension
if (len < 0)
{
return false;
}
if ( equali(mapname[len], ".bsp") )
{
// If the ending was .bsp, then cut it off.
// the string is byref'ed, so this copies back to the loaded text.
mapname[len] = '^0';

// recheck
if ( is_map_valid(mapname) )
{
return true;
}
}

return false;
}

load_settings(filename[])
{
new fp = fopen(filename, "r");

if (!fp)
{
return 0;
}


new text[256];
new tempMap[32];

while (!feof(fp))
{
fgets(fp, text, charsmax(text));

if (text[0] == ';')
{
continue;
}
if (parse(text, tempMap, charsmax(tempMap)) < 1)
{
continue;
}
if (!ValidMap(tempMap))
{
continue;
}

ArrayPushString(g_mapName, tempMap);
g_mapNums++;
}

return 1;
}

ps.gif Если не туда написал - не бейте :)

какая ошибка...зделай скрин...покажи логи амх и сервера..
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kupuk96
сообщение 1.11.2010, 14:44
Сообщение #3


Стаж: 15 лет

Сообщений: 456
Благодарностей: 139
Полезность: 554

Цитата
значит ошибка у меня такая:
нельзя сменить карту и сделать голосование за карту.

ошибка заключается в том, что нельзя сменить карту или сделать голосвание.
например выбрал я карту "de_nuke" нажимаю сменить, а меню просто закрывается

Отредактировал: kupuk96, - 1.11.2010, 14:45
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Archipelago
сообщение 1.11.2010, 14:49
Сообщение #4


Стаж: 16 лет

Сообщений: 520
Благодарностей: 67
Полезность: 21

Цитата(kupuk96 @ 1.11.2010, 14:44) *
ошибка заключается в том, что нельзя сменить карту или сделать голосвание.
например выбрал я карту "de_nuke" нажимаю сменить, а меню просто закрывается


закрывается только когда ты меняеш карту или при любых действиях через amxmodmenu
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя MaZzai
сообщение 1.11.2010, 17:41
Сообщение #5


Стаж: 17 лет

Сообщений: 2659
Благодарностей: 1411
Полезность: 1024

Цитата
что-то менял в mapchooser, посмотрите мб дело в нём

я что то нашёл в mapchooser, мб и в нём дело...
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя kupuk96
сообщение 2.11.2010, 14:31
Сообщение #6


Стаж: 15 лет

Сообщений: 456
Благодарностей: 139
Полезность: 554

Цитата(MaZzai @ 1.11.2010, 18:41) *
я что то нашёл в mapchooser, мб и в нём дело...

что нашёл-то?
помоги тогда
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя STR@TEG
сообщение 2.11.2010, 22:20
Сообщение #7
Стаж: 16 лет

Сообщений: 4186
Благодарностей: 1763
Полезность: 837

Цитата(kupuk96 @ 2.11.2010, 15:31) *
Цитата(kupuk96 @ 1.11.2010, 15:30) *
что-то менял в mapchooser, посмотрите мб дело в нём

Цитата(MaZzai @ 1.11.2010, 18:41) *
я что то нашёл в mapchooser, мб и в нём дело...

что нашёл-то?
помоги тогда

rofl.gif
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя MaZzai
сообщение 3.11.2010, 22:22
Сообщение #8


Стаж: 17 лет

Сообщений: 2659
Благодарностей: 1411
Полезность: 1024

STR@TEG,
а где +1 win.gif ???
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kievlan
сообщение 4.11.2010, 18:52
Сообщение #9
Стаж: 16 лет

Сообщений: 40
Благодарностей: 1
Полезность: 21

Цитата(spzm @ 1.11.2010, 14:49) *
закрывается только когда ты меняеш карту или при любых действиях через amxmodmenu

Да, такая же по описанию совпадают в моей теме https://c-s.net.ua/forum/topic26770s0.html?#entry193102.Когда будет ответ?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kupuk96
сообщение 5.11.2010, 10:52
Сообщение #10


Стаж: 15 лет

Сообщений: 456
Благодарностей: 139
Полезность: 554

Цитата(kievlan @ 4.11.2010, 19:52) *
Да, такая же по описанию совпадают в моей теме https://c-s.net.ua/forum/topic26770s0.html?#entry193102.Когда будет ответ?

но через amx_map, карту сменить можно...
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kupuk96
сообщение 15.11.2010, 10:07
Сообщение #11


Стаж: 15 лет

Сообщений: 456
Благодарностей: 139
Полезность: 554

проблема решилась, добавлением lang файлов с другими языками.
я просто убрал, чтобы только [ru] был)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: