- Ошибка
-
L 01/22/2020 - 15:23:01: [map_manager_scheduler.amxx] [newround]: start vote, timeleft 0, new round
L 01/22/2020 - 15:23:11: [map_manager_scheduler.amxx] [vote_finished]: nextmap is aim_deagle5.
L 01/22/2020 - 15:23:11: [map_manager_scheduler.amxx] [vote_finished]: last round - saved timelimit is 35.000000
L 01/22/2020 - 15:23:29: [lite_translit_prbblyrdy.amxx] [Error] Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''''' at line 1 (1064)
Skipping reconnect on 121, no pvPrivateData Если после завершение голосовании отменит голосования, то время карты будет вечным, если не написать ртв или не запустит командой. Также если количества продлений ставит больше 1-го того таймлимит будет 35,хотя указано 15. Только когда укажеш только одно продление, тогда будет норм, вот здесь видно нормальный таимлимит 20(15мин продление+5 мин до начало голосования)
L 01/22/2020 - 15:44:02: [map_manager_scheduler.amxx] [planning_vote]: vote in new round.
L 01/22/2020 - 15:44:11: [map_manager_scheduler.amxx] [newround]: start vote, timeleft 0, new round
109.252.89.102:15350:reconnect
L 01/22/2020 - 15:44:21: [map_manager_scheduler.amxx] [vote_finished]: nextmap is awp_lego_2018.
L 01/22/2020 - 15:44:21: [map_manager_scheduler.amxx] [vote_finished]: last round - saved timelimit is 20.000000
L 01/22/2020 - 16:00:11: [map_manager_scheduler.amxx] [checktime]: start vote, timeleft 292
L 01/22/2020 - 16:00:11: [map_manager_scheduler.amxx] [planning_vote]: vote in new round.
SZ_GetSpace: overflow on sasdjasdf
L 01/22/2020 - 16:00:28: [map_manager_scheduler.amxx] [newround]: start vote, timeleft 0, new round
L 01/22/2020 - 16:00:38: [map_manager_scheduler.amxx] [vote_finished]: nextmap is aim_deagle5.
L 01/22/2020 - 16:00:38: [map_manager_scheduler.amxx] [vote_finished]: last round - saved timelimit is 20.000000.
L 01/22/2020 - 16:01:07: [lite_translit_prbblyrdy.amxx] [Error] Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''''' at line 1 (1064)
Skipping reconnect on 121, no pvPrivateData Много багов связанных с временем,еще после голосования всегда пропадает свои префиксы сохраненные в БД через lite_translite. Еще нет номинирования по имени карты. Еще когда пишеш timeleft ничего не происходит. Если запускается голосование,то при продление таимлимит становится 35 мин хотя указано также15 мин.
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5263 (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: Oct 27 2019 16:23:31
- Билд
-
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.692-dev
Build date: 18:58:01 Sep 21 2019 (1988)
- ReGamedll
-
ReGameDLL version: 5.13.0.447-dev+m
Build date: 18:11:04 Jan 15 2020
- Версия Metamod
-
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
- Список метамодулей
-
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.0.135 ini Start Never
[ 2] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC4 ini ANY ANY
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5263 ini Start ANY
[ 4] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 5] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 6] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 7] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[ 8] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[ 9] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[10] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[11] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[12] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[14] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl3 ANY Never
[15] ReAPI RUN - reapi_amxx_i386.so v5.12.0.192-dev pl3 ANY Never
[16] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl3 ANY ANY
[17] ReAuthCheck open - reauthcheck_mm_i386.so v0.1.6 ini Start Never
17 plugins, 16 running
- Список плагинов
-
[ 1] AMXBans: Core Gm 1.6 Larte Team amxbans_core.am running
[ 2] AMXBans: Main Gm 1.6 Larte Team amxbans_main.am running
[ 3] Admin Commands 1.8.3 AMXX Dev Team admincmd.amxx running
[ 4] Admin Gag 1.0 fomeN amx_admingag.am running
[ 5] Amxmodmenu 1.0 cshost menufront.amxx running
[ 6] Commands Menu 1.8.3 AMXX Dev Team cmdmenu.amxx running
[ 7] Players Menu 1.7 neugomon plmenu.amxx running
[ 8] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 9] Plugin Menu 1.8.3 AMXX Dev Team pluginmenu.amxx running
[ 10] Admin Chat 1.9.0.5263 AMXX Dev Team adminchat.amxx running
[ 11] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 12] CS Misc. Stats 1.9.0.5217 AMXX Dev Team miscstats.amxx running
[ 13] TimeLeft 1.8.3 AMXX Dev Team timeleft.amxx running
[ 14] Stats Configuration 1.8.2 AMXX Dev Team statscfg.amxx running
[ 15] Restrict Weapons 1.9.0.5217 AMXX Dev Team restmenu.amxx running
[ 16] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 17] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 18] StatsX 1.9.0.5217 AMXX Dev Team statsx.amxx running
[ 19] Damager 2.0 Prayer damager.amxx running
[ 20] FullSpawns 1.0 Eg@r4$il{ FullSpawns.amxx running
[ 21] VoteGag 1.0 sNk votegag.amxx running
[ 22] [182] Demo Recorder RB 18.02.08 SKAJIbnEJIb demorecorder_rb running
[ 23] [183] SlayLosers RBS 19.09.02 SKAJIbnEJIb & d3 slaylosers_rbs. running
[ 24] [182] Parachute RBS 17.12.12 KRoT@L/JTP10181 parachute_rbs.a running
[ 25] Access 1.0 Mandar1n access.amxx running
[ 26] Nice Killer 1.6 Got Milk? / HoHo nice_killer.amx running
[ 27] Anti Flashbang 0.1 unnamed antinoflash.amx running
[ 28] Mode 2x2 2.5re s1lent mod2x2.amxx running
[ 29] Rock to Ban 1.02 Safety1st rock2ban.amxx running
[ 30] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 31] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 32] Reset_Score 1.0 FBR resetscore.amxx running
[ 33] AntiFlash FINAL 5.0 Leo_[BH] antiflash5_non_ running
[ 34] Instant AutoTeamBalanc 1.2.0 ConnorMcLeod autoteambalance running
[ 35] mute menu 1.0 cheap_suit mutemenu.amxx running
[ 36] C4 Timer 1.1 SAMURAI & Remod: c4_timer.amxx running
[ 37] GameName Changer 1.0 neugomon gamename_change running
[ 38] Lite Kill Assist 1.17 neygomon lite_kill_assis running
[ 39] Admin Spectator ESP 1.3 KoST esp.amxx running
[ 40] Top Awards 0.11h Safety1st top_awards.amxx running
[ 41] AWP Limit 1.0 theRoone awp.amxx running
[ 42] Lite Translit 3.0 theRoone (remake lite_translit_p running
[ 43] [ReAMX] Ultimate Weapo 19.11.29 SKAJIbnEJIb ultimate_weapon running
[ 44] [190] VIP RBS 19.12.09 SKAJIbnEJIb vip_rbs.amxx running
[ 45] WeaponState Remember 0.0.4 Vaqtincha weaponstate_rem running
[ 46] COLORS MENU 1.2 DUKKHAZ0R color.amxx running
[ 47] Server Menu [INI] 1.0 Leo_[BH] server_menu.amx running
[ 48] Fake Ping 1.1 MeRcyLeZZ/gyxoBk fake_ping.amxx running
[ 49] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 50] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 51] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 52] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 53] AMXBans: Screens Gm 1.6 Larte Team amxbans_ssban.a running
[ 54] Map Manager: Core 3.0.5 Mistrick map_manager_cor running
[ 55] Map Manager: Scheduler 0.1.3 Mistrick map_manager_sch running
[ 56] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 57] Map Manager: Nominatio 0.1.2 Mistrick map_manager_nom running
[ 58] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[ 59] Map Manager: Effects 0.0.8 Mistrick map_manager_eff running
[ 60] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
60 plugins, 60 running
- Автор плагина
- Mistrick
- Версия плагина
- 3.0.5
- Исходный код
-
#include <amxmodx>
#include <map_manager_consts>
#include <map_manager_stocks>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif
#define PLUGIN "Map Manager: Core"
#define VERSION "3.0.5"
#define AUTHOR "Mistrick"
#pragma semicolon 1
//-----------------------------------------------------//
// Consts
//-----------------------------------------------------//
#define MAX_VOTELIST_SIZE 9
new const FILE_MAPS[] = "maps.ini";
//-----------------------------------------------------//
#define get_num(%0) get_pcvar_num(g_pCvars[%0])
const NOT_VOTED = -1;
enum (+=100) {
TASK_PREPARE_VOTE = 100,
TASK_VOTE_TIME
};
enum Forwards {
MAPLIST_LOADED,
MAPLIST_UNLOADED,
CAN_BE_IN_VOTELIST,
CAN_BE_EXTENDED,
PREPARE_VOTELIST,
VOTE_STARTED,
VOTE_CANCELED,
ANALYSIS_OF_RESULTS,
VOTE_FINISHED,
COUNTDOWN
};
enum Cvars {
PREFIX,
VOTELIST_SIZE,
SHOW_RESULT_TYPE,
SHOW_SELECTS,
SHOW_PERCENT,
RANDOM_NUMS,
PREPARE_TIME,
VOTE_TIME,
VOTE_ITEM_OFFSET
};
new g_pCvars[Cvars];
new g_iOffset;
new g_iVoteItems;
new g_sVoteList[MAX_VOTELIST_SIZE + 1][MAPNAME_LENGTH];
new g_iVotes[MAX_VOTELIST_SIZE + 1];
new g_iTotalVotes;
new g_iVoted[33];
new g_hForwards[Forwards];
new Array:g_aMapsList = Invalid_Array;
new bool:g_bBlockLoad = false;
new g_iShowType;
new g_iShowPercent;
new g_bShowSelects;
new g_iTimer;
new g_bCanExtend;
new g_iMaxItems;
new g_iCurMap;
new g_iRandomNums[MAX_VOTELIST_SIZE + 1];
new bool:g_bBlockShowVote = false;
new g_iVoteType;
new bool:g_bVoteStarted;
new bool:g_bVoteFinished;
new g_sCurMap[MAPNAME_LENGTH];
new g_sPrefix[48];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_cvar("mapm_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
g_pCvars[PREFIX] = register_cvar("mapm_prefix", "^4[MapManager]");
g_pCvars[VOTELIST_SIZE] = register_cvar("mapm_votelist_size", "5");
g_pCvars[SHOW_RESULT_TYPE] = register_cvar("mapm_show_result_type", "1"); //0 - disable, 1 - menu, 2 - hud
g_pCvars[SHOW_SELECTS] = register_cvar("mapm_show_selects", "1"); // 0 - disable, 1 - all
g_pCvars[SHOW_PERCENT] = register_cvar("mapm_show_percent", "1"); // 0 - disable, 1 - always, 2 - after vote
g_pCvars[RANDOM_NUMS] = register_cvar("mapm_random_nums", "0"); // 0 - disable, 1 - enable
g_pCvars[PREPARE_TIME] = register_cvar("mapm_prepare_time", "5"); // seconds
g_pCvars[VOTE_TIME] = register_cvar("mapm_vote_time", "10"); // seconds
g_pCvars[VOTE_ITEM_OFFSET] = register_cvar("mapm_vote_item_offset", "0");
g_hForwards[MAPLIST_LOADED] = CreateMultiForward("mapm_maplist_loaded", ET_IGNORE, FP_CELL);
g_hForwards[MAPLIST_UNLOADED] = CreateMultiForward("mapm_maplist_unloaded", ET_IGNORE);
g_hForwards[PREPARE_VOTELIST] = CreateMultiForward("mapm_prepare_votelist", ET_IGNORE, FP_CELL);
g_hForwards[VOTE_STARTED] = CreateMultiForward("mapm_vote_started", ET_IGNORE, FP_CELL);
g_hForwards[VOTE_CANCELED] = CreateMultiForward("mapm_vote_canceled", ET_IGNORE, FP_CELL);
g_hForwards[ANALYSIS_OF_RESULTS] = CreateMultiForward("mapm_analysis_of_results", ET_CONTINUE, FP_CELL, FP_CELL);
g_hForwards[VOTE_FINISHED] = CreateMultiForward("mapm_vote_finished", ET_IGNORE, FP_STRING, FP_CELL, FP_CELL);
g_hForwards[CAN_BE_IN_VOTELIST] = CreateMultiForward("mapm_can_be_in_votelist", ET_CONTINUE, FP_STRING, FP_CELL, FP_CELL);
g_hForwards[CAN_BE_EXTENDED] = CreateMultiForward("mapm_can_be_extended", ET_CONTINUE, FP_CELL);
g_hForwards[COUNTDOWN] = CreateMultiForward("mapm_countdown", ET_IGNORE, FP_CELL, FP_CELL);
register_menucmd(register_menuid("VoteMenu"), 1023, "votemenu_handler");
register_dictionary("mapmanager.txt");
}
public plugin_natives()
{
register_library("map_manager_core");
register_native("mapm_load_maplist", "native_load_maplist");
register_native("mapm_load_maplist_to_array", "native_load_maplist_to_array");
register_native("mapm_block_load_maplist", "native_block_load_maplist");
register_native("mapm_add_map_to_list", "native_add_map_to_list");
register_native("mapm_get_map_index", "native_get_map_index");
register_native("mapm_get_prefix", "native_get_prefix");
register_native("mapm_set_vote_finished", "native_set_vote_finished");
register_native("mapm_start_vote", "native_start_vote");
register_native("mapm_stop_vote", "native_stop_vote");
register_native("mapm_block_show_vote", "native_block_show_vote");
register_native("mapm_get_votelist_size", "native_get_votelist_size");
register_native("mapm_set_votelist_max_items", "native_set_votelist_max_items");
register_native("mapm_push_map_to_votelist", "native_push_map_to_votelist");
register_native("mapm_get_count_maps_in_vote", "native_get_count_maps_in_vote");
register_native("mapm_get_voteitem_info", "native_get_voteitem_info");
register_native("mapm_get_vote_type", "native_get_vote_type");
register_native("mapm_add_vote_to_item", "native_add_vote_to_item");
register_native("is_vote_started", "native_is_vote_started");
register_native("is_vote_finished", "native_is_vote_finished");
}
public native_load_maplist(plugin, params)
{
enum {
arg_filename = 1,
arg_clearlist,
arg_silent
};
if(get_param(arg_clearlist)) {
if(g_aMapsList == Invalid_Array) {
set_fail_state("Clear empty Array. Don't use this navite before core load maplist.");
return;
}
ArrayClear(g_aMapsList);
new ret;
ExecuteForward(g_hForwards[MAPLIST_UNLOADED], ret);
}
new filename[256];
get_string(arg_filename, filename, charsmax(filename));
load_maplist(g_aMapsList, filename, bool:get_param(arg_silent));
}
public native_load_maplist_to_array(plugin, params)
{
enum {
arg_array = 1,
arg_filename
};
new filename[256];
get_string(arg_filename, filename, charsmax(filename));
return load_maplist(Array:get_param(arg_array), filename, true);
}
public native_block_load_maplist(plugin, params)
{
g_bBlockLoad = true;
}
public native_add_map_to_list(plugin, params)
{
enum {
arg_name = 1,
arg_minplayers,
arg_maxplayers
};
new map_info[MapStruct];
get_string(arg_name, map_info[Map], charsmax(map_info[Map]));
if(!valid_map(map_info[Map]) || get_map_index(g_aMapsList, map_info[Map]) != INVALID_MAP_INDEX) {
return 0;
}
map_info[MinPlayers] = get_param(arg_minplayers);
map_info[MaxPlayers] = get_param(arg_maxplayers);
ArrayPushArray(g_aMapsList, map_info);
return 1;
}
public native_get_map_index(plugin, params)
{
enum { arg_map = 1 };
new map[MAPNAME_LENGTH]; get_string(arg_map, map, charsmax(map));
return get_map_index(g_aMapsList, map);
}
public native_get_prefix(plugin, params)
{
enum {
arg_prefix = 1,
arg_len
};
set_string(arg_prefix, g_sPrefix, get_param(arg_len));
}
public native_set_vote_finished(plugin, params)
{
enum { arg_value = 1 };
g_bVoteFinished = bool:get_param(arg_value);
}
public native_start_vote(plugin, params)
{
enum { arg_type = 1 };
return prepare_vote(get_param(arg_type));
}
public native_stop_vote(plugin, params)
{
stop_vote();
}
public native_block_show_vote(plugin, params)
{
g_bBlockShowVote = true;
}
public native_get_votelist_size(plugin, params)
{
if(g_iMaxItems) {
return g_iMaxItems;
}
return min(min(get_num(VOTELIST_SIZE), MAX_VOTELIST_SIZE), ArraySize(g_aMapsList));
}
public native_set_votelist_max_items(plugin, params)
{
enum { arg_value = 1 };
g_iMaxItems = get_param(arg_value);
}
public native_push_map_to_votelist(plugin, params)
{
enum {
arg_map = 1,
arg_type,
arg_ignore_check
};
if(g_iMaxItems && g_iVoteItems >= g_iMaxItems) {
return PUSH_CANCELED;
}
if(g_iVoteItems >= min(min(get_num(VOTELIST_SIZE), MAX_VOTELIST_SIZE), ArraySize(g_aMapsList))) {
return PUSH_CANCELED;
}
new map[MAPNAME_LENGTH]; get_string(arg_map, map, charsmax(map));
new ignore_checks = get_param(arg_ignore_check);
if(!(ignore_checks & CHECK_IGNORE_VALID_MAP) && !is_map_valid(map)) {
return PUSH_CANCELED;
}
if(is_map_in_vote(map)) {
return PUSH_BLOCKED;
}
if(!(ignore_checks & CHECK_IGNORE_MAP_ALLOWED) && !is_map_allowed(map, get_param(arg_type), get_map_index(g_aMapsList, map))) {
return PUSH_BLOCKED;
}
copy(g_sVoteList[g_iVoteItems], charsmax(g_sVoteList[]), map);
g_iVoteItems++;
return PUSH_SUCCESS;
}
public native_get_count_maps_in_vote(plugin, params)
{
return g_iVoteItems + g_bCanExtend;
}
public native_get_voteitem_info(plugin, params)
{
enum {
arg_item = 1,
arg_map,
arg_len
};
new item = get_param(arg_item);
if(item < 0 || item >= g_iVoteItems + g_bCanExtend) {
return 0;
}
set_string(arg_map, g_sVoteList[item], get_param(arg_len));
return g_iVotes[item];
}
public native_get_vote_type(plugin, params)
{
return g_iVoteType;
}
public native_add_vote_to_item(plugin, params)
{
enum {
arg_item = 1,
arg_value
};
new item = get_param(arg_item);
if(item < 0 || item >= g_iVoteItems + g_bCanExtend) {
return 0;
}
new value = get_param(arg_value);
g_iVotes[item] += value;
g_iTotalVotes += value;
return 1;
}
public native_is_vote_started(plugin, params)
{
return g_bVoteStarted;
}
public native_is_vote_finished(plugin, params)
{
return g_bVoteFinished;
}
//-----------------------------------------------------//
// Maplist stuff
//-----------------------------------------------------//
public plugin_cfg()
{
g_aMapsList = ArrayCreate(MapStruct, 1);
new configsdir[256]; get_localinfo("amxx_configsdir", configsdir, charsmax(configsdir));
server_cmd("exec %s/map_manager.cfg", configsdir);
server_exec();
get_mapname(g_sCurMap, charsmax(g_sCurMap));
get_pcvar_string(g_pCvars[PREFIX], g_sPrefix, charsmax(g_sPrefix));
replace_color_tag(g_sPrefix, charsmax(g_sPrefix));
// add forward for change file?
if(!g_bBlockLoad) {
load_maplist(g_aMapsList, FILE_MAPS);
}
}
load_maplist(Array:array, const file[], bool:silent = false)
{
new file_path[256]; get_localinfo("amxx_configsdir", file_path, charsmax(file_path));
format(file_path, charsmax(file_path), "%s/%s", file_path, file);
if(!file_exists(file_path)) {
if(!silent) {
new error[192]; formatex(error, charsmax(error), "File doesn't exist ^"%s^".", file_path);
set_fail_state(error);
}
return 0;
}
new f = fopen(file_path, "rt");
if(!f) {
if(!silent) {
set_fail_state("Can't read maps file.");
}
return 0;
}
new map_info[MapStruct], text[48], map[MAPNAME_LENGTH], first_map[MAPNAME_LENGTH], min[3], max[3], bool:nextmap, bool:found_nextmap;
while(!feof(f)) {
fgets(f, text, charsmax(text));
parse(text, map, charsmax(map), min, charsmax(min), max, charsmax(max));
if(!map[0] || map[0] == ';' || !valid_map(map) || get_map_index(array, map) != INVALID_MAP_INDEX) continue;
if(!first_map[0]) {
copy(first_map, charsmax(first_map), map);
}
if(equali(map, g_sCurMap)) {
nextmap = true;
continue;
}
if(nextmap) {
nextmap = false;
found_nextmap = true;
set_cvar_string("amx_nextmap", map);
}
map_info[Map] = map;
map_info[MinPlayers] = str_to_num(min);
map_info[MaxPlayers] = str_to_num(max) == 0 ? 32 : str_to_num(max);
ArrayPushArray(array, map_info);
min = ""; max = "";
}
fclose(f);
if(!ArraySize(array)) {
if(!silent) {
new error[192]; formatex(error, charsmax(error), "Nothing loaded from ^"%s^".", file_path);
set_fail_state(error);
}
return 0;
}
if(!silent) {
if(!found_nextmap) {
set_cvar_string("amx_nextmap", first_map);
}
new ret;
ExecuteForward(g_hForwards[MAPLIST_LOADED], ret, array);
}
return 1;
}
//-----------------------------------------------------//
// Vote stuff
//-----------------------------------------------------//
prepare_vote(type)
{
if(g_bVoteStarted) {
return 0;
}
g_bVoteStarted = true;
g_bVoteFinished = false;
g_iVoteType = type;
g_iVoteItems = 0;
g_iTotalVotes = 0;
arrayset(g_iVoted, NOT_VOTED, sizeof(g_iVoted));
arrayset(g_iVotes, 0, sizeof(g_iVotes));
new array_size = ArraySize(g_aMapsList);
// new vote_max_items = min(min(get_num(VOTELIST_SIZE), MAX_VOTELIST_SIZE), array_size); //AAAAAAAAAAAAAA
new playercount;
switch(get_playersnum())
{
case 0..12: playercount = 1;
case 13..16: playercount = 1;
case 17..32: playercount = 5;
}
new vote_max_items = min(min(playercount, MAX_VOTELIST_SIZE), array_size);
new ret;
ExecuteForward(g_hForwards[PREPARE_VOTELIST], ret, type);
if(g_iMaxItems) {
vote_max_items = g_iMaxItems;
g_iMaxItems = 0;
}
if(g_iVoteItems < vote_max_items) {
new map_info[MapStruct];
for(new random_map; g_iVoteItems < vote_max_items; g_iVoteItems++) {
do {
random_map = random_num(0, array_size - 1);
ArrayGetArray(g_aMapsList, random_map, map_info);
} while(is_map_in_vote(map_info[Map]) || !is_map_allowed(map_info[Map], PUSH_BY_CORE, random_map));
copy(g_sVoteList[g_iVoteItems], charsmax(g_sVoteList[]), map_info[Map]);
}
}
ExecuteForward(g_hForwards[CAN_BE_EXTENDED], ret, type);
g_bCanExtend = !ret;
if(g_bCanExtend) {
copy(g_sVoteList[g_iVoteItems], charsmax(g_sVoteList[]), g_sCurMap);
}
g_iCurMap = -1;
for(new i; i < g_iVoteItems + g_bCanExtend; i++) {
if(equali(g_sCurMap, g_sVoteList[i])) {
g_iCurMap = i;
break;
}
}
if(get_num(RANDOM_NUMS)) {
arrayset(g_iRandomNums, -1, sizeof(g_iRandomNums));
for(new i; i < g_iVoteItems + g_bCanExtend; i++) {
do {
g_iRandomNums[i] = random_num(0, g_iVoteItems + g_bCanExtend - 1);
} while(in_array(i, g_iRandomNums[i]));
}
} else {
for(new i; i < g_iVoteItems + g_bCanExtend; i++) {
g_iRandomNums[i] = i;
}
}
g_iOffset = get_num(VOTE_ITEM_OFFSET);
if(g_iOffset + g_iVoteItems + g_bCanExtend >= MAX_VOTELIST_SIZE + 1) {
g_iOffset = MAX_VOTELIST_SIZE + 1 - g_iVoteItems - g_bCanExtend;
}
g_iTimer = get_num(PREPARE_TIME) + 1;
countdown(TASK_PREPARE_VOTE);
return 1;
}
is_map_allowed(map[], type, index)
{
new ret;
ExecuteForward(g_hForwards[CAN_BE_IN_VOTELIST], ret, map, type, index);
return ret == MAP_ALLOWED;
}
in_array(index, num)
{
for(new i; i < index; i++) {
if(num == g_iRandomNums[i]) {
return true;
}
}
return false;
}
get_original_num(num)
{
for(new i; i < g_iVoteItems + g_bCanExtend; i++) {
if(g_iRandomNums[i] == num) {
return i;
}
}
return 0;
}
public countdown(taskid)
{
if(--g_iTimer > 0) {
if(taskid == TASK_VOTE_TIME && !g_bBlockShowVote) {
new dont_show_result = get_num(SHOW_RESULT_TYPE) == SHOW_DISABLED;
g_iShowType = get_num(SHOW_RESULT_TYPE);
g_iShowPercent = get_num(SHOW_PERCENT);
g_bShowSelects = get_num(SHOW_SELECTS);
new players[32], pnum; get_players(players, pnum, "ch");
for(new i, id; i < pnum; i++) {
id = players[i];
if(!dont_show_result || g_iVoted[id] == NOT_VOTED) {
show_votemenu(id);
}
}
}
new type = COUNTDOWN_UNKNOWN;
switch(taskid) {
case TASK_PREPARE_VOTE: type = COUNTDOWN_PREPARE;
case TASK_VOTE_TIME: type = COUNTDOWN_VOTETIME;
}
new ret;
ExecuteForward(g_hForwards[COUNTDOWN], ret, type, g_iTimer);
set_task(1.0, "countdown", taskid);
} else {
if(taskid == TASK_PREPARE_VOTE) {
start_vote();
} else if(taskid == TASK_VOTE_TIME) {
show_menu(0, 0, "^n", 1);
finish_vote();
}
}
}
start_vote()
{
// server_print("--start vote--");
new ret;
ExecuteForward(g_hForwards[VOTE_STARTED], ret, g_iVoteType);
// TODO: add preview for N seconds
g_iTimer = get_num(VOTE_TIME) + 1;
countdown(TASK_VOTE_TIME);
}
public show_votemenu(id)
{
static menu[512];
new len, keys, percent, item;
len = formatex(menu, charsmax(menu), "\y%L:^n^n", id, g_iVoted[id] != NOT_VOTED ? "MAPM_MENU_VOTE_RESULTS" : "MAPM_MENU_CHOOSE_MAP");
//if(get_playersnum() < 16)
//{
// g_iVoteItems = 2;
// g_bCanExtend = 0;
//}
for(item = 0; item < g_iVoteItems + g_bCanExtend; item++)
{
len += formatex(menu[len], charsmax(menu) - len, "%s", (item == g_iVoteItems) ? "^n" : "");
if(g_iVoted[id] == NOT_VOTED)
{
len += formatex(menu[len], charsmax(menu) - len, "\r%d.\w %s", (g_iRandomNums[item] + 1 + g_iOffset == 10 ? 0 : g_iRandomNums[item] + 1 + g_iOffset), g_sVoteList[item]);
keys |= (1 << (g_iRandomNums[item] + g_iOffset));
}
else
{
len += formatex(menu[len], charsmax(menu) - len, "%s%s", (g_iRandomNums[item] + g_iOffset == g_iVoted[id]) ? "\r" : "\d", g_sVoteList[item]);
}
if(g_iShowPercent == PERCENT_ALWAYS || g_iVoted[id] != NOT_VOTED && g_iShowPercent == PERCENT_AFTER_VOTE)
{
percent = g_iTotalVotes ? floatround(g_iVotes[item] * 100.0 / g_iTotalVotes) : 0;
len += formatex(menu[len], charsmax(menu) - len, "\d[\r%d%%\d]", percent);
}
if(item == g_iCurMap)
{
len += formatex(menu[len], charsmax(menu) - len, "\y[%L]", id, "MAPM_MENU_EXTEND");
}
len += formatex(menu[len], charsmax(menu) - len, "^n");
}
len += formatex(menu[len], charsmax(menu) - len, "^n\d%L \r%d\d %L", id, "MAPM_MENU_LEFT", g_iTimer, id, "MAPM_SECONDS");
if(!keys) keys = (1 << 9);
if(g_iVoted[id] != NOT_VOTED && g_iShowType == SHOW_HUD) {
while(replace(menu, charsmax(menu), "\r", "")){}
while(replace(menu, charsmax(menu), "\d", "")){}
while(replace(menu, charsmax(menu), "\w", "")){}
while(replace(menu, charsmax(menu), "\y", "")){}
set_hudmessage(0, 55, 255, 0.02, -1.0, 0, 6.0, 1.0, 0.1, 0.2, 4);
show_hudmessage(id, "%s", menu);
} else {
show_menu(id, keys, menu, -1, "VoteMenu");
}
}
public votemenu_handler(id, key)
{
if(g_iVoted[id] != NOT_VOTED) {
show_votemenu(id);
return PLUGIN_HANDLED;
}
new original = get_original_num(key - g_iOffset);
g_iVotes[original]++;
g_iTotalVotes++;
g_iVoted[id] = key;
// TODO: add forward if someone want add more votes for admin, etc.
if(g_bShowSelects) {
new name[32]; get_user_name(id, name, charsmax(name));
if(original == g_iCurMap) {
client_print_color(0, id, "%s^3 %L", g_sPrefix, LANG_PLAYER, "MAPM_CHOSE_EXTEND", name);
} else {
client_print_color(0, id, "%s^3 %L", g_sPrefix, LANG_PLAYER, "MAPM_CHOSE_MAP", name, g_sVoteList[original]);
}
}
if(g_iShowType != SHOW_DISABLED) {
show_votemenu(id);
}
return PLUGIN_HANDLED;
}
finish_vote()
{
g_bVoteStarted = false;
g_bBlockShowVote = false;
// vote results
// pre forward
new ret;
ExecuteForward(g_hForwards[ANALYSIS_OF_RESULTS], ret, g_iVoteType, g_iTotalVotes);
if(ret) {
if(ret == ABORT_VOTE_WITH_FORWARD) {
ExecuteForward(g_hForwards[VOTE_CANCELED], ret, g_iVoteType);
}
return;
}
g_bVoteFinished = true;
new max_vote = 0;
if(g_iTotalVotes) {
for(new i = 1; i < g_iVoteItems + 1; i++) {
if(g_iVotes[max_vote] < g_iVotes[i]) max_vote = i;
}
}
else {
max_vote = random_num(0, g_iVoteItems - 1);
}
// post forward
// add blocking?
ExecuteForward(g_hForwards[VOTE_FINISHED], ret, g_sVoteList[max_vote], g_iVoteType, g_iTotalVotes);
}
stop_vote()
{
if(task_exists(TASK_VOTE_TIME)) {
show_menu(0, 0, "^n", 1);
}
remove_task(TASK_PREPARE_VOTE);
remove_task(TASK_VOTE_TIME);
g_bVoteStarted = false;
g_bVoteFinished = false;
new ret;
ExecuteForward(g_hForwards[VOTE_CANCELED], ret, g_iVoteType);
}
//-----------------------------------------------------//
// Usefull func
//-----------------------------------------------------//
get_map_index(Array:array, map[])
{
for(new i = 0, map_info[MapStruct], size = ArraySize(array); i < size; i++) {
ArrayGetArray(array, i, map_info);
if(equali(map, map_info[Map])) return i;
}
return INVALID_MAP_INDEX;
}
bool:is_map_in_vote(map[])
{
for(new i; i < g_iVoteItems; i++) {
if(equali(map, g_sVoteList[i])) {
return true;
}
}
return false;
}
Вообщем, при продлении значение timelimit увеличивается с каждым разом на 15 мин, и достигает 95-110 мин и дальше. Также после голосования, если отменит то timelimit становиться вечным(0). Я так прочел, это может быть как то связано с тем,что mp_timelimit прописан где-то помимо server.cfg, так вот у меня timelimit прописан listenserver.cfg и game.cfg, вообщем прововал убрать квары из game.cfg и listenserver.cfg, но не помогло.
Download all Attachments
-
16 KB Просмотры: 225
-
5.4 KB Просмотры: 213
-
3.8 KB Просмотры: 224
-
3.3 KB Просмотры: 226
-
1.9 KB Просмотры: 217
-
6.5 KB Просмотры: 223
-
16.3 KB Просмотры: 238
-
3.8 KB Просмотры: 201
-
21.9 KB Просмотры: 222