проблема с map manager nomination

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
Ошибка
L 10/06/2022 - 18:28:55: Invalid array handle provided (0)
L 10/06/2022 - 18:28:55: [AMXX] Displaying debug trace (plugin "map_manager_nomination.amxx", version "0.2.1")
L 10/06/2022 - 18:28:55: [AMXX] Run time error 10: native error (native "ArraySize")
L 10/06/2022 - 18:28:55: [AMXX] [0] map_manager_nomination.sma::show_nomination_menu (line 427)
L 10/06/2022 - 18:28:55: [AMXX] [1] map_manager_nomination.sma::clcmd_mapslist (line 372)

L 10/06/2022 - 18:52:35: Invalid array handle provided (0)
L 10/06/2022 - 18:52:35: [AMXX] Displaying debug trace (plugin "map_manager_nomination.amxx", version "0.2.1")
L 10/06/2022 - 18:52:35: [AMXX] Run time error 10: native error (native "ArraySize")
L 10/06/2022 - 18:52:35: [AMXX] [0] map_manager_nomination.sma::find_similar_map (line 559)
L 10/06/2022 - 18:52:35: [AMXX] [1] map_manager_nomination.sma::clcmd_say (line 222)
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 19 2019 13:31:53
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34
Build ID: 5249:6cecb34
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.12.0.780-dev
Build date: 16:20:56 Sep 19 2022 (3082)
Build from: https://github.com/dreamstalker/rehlds/commit/d6ebe82
ReGamedll
ReGameDLL version: 5.21.0.556-dev
Build date: 08:43:58 Jul 22 2022
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/1081301
Версия Metamod
Metamod v1.21p37  2013/05/30 (5:13)
by Will Day
http://www.metamod.org/
Patch: Metamod-P (mm-p) v37
by Jussi Kivilinna
http://metamod-p.sourceforge.net/
compiled: May 30 2013, 11:41:16 EET (optimized)
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] SafeNameAndChat RUN - SafeNameAndChat. v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386. v0.1.0.9 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[ 4] VoiceTranscoder RUN - VoiceTranscoder. v2017RC4 ini ANY ANY
[ 5] AMX Mod X RUN - amxmodx_mm_i386. v1.9.0.5 ini Start ANY
[ 6] Rechecker RUN - rechecker_mm_i38 v2.5 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i38 v1.5.696 ini Chlvl ANY
[ 8] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini Chlvl ANY
[ 9] CStrike RUN - cstrike_amxx_i38 v1.9.0.5 pl5 ANY ANY
[10] CSX RUN - csx_amxx_i386.so v1.9.0.5 pl5 ANY ANY
[11] Fun RUN - fun_amxx_i386.so v1.9.0.5 pl5 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl5 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl5 ANY ANY
[14] GeoIP RUN - geoip_amxx_i386. v1.9.0.5 pl5 ANY ANY
[15] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl5 ANY ANY
[16] SQLite RUN - sqlite_amxx_i386 v1.9.0.5 pl5 ANY ANY
[17] Engine RUN - engine_amxx_i386 v1.9.0.5 pl5 ANY ANY
[18] ReAPI RUN - reapi_amxx_i386. v5.22.0. pl5 ANY Never
[19] ReAimDetector RUN - reaimdetector_am v0.2.2 pl5 ANY Never
[20] SxGeo RUN - sxgeo_amxx_i386. v2.2 pl5 ANY Never
[21] gRIP RUN - grip_amxx_i386.s v0.1.5 B pl5 ANY ANY
21 plugins, 21 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] FreshBans 1.4.0b kanagava fresh_bans_1.4. running
[ 2] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 3] Advanced Gag 1.9.0 neygomon amx_gag.amxx running
[ 4] Admin Base 1.9.0.5249 AMXX Dev Team admin.amxx running
[ 5] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 6] Players Menu 1.7 neugomon players_menu.am running
[ 7] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 8] Anti Flood 1.9.0.5249 AMXX Dev Team antiflood.amxx running
[ 9] Maps Menu 1.9.0.5249 AMXX Dev Team mapsmenu.amxx running
[ 10] Restrict Weapons 1.9.0.5249 AMXX Dev Team restmenu.amxx running
[ 11] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 12] c4 timer 1.1 cheap_suit c4timer.amxx running
[ 13] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 14] Say Me & Hp 1.0 Hypa_[KZ] say_me_and_hp.a running
[ 15] Weapon Icon 1.0 Zenix weapon_icon.amx running
[ 16] HS_Blood 1.1 tuty hs_blood.amxx running
[ 17] menu_render 0.5 Flesh render.amxx running
[ 18] Auto Restart 1.0.3 neygomon auto_rr.amxx running
[ 19] DemoRecoder 1.2 neygomon demorecoder.amx running
[ 20] Menus Front-End 1.5 neugomon menufront_end.a running
[ 21] MenuGen 1.0 CrAsH MenuGen.amxx running
[ 22] [ReAPI] IDEAL VIP 1.4.8 Wikiname (Remake re_ideal_vip.am running
[ 23] Invisible Spectator 1.0 ReHLDS Team invisible_spect running
[ 24] WeaponMenu 1.1 neygomon wmenu.amxx running
[ 25] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 26] ScreenMaker 1.1 neygomon screen_maker.am running
[ 27] Log Connect 1.0 Leo_[BH] log_connect.amx running
[ 28] Fire in the hole 0.1 VEN fire_in_the_hol running
[ 29] Screen_Fade 0.0.5 Vaqtincha screen_fade.amx running
[ 30] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 31] Ping Control 0.3 neygomon ping_control.am running
[ 32] Show Damage 1.0 neygomon damager.amxx running
[ 33] ResetScore and GameNam 1.0 Phantom rs_and_game_nam running
[ 34] Top Awards 0.11c Safety1st top_awards.amxx running
[ 35] Info Rank 0.2 maFFyoZZyk info_rank.amxx running
[ 36] Parachute 1.1 ReHLDS Team parachute.amxx running
[ 37] Advert Messages 1.2.2 neygomon adverts.amxx running
[ 38] HUD_Adverts_Deads 1.3.1 pUzzlik hud_message_dea running
[ 39] Anti Reklama 1.1 MarcaD anti_reklama.am running
[ 40] Chat Manager 1.1.1-11 Mistrick chatmanager.amx running
[ 41] RC BaseChanger 1.0 AMXX rc_basechanger. running
[ 42] ReChecker Logging 1.0 AMXX rc_logging.amxx running
[ 43] [SxGeo] Connect Info 1.0 s1lent sxgeo_connect_i running
[ 44] Steam Bonus 1.3d Gudaus steam_bonus.amx running
[ 45] Steam Models 0.1b+mod.l Freedo.m steam_models.am running
[ 46] Players Menu 1.8.2 AMXX Dev Team plmenu.amxx running
[ 47] Plugin Menu 1.8.2 AMXX Dev Team pluginmenu.amxx running
[ 48] daynight 1.1 NL)Ramon(NL night_day.amxx running
[ 49] Ultimate Gore 1.6 JTP10181 amx_gore_ultima running
[ 50] SpecList 1.2a FatalisDK speclist_rus.am running
[ 51] Prometheus 0.12 Avalanche prometheus.amxx running
[ 52] Nice Killer 1.6 Got Milk? / HoHo nice_killer.amx running
[ 53] ADV. QUAKE SOUNDS (ENA 6.2 HATTRICK (HTTRCK AQS.amxx running
[ 54] HE Knockback 2.0 ThantiK & Connor amx_heconc.amxx running
[ 55] Voteban CSR 0.8.7beta Leo_[BH] csr_voteban.amx running
[ 56] Register System 9.0 m0skVi4a ;] RegisterSystem. running
[ 57] Advanced Kill Assists 1.2b Xelson next21_kill_ass running
[ 58] Remove admins 0.2 SweatyBanana remove_admins.a running
[ 59] Info Message HUD 1.5 dev-cs InfoMsg.amxx running
[ 60] [ReAPI] Healthnade 0.0.5f F@nt0M + mx?! reapi_healthnad debug
[ 61] CS:GO Inspect Weapon 5.1.5 hellmonja csgo_inspect_we running
[ 62] Objective as GameName 1.2.1 CHEL74 objective_as_ga running
[ 63] A* Pathfinding API 1.2 [ --{-@ ] astar.amxx running
[ 64] Discord Reports 0.2 paffgame discord.amxx running
[ 65] Map Manager: Core 3.1.5 Mistrick map_manager_cor running
[ 66] Map Manager: Scheduler 0.1.10 Mistrick map_manager_sch running
[ 67] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 68] Map Manager: Nominatio 0.2.1 Mistrick map_manager_nom debug
[ 69] Map Manager: BlockList 0.0.4 Mistrick map_manager_blo running
[ 70] Map Manager: Online so 0.0.4 Mistrick map_manager_onl running
[ 71] Map Manager: Effects 0.1.1 Mistrick map_manager_eff running
[ 72] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[ 73] Map Manager: Sounds 0.0.2 Mistrick map_manager_sou running
[ 74] Map Manager: Advanced 0.1.0 Mistrick map_manager_adv running
[ 75] Map Manager: Priority 0.0.2 Mistrick map_manager_pri running
[ 76] Map Manager: zBot 1.0 CHEL74 map_manager_zbo running
[ 77] FocusOnVotemap 1.2.1 Boec[SpecOPs] focus_on_votema running
[ 78] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 79] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 80] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 81] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 82] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 83] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 84] AES: Bonus CSTRIKE 0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
84 plugins, 84 running
Автор плагина
Mistrick
Версия плагина
0.2.1
Исходный код
#include <amxmodx>
#include <map_manager>
#include <map_manager_blocklist>
#include <map_manager_adv_lists>

#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif

#define PLUGIN "Map Manager: Nomination"
#define VERSION "0.2.1"
#define AUTHOR "Mistrick"

#pragma semicolon 1

#define get_num(%0) get_pcvar_num(g_pCvars[%0])

#if !defined client_disconnected
#define client_disconnected client_disconnect
#endif

enum {
NOMINATION_FAIL,
NOMINATION_SUCCESS,
NOMINATION_REMOVED
};

enum {
TYPE_STANDART,
TYPE_FIXED
};

enum Cvars {
TYPE,
MAPS_IN_VOTE,
MAPS_PER_PLAYER,
DONT_CLOSE_MENU,
DENOMINATE_TIME,
RANDOM_SORT,
REMOVE_MAPS,
SHOW_LISTS
};

new g_pCvars[Cvars];

enum Forwards {
CAN_BE_NOMINATED
};

new g_hForwards[Forwards];

new Array:g_aNomList;
new Array:g_aMapsList;
new g_hCallbackDisabled;
new g_iNomMaps[33];
new g_iLastDenominate[33];
new bool:g_bIgnoreVote = false;

new g_sPrefix[48];
new g_szCurMap[32];

enum Sections {
UNUSED_SECTION,
MAPLIST_COMMANDS
}
enum ParserData {
Sections:SECTION,
MAPLIST_COMMAND_FOUND
};
new parser_info[ParserData];

public plugin_init()
{
register_plugin(PLUGIN, VERSION + VERSION_HASH, AUTHOR);

g_pCvars[TYPE] = register_cvar("mapm_nom_type", "0"); // 0 - standart, 1 - fixed
g_pCvars[MAPS_IN_VOTE] = register_cvar("mapm_nom_maps_in_vote", "3");
g_pCvars[MAPS_PER_PLAYER] = register_cvar("mapm_nom_maps_per_player", "3");
g_pCvars[DONT_CLOSE_MENU] = register_cvar("mapm_nom_dont_close_menu", "1"); // 0 - disable, 1 - enable
g_pCvars[DENOMINATE_TIME] = register_cvar("mapm_nom_denominate_time", "5"); // seconds
g_pCvars[RANDOM_SORT] = register_cvar("mapm_nom_random_sort", "0"); // 0 - disable, 1 - enable
g_pCvars[REMOVE_MAPS] = register_cvar("mapm_nom_remove_maps", "1"); // 0 - disable, 1 - enable
g_pCvars[SHOW_LISTS] = register_cvar("mapm_nom_show_lists", "0"); // 0 - disable, 1 - enable

g_hForwards[CAN_BE_NOMINATED] = CreateMultiForward("mapm_can_be_nominated", ET_CONTINUE, FP_CELL, FP_STRING);

register_clcmd("say", "clcmd_say");
register_clcmd("say_team", "clcmd_say");

load_settings();

g_hCallbackDisabled = menu_makecallback("callback_disable_item");
}
load_settings()
{
new INIParser:parser = INI_CreateParser();

INI_SetParseEnd(parser, "ini_parse_end");
INI_SetReaders(parser, "ini_key_value", "ini_new_section");
new bool:result = INI_ParseFile(parser, "addons/amxmodx/configs/map_manager_settings.ini");

if(!result) {
register_default_cmds();
}
}
public ini_new_section(INIParser:handle, const section[], bool:invalid_tokens, bool:close_bracket, bool:extra_tokens, curtok, any:data)
{
if(equal(section, "nomination_maplist_commands")) {
parser_info[SECTION] = MAPLIST_COMMANDS;
} else {
parser_info[SECTION] = UNUSED_SECTION;
}
return true;
}
public ini_key_value(INIParser:handle, const key[], const value[], bool:invalid_tokens, bool:equal_token, bool:quotes, curtok, any:data)
{
switch(parser_info[SECTION]) {
case MAPLIST_COMMANDS: {
register_clcmd(fmt("say %s", key), "clcmd_mapslist");
parser_info[MAPLIST_COMMAND_FOUND] = true;
}
}
return true;
}
public ini_parse_end(INIParser:handle, bool:halted, any:data)
{
if(!parser_info[MAPLIST_COMMAND_FOUND]) {
register_default_cmds();
}
INI_DestroyParser(handle);
}
register_default_cmds()
{
register_clcmd("say maps", "clcmd_mapslist");
register_clcmd("say /maps", "clcmd_mapslist");
}
public plugin_natives()
{
get_mapname(g_szCurMap, charsmax(g_szCurMap));

set_module_filter("module_filter_handler");
set_native_filter("native_filter_handler");

register_library("map_manager_nomination");
register_native("is_nomination_ignore_vote", "native_get_ignore");
register_native("map_nomination_set_ignore", "native_set_ignore");
}
public module_filter_handler(const library[], LibType:type)
{
if(equal(library, "map_manager_blocklist")) {
return PLUGIN_HANDLED;
}
if(equal(library, "map_manager_adv_lists")) {
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public native_filter_handler(const native_func[], index, trap)
{
if(equal(native_func, "mapm_get_blocked_count")) {
return PLUGIN_HANDLED;
}
if(equal(native_func, "mapm_advl_get_active_lists")) {
return PLUGIN_HANDLED;
}
if(equal(native_func, "mapm_advl_get_list_name")) {
return PLUGIN_HANDLED;
}
if(equal(native_func, "mapm_advl_get_list_array")) {
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public native_get_ignore(plugin, params)
{
return g_bIgnoreVote;
}
public native_set_ignore(plugin, params)
{
enum { arg_ignore = 1 };
g_bIgnoreVote = bool:get_param(arg_ignore);
}
public callback_disable_item()
{
return ITEM_DISABLED;
}
public mapm_maplist_loaded(Array:maplist)
{
g_aMapsList = maplist;

if(!g_aNomList) {
g_aNomList = ArrayCreate(NomStruct, 1);
}

if(get_num(REMOVE_MAPS)) {
remove_maps();
}

mapm_get_prefix(g_sPrefix, charsmax(g_sPrefix));
}
public client_disconnected(id)
{
if(g_iNomMaps[id]) {
clear_nominated_maps(id);
}
}
public clcmd_say(id)
{
new text[MAPNAME_LENGTH]; read_args(text, charsmax(text));
remove_quotes(text); trim(text); strtolower(text);

if(is_string_with_space(text)) return PLUGIN_CONTINUE;

new map_index = mapm_get_map_index(text);

if(map_index != INVALID_MAP_INDEX) {
nominate_map(id, text);
} else if(strlen(text) >= 4) {
new Array:nominate_list = ArrayCreate(1, 1), array_size;

map_index = 0;
while( (map_index = find_similar_map(map_index, text)) != INVALID_MAP_INDEX ) {
ArrayPushCell(nominate_list, map_index);
array_size++;
map_index++;
}

if(array_size == 1) {
map_index = ArrayGetCell(nominate_list, 0);
new map_info[MapStruct]; ArrayGetArray(g_aMapsList, map_index, map_info);
nominate_map(id, map_info[Map]);
} else if(array_size > 1) {
show_nomlist(id, nominate_list, array_size);
}

ArrayDestroy(nominate_list);
}

return PLUGIN_CONTINUE;
}
nominate_map(id, map[])
{
if(mapm_get_blocked_count(map)) {
client_print_color(id, print_team_default, "%s^1 %L", g_sPrefix, id, "MAPM_NOM_NOT_AVAILABLE_MAP");
return NOMINATION_FAIL;
}

if(get_num(TYPE) == TYPE_FIXED && ArraySize(g_aNomList) >= get_num(MAPS_IN_VOTE)) {
client_print_color(id, print_team_default, "%s^1 %L", g_sPrefix, id, "MAPM_NOM_CANT_NOM2");
return NOMINATION_FAIL;
}

new nom_info[NomStruct], name[32];
get_user_name(id, name, charsmax(name));

new nom_index = map_nominated(map);
if(nom_index != INVALID_MAP_INDEX) {
ArrayGetArray(g_aNomList, nom_index, nom_info);
if(id != nom_info[NomPlayer]) {
client_print_color(id, print_team_default, "%s^1 %L", g_sPrefix, id, "MAPM_NOM_ALREADY_NOM");
return NOMINATION_FAIL;
}

new systime = get_systime();
if(g_iLastDenominate[id] + get_num(DENOMINATE_TIME) >= systime) {
client_print_color(id, print_team_default, "%s^1 %L", g_sPrefix, id, "MAPM_NOM_SPAM");
return NOMINATION_FAIL;
}

g_iLastDenominate[id] = systime;
g_iNomMaps[id]--;
ArrayDeleteItem(g_aNomList, nom_index);

client_print_color(0, id, "%s^3 %L", g_sPrefix, LANG_PLAYER, "MAPM_NOM_REMOVE_NOM", name, map);
return NOMINATION_REMOVED;
}

if(g_iNomMaps[id] >= get_num(MAPS_PER_PLAYER)) {
client_print_color(id, print_team_default, "%s^1 %L", g_sPrefix, id, "MAPM_NOM_CANT_NOM");
return NOMINATION_FAIL;
}

new ret;
ExecuteForward(g_hForwards[CAN_BE_NOMINATED], ret, id, map);

if(ret == NOMINATION_BLOCKED) {
return NOMINATION_FAIL;
}

copy(nom_info[NomMap], charsmax(nom_info[NomMap]), map);
nom_info[NomPlayer] = id;
ArrayPushArray(g_aNomList, nom_info);

g_iNomMaps[id]++;

client_print_color(0, id, "%s^3 %L", g_sPrefix, LANG_PLAYER, "MAPM_NOM_MAP", name, map);

return NOMINATION_SUCCESS;
}
show_nomlist(id, Array: array, size)
{
new text[64]; formatex(text, charsmax(text), "%L", LANG_PLAYER, "MAPM_MENU_FAST_NOM");
new menu = menu_create(text, "nomlist_handler");
new map_info[MapStruct], item_name[MAPNAME_LENGTH + 16], map_index, nom_index, block_count;

for(new i, str_num[6]; i < size; i++) {
map_index = ArrayGetCell(array, i);
ArrayGetArray(g_aMapsList, map_index, map_info);

num_to_str(map_index, str_num, charsmax(str_num));
nom_index = map_nominated(map_info[Map]);
block_count = mapm_get_blocked_count(map_info[Map]);

if(block_count) {
formatex(item_name, charsmax(item_name), "%s[\r%d\d]", map_info[Map], block_count);
menu_additem(menu, item_name, .callback = g_hCallbackDisabled);
} else if(nom_index != INVALID_MAP_INDEX) {
new nom_info[NomStruct]; ArrayGetArray(g_aNomList, nom_index, nom_info);
if(id == nom_info[NomPlayer]) {
formatex(item_name, charsmax(item_name), "%s[\y*\w]", map_info[Map]);
menu_additem(menu, item_name);
} else {
formatex(item_name, charsmax(item_name), "%s[\y*\d]", map_info[Map]);
menu_additem(menu, item_name, .callback = g_hCallbackDisabled);
}
} else {
menu_additem(menu, map_info[Map]);
}
}

formatex(text, charsmax(text), "%L", id, "MAPM_MENU_BACK");
menu_setprop(menu, MPROP_BACKNAME, text);
formatex(text, charsmax(text), "%L", id, "MAPM_MENU_NEXT");
menu_setprop(menu, MPROP_NEXTNAME, text);
formatex(text, charsmax(text), "%L", id, "MAPM_MENU_EXIT");
menu_setprop(menu, MPROP_EXITNAME, text);

menu_display(id, menu);
}
public nomlist_handler(id, menu, item)
{
if(item == MENU_EXIT) {
menu_destroy(menu);
return PLUGIN_HANDLED;
}

new item_info[8], item_name[MAPNAME_LENGTH + 16], access, callback;
menu_item_getinfo(menu, item, access, item_info, charsmax(item_info), item_name, charsmax(item_name), callback);

trim_bracket(item_name);
new nominated = nominate_map(id, item_name);

if(nominated == NOMINATION_REMOVED || get_num(DONT_CLOSE_MENU)) {
if(nominated == NOMINATION_SUCCESS) {
format(item_name, charsmax(item_name), "%s[\y*\w]", item_name);
menu_item_setname(menu, item, item_name);
} else if(nominated == NOMINATION_REMOVED) {
menu_item_setname(menu, item, item_name);
}
menu_display(id, menu);
} else {
menu_destroy(menu);
}

return PLUGIN_HANDLED;
}
public clcmd_mapslist(id)
{
if(get_num(SHOW_LISTS) && mapm_advl_get_active_lists() > 1) {
show_lists_menu(id);
} else {
show_nomination_menu(id, g_aMapsList);
}
}
show_lists_menu(id)
{
new text[64];
// TODO: add ML
new menu = menu_create("Maps lists:", "lists_handler");

new list[32], size = mapm_advl_get_active_lists();
for(new i; i < size; i++) {
mapm_advl_get_list_name(i, list, charsmax(list));
menu_additem(menu, list);
}

formatex(text, charsmax(text), "%L", id, "MAPM_MENU_BACK");
menu_setprop(menu, MPROP_BACKNAME, text);
formatex(text, charsmax(text), "%L", id, "MAPM_MENU_NEXT");
menu_setprop(menu, MPROP_NEXTNAME, text);
formatex(text, charsmax(text), "%L", id, "MAPM_MENU_EXIT");
menu_setprop(menu, MPROP_EXITNAME, text);

menu_display(id, menu);
}
public lists_handler(id, menu, item)
{
if(item == MENU_EXIT) {
menu_destroy(menu);
return PLUGIN_HANDLED;
}

menu_destroy(menu);

if(item >= mapm_advl_get_active_lists()) {
clcmd_mapslist(id);
return PLUGIN_HANDLED;
}

new list_name[32];
mapm_advl_get_list_name(item, list_name, charsmax(list_name));
new Array:maplist = mapm_advl_get_list_array(item);
show_nomination_menu(id, maplist, list_name);

return PLUGIN_HANDLED;
}
show_nomination_menu(id, Array:maplist, custom_title[] = "")
{
new text[64];
if(!custom_title[0]) {
formatex(text, charsmax(text), "%L", LANG_PLAYER, "MAPM_MENU_MAP_LIST");
} else {
formatex(text, charsmax(text), "%s", custom_title);
}
new menu = menu_create(text, "mapslist_handler");

new map_info[MapStruct], item_name[MAPNAME_LENGTH + 16], block_count, size = ArraySize(maplist);
new random_sort = get_num(RANDOM_SORT), Array:array = ArrayCreate(1, 1);

for(new i = 0, index, nom_index; i < size; i++) {
if(random_sort) {
do {
index = random_num(0, size - 1);
} while(in_array(array, index));
ArrayPushCell(array, index);
} else {
index = i;
}

ArrayGetArray(maplist, index, map_info);

if(equali(map_info[Map], g_szCurMap)) {
continue;
}

nom_index = map_nominated(map_info[Map]);
block_count = mapm_get_blocked_count(map_info[Map]);

if(block_count) {
formatex(item_name, charsmax(item_name), "%s[\r%d\d]", map_info[Map], block_count);
menu_additem(menu, item_name, .callback = g_hCallbackDisabled);
} else if(nom_index != INVALID_MAP_INDEX) {
new nom_info[NomStruct]; ArrayGetArray(g_aNomList, nom_index, nom_info);
if(id == nom_info[NomPlayer]) {
formatex(item_name, charsmax(item_name), "%s[\y*\w]", map_info[Map]);
menu_additem(menu, item_name);
} else {
formatex(item_name, charsmax(item_name), "%s[\y*\d]", map_info[Map]);
menu_additem(menu, item_name, .callback = g_hCallbackDisabled);
}
} else {
menu_additem(menu, map_info[Map]);
}
}

ArrayDestroy(array);

formatex(text, charsmax(text), "%L", id, "MAPM_MENU_BACK");
menu_setprop(menu, MPROP_BACKNAME, text);
formatex(text, charsmax(text), "%L", id, "MAPM_MENU_NEXT");
menu_setprop(menu, MPROP_NEXTNAME, text);
formatex(text, charsmax(text), "%L", id, "MAPM_MENU_EXIT");
menu_setprop(menu, MPROP_EXITNAME, text);

menu_display(id, menu);
}
bool:in_array(Array:array, index)
{
for(new i, size = ArraySize(array); i < size; i++) {
if(ArrayGetCell(array, i) == index) {
return true;
}
}
return false;
}
public mapslist_handler(id, menu, item)
{
if(item == MENU_EXIT) {
menu_destroy(menu);
return PLUGIN_HANDLED;
}

new item_info[8], item_name[MAPNAME_LENGTH + 16], access, callback;
menu_item_getinfo(menu, item, access, item_info, charsmax(item_info), item_name, charsmax(item_name), callback);

trim_bracket(item_name);
new nominated = nominate_map(id, item_name);

if(g_iNomMaps[id] < get_num(MAPS_PER_PLAYER) || get_num(DONT_CLOSE_MENU)) {
if(nominated == NOMINATION_SUCCESS) {
format(item_name, charsmax(item_name), "%s[\y*\w]", item_name);
menu_item_setname(menu, item, item_name);
} else if(nominated == NOMINATION_REMOVED) {
menu_item_setname(menu, item, item_name);
}
menu_display(id, menu, item / 7);
} else {
menu_destroy(menu);
}

return PLUGIN_HANDLED;
}

public mapm_prepare_votelist(type)
{
if(g_bIgnoreVote) {
return;
}
new nom_info[NomStruct];
new max_items = mapm_get_votelist_size();
for(new i = mapm_get_count_maps_in_vote(), index; i < max_items && ArraySize(g_aNomList); i++) {
index = random_num(0, ArraySize(g_aNomList) - 1);
ArrayGetArray(g_aNomList, index, nom_info);
ArrayDeleteItem(g_aNomList, index);
g_iNomMaps[nom_info[NomPlayer]]--;

if(mapm_push_map_to_votelist(nom_info[NomMap], PUSH_BY_NOMINATION) != PUSH_SUCCESS) {
i--;
}
}
}

map_nominated(map[])
{
new nom_info[NomStruct], size = ArraySize(g_aNomList);
for(new i; i < size; i++) {
ArrayGetArray(g_aNomList, i, nom_info);
if(equali(map, nom_info[NomMap])) {
return i;
}
}
return INVALID_MAP_INDEX;
}
clear_nominated_maps(id)
{
new nom_info[NomStruct];
for(new i = 0; i < ArraySize(g_aNomList); i++) {
ArrayGetArray(g_aNomList, i, nom_info);
if(id == nom_info[NomPlayer]) {
ArrayDeleteItem(g_aNomList, i--);
if(!--g_iNomMaps[id]) {
break;
}
}
}
}
find_similar_map(map_index, string[MAPNAME_LENGTH])
{
new map_info[MapStruct], end = ArraySize(g_aMapsList);
for(new i = map_index; i < end; i++) {
ArrayGetArray(g_aMapsList, i, map_info);
if(containi(map_info[Map], string) != -1) {
return i;
}
}
return INVALID_MAP_INDEX;
}
remove_maps()
{
new nom_info[NomStruct];
for(new i; i < ArraySize(g_aNomList); i++) {
ArrayGetArray(g_aNomList, i, nom_info);
if(mapm_get_map_index(nom_info[NomMap]) == INVALID_MAP_INDEX) {
g_iNomMaps[nom_info[NomPlayer]]--;
ArrayDeleteItem(g_aNomList, i--);
}
}
}
Всем привет. При написании /maps не открывается меню, и в консоль пишет эту ошибку. Что делать?
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
present, у меня в maps.ini много карт, что не так то?
6 Окт 2022
present, извиняюсь, был там не внимателен, надо было в maplists.ini добавить эти строки
Код:
"Day Maps" "maps.ini" "1" "6:00" "22:59"
"Night Maps" "nightmaps.ini" "1" "23:00" "5:59"
и все.

Решено.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу