- Ошибка
-
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// mode.sma
// C:\Users\HP\Desktop\complier\mode.sma(5) : fatal error 100: cannot read from file: "reapi"
//
// Compilation aborted.
// 1 Error.
// Could not locate output file C:\Users\HP\Desktop\complier\compiled\mode.amx (compile failed).
//
// Compilation Time: 0,19 sec
// ----------------------------------------
Press enter to exit ...
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <reapi>
#define PLUGIN_VERSION "2.5re"
#if (AMXX_VERSION_NUM < 183) || defined NO_NATIVE_COLORCHAT
#include <colorchat>
#include <dhudmessage>
#else
#define DontChange print_team_default
#define client_disconnect client_disconnected
#endif
#pragma ctrlchar '\'
#pragma semicolon 1
#define ID_KEY_WALL 54345678
//x //y
#define MESSAGE_MAP_STATUS -1.0, 0.8 // Позиция сообщении о Закрытии/Открытии карты.
//r //green //blue
#define COLOR_MAP_CLOSE 255, 0, 0 // Цвет сообщения, когда низкий онлайн и карта закрывается. Тип цвета RGB, http://www.colorschemer.com/online.html
#define COLOR_MAP_OPEN 0, 255, 0 // Цвет сообщения, когда онлайн выше требуемого и карта открывается. Тип цвета RGB, http://www.colorschemer.com/online.html
#define MODE_TIME_START 10.0 // Через сколько начать голосование, после нужного количества голосов.
#define MODE_COUNT_START 5 // Отчет до начала голосования
#define VOTE_TIMEWAIT 3 // Через сколько минут после голосования /mode, будет снова доступно.
#define VOTE_RATIO 0.5 // Погрешность для количество голосов, Пример: (Ratio: 0.5, требуется 0.5 * 32 = 16 голосов из 32 игроков)
#define STRONG_PUSH 15.0 // Сила толчка weaponbox (оружия, C4) от стенки
#define MAX_CLIENTS 32
#define PREFIX "\1[\4Mode\1]"
#define CLASSNAME_WALL "test_effect" // unused classname in the game
#define SPRITE_WALL "sprites/mode/wall.spr"
#define Vector(%0,%1,%2) (Float:{%0,%1,%2})
#define VectorCompare(%0,%1) (%0[x] == %1[x] && %0[y] == %1[y] && %0[z] == %1[z])
#define VectorDT(%0,%1,%2,%3) (!(%0[x] > %3[x] || %1[x] < %2[x]) && !(%0[y] > %3[y] || %1[y] < %2[y]) && !(%0[z] > %3[z] || %1[z] < %2[z]))
enum (+= 256222)
{
TASK_MODE_VOTE = 256222,
TASK_MODE_START,
TASK_MODE_INIT,
TASK_MODE_NOTIFY,
TASK_MODE_AUTO_MAPCLOSE
};
enum _:coord_s
{
Float:x,
Float:y,
Float:z
};
enum status_s
{
map_open,
map_close,
};
enum _:blocked_s
{
block_none = 0,
block_vote,
block_start_vote,
block_success_vote,
block_roundnew,
block_commencing,
block_admin_change,
block_permament
};
enum _:vote_s
{
vote_no,
vote_yes
};
enum _:server_info_s
{
status_s:m_iStatus,
status_s:m_iStatusLast,
blocked_s:m_iBlocked,
m_szFile[64],
m_iAll,
m_iMaxpl,
m_iCount,
m_LoadBox,
bool:m_bAdvanced,
bool:m_bInitialized,
m_iClosedIndex,
m_iOnline_High,
m_iOnline_Low,
m_szMap[32],
m_iVoting[vote_s],
m_iVote[MAX_CLIENTS + 1],
Float:m_fNext,
Float:m_fWait[MAX_CLIENTS + 1],
};
new g_pServerVar[server_info_s];
enum _:box_data_s
{
m_iBox,
m_iCopy,
m_iType,
m_iEntid,
m_iSetting,
m_iSolid,
m_iSprite,
m_iBeamSprite,
Float:m_fScale
};
new g_pBoxVar[box_data_s];
enum box_vector_s
{
m_fOrigin,
m_fAngles,
m_fMins,
m_fMaxs
};
new Float:g_pBoxVector[box_vector_s][coord_s];
new HamHook:g_pForwardThink;
// CVars
new pcvar_mode_admin_only,
pcvar_mode_allow_vote,
pcvar_mode_allow_change,
pcvar_mode_force_check_online,
pcvar_mode_block_startgame,
pcvar_mode_push_weaponbox,
pcvar_mode_message_on_touch,
pcvar_mode_touch_wait,
pcvar_mode_changemapname;
public plugin_precache()
{
precache_model(SPRITE_WALL);
g_pBoxVar[m_iBeamSprite] = precache_model("sprites/smoke.spr");
get_mapname(g_pServerVar[m_szMap], charsmax(g_pServerVar[m_szMap]));
}
public plugin_init()
{
register_plugin("Mode 2x2", PLUGIN_VERSION, "s1lent");
register_cvar("mode2x2_version", PLUGIN_VERSION, FCVAR_SERVER | FCVAR_SPONLY);
register_menucmd(register_menuid("Main Edit Menu"), 0x3FF, "MainEdit_Handler");
register_menucmd(register_menuid("Settings Menu"), 0x23F, "Settings_Handler");
register_menucmd(register_menuid("Properties Menu"), 0x3FF, "Properties_Handler");
DisableHamForward((g_pForwardThink = RegisterHam(Ham_Think, CLASSNAME_WALL, "CTestEffect__ThinkWall")));
pcvar_mode_admin_only = register_cvar("mode_admin_only", "0"); // Запрещает второму админу использовать команду "/change", если первый админ его уже использовал для открытия карты и если админ который активировал "/change" - активный и находится в команде.
pcvar_mode_allow_vote = register_cvar("mode_allow_vote", "1"); // Разрешить использовать команду "/mode"
pcvar_mode_allow_change = register_cvar("mode_allow_change", "1"); // Разрешить использовать команду "/change"
pcvar_mode_force_check_online = register_cvar("mode_force_check_online", "1"); // Заставлять проверять онлайн даже при /change, если нет действующих админов в игре, кроме админов в спектаторе, при mode_admin_only, проверяет только одного активного админа.
pcvar_mode_block_startgame = register_cvar("mode_block_startgame", "0"); // Никогда не ставить стенки при "GameCommencing" или "Restart"
pcvar_mode_push_weaponbox = register_cvar("mode_push_weaponbox", "1"); // Толкать weaponbox (оружия, C4) от стенки
pcvar_mode_message_on_touch = register_cvar("mode_messagetouch", "0"); // Сообщать игроку при касании стены о том, что проход закрыт.
pcvar_mode_touch_wait = register_cvar("mode_messagetouch_time", "5.5"); // Задержка для повторного сообщения при касании стенки игроком.
pcvar_mode_changemapname = register_cvar("mode_changemapname", "1");
Load_Config();
register_clcmd("say /mode", "CMD_Mode", 0, "<Голосование за открытие/закрытие карты>");
register_clcmd("say /change", "CMD_ModeChange", ADMIN_VOTE, "<Смена режима Mode 2x2, Открыть/Закрыть карту>");
register_clcmd("say /box", "CMD_MenuBox", ADMIN_RCON, "<Управление объектами, Создание/Изменение/Удаление>");
register_dictionary("mode.txt");
// initialized vars
g_pServerVar[m_iMaxpl] = get_maxplayers();
g_pServerVar[m_fNext] = _:(get_gametime() + (VOTE_TIMEWAIT * 60.0));
}
public Task_Initialized()
{
g_pServerVar[m_bInitialized] = true;
UTIL__ChangeNameOfMap(g_pServerVar[m_iStatus]);
}
public Task_AutoMapClose()
{
new nActivePlayers = UTIL__GetActivePlayers();
if (nActivePlayers <= 0)
{
DrawBox(g_pServerVar[m_iStatus] = map_close, false);
}
}
// ready config file
stock Load_Config()
{
new szCfgDir[128];
get_configsdir(szCfgDir, charsmax(szCfgDir));
get_localinfo("amxx_configsdir", g_pServerVar[m_szFile], charsmax(g_pServerVar[m_szFile]));
add(g_pServerVar[m_szFile], charsmax(g_pServerVar[m_szFile]), "/mode/");
add(szCfgDir, charsmax(szCfgDir), "/mode.cfg");
mkdir(g_pServerVar[m_szFile]);
server_cmd("exec %s", szCfgDir);
server_exec();
formatex(g_pServerVar[m_szFile], charsmax(g_pServerVar[m_szFile]), "%s%s.ini", g_pServerVar[m_szFile], g_pServerVar[m_szMap]);
if (file_exists(g_pServerVar[m_szFile]))
{
if (!(g_pServerVar[m_LoadBox] = LoadBox()))
return;
DrawBox(g_pServerVar[m_iStatus] = map_open);
if (get_pcvar_num(pcvar_mode_message_on_touch))
{
RegisterHam(Ham_Touch, "player", "CBasePlayer__Touch");
}
if (get_pcvar_num(pcvar_mode_push_weaponbox))
{
RegisterHam(Ham_Touch, "weaponbox", "CWeaponBox__Touch");
}
register_event("HLTV", "EventRoundNew", "a", "1=0", "2=0");
register_menucmd(register_menuid("Mode Menu"), MENU_KEY_1 | MENU_KEY_2, "Mode_Handler");
register_event("TextMsg", "EventStartGame", "a", "2=#Game_Commencing", "2=#Game_will_restart_in");
// when all the configs with 3-rd party plugins already loaded
if (get_pcvar_num(pcvar_mode_changemapname))
{
set_task(3.0, "Task_Initialized", TASK_MODE_INIT);
}
// To check if the game is in idle state, no active players.
// So close the map over time.
set_task(15.0, "Task_AutoMapClose", TASK_MODE_AUTO_MAPCLOSE);
}
}
public plugin_end()
{
// reset mapname
UTIL__ChangeNameOfMap(map_open);
remove_task(TASK_MODE_VOTE);
remove_task(TASK_MODE_START);
remove_task(TASK_MODE_INIT);
remove_task(TASK_MODE_NOTIFY);
remove_task(TASK_MODE_AUTO_MAPCLOSE);
}
public plugin_pause()
{
// hide wall
if (g_pServerVar[m_iStatus] == map_close)
DrawBox(g_pServerVar[m_iStatus] = map_open, false);
// reset mapname
UTIL__ChangeNameOfMap(map_open);
remove_task(TASK_MODE_VOTE);
remove_task(TASK_MODE_START);
remove_task(TASK_MODE_INIT);
remove_task(TASK_MODE_NOTIFY);
remove_task(TASK_MODE_AUTO_MAPCLOSE);
}
public client_disconnect(id)
{
if (!g_pServerVar[m_LoadBox])
return;
if (g_pServerVar[m_iClosedIndex] == id)
g_pServerVar[m_iClosedIndex] = 0;
if (g_pServerVar[m_iVote][id])
{
--g_pServerVar[m_iAll];
g_pServerVar[m_iVote][id] = 0;
}
}
public EventStartGame()
{
if (!get_pcvar_num(pcvar_mode_block_startgame))
return;
g_pServerVar[m_iBlocked] = blocked_s:block_commencing;
DrawBox(g_pServerVar[m_iStatus] = map_open, false);
}
public EventRoundNew()
{
new bool:bCvarChange = get_pcvar_num(pcvar_mode_allow_change) != 0;
new bool:bCvarVote = get_pcvar_num(pcvar_mode_allow_vote) != 0;
new bool:bCvarStartGame = get_pcvar_num(pcvar_mode_block_startgame) != 0;
if (bCvarChange && get_pcvar_num(pcvar_mode_force_check_online) != 0 && g_pServerVar[m_iBlocked] > blocked_s:block_admin_change)
{
new bool:bBlocked = false;
new iPlayers[32], iNum, p;
get_players(iPlayers, iNum, "ch");
for (new a = 0; a < iNum; ++a)
{
p = iPlayers[a];
if ((get_user_flags(p) & ADMIN_VOTE) && (1 <= get_member(p, m_iTeam) <= 2))
{
// if exists admin initiator closed map, trying block is changed mode
if (get_pcvar_num(pcvar_mode_admin_only) != 0 && g_pServerVar[m_iClosedIndex] != a)
{
continue;
}
bBlocked = true;
break;
}
}
if (!bBlocked && g_pServerVar[m_iOnline_Low] >= UTIL__GetActivePlayers())
{
g_pServerVar[m_iBlocked] = blocked_s:block_none;
DrawBox(g_pServerVar[m_iStatus] = map_close);
}
}
else if (!bCvarChange && !bCvarVote && bCvarStartGame)
{
if (g_pServerVar[m_iBlocked] == blocked_s:block_commencing)
g_pServerVar[m_iBlocked] = blocked_s:block_none;
}
/*else if (bCvarChange || bCvarVote)*/
{
switch (g_pServerVar[m_iBlocked])
{
case block_success_vote:
{
DrawBox(g_pServerVar[m_iStatus]);
g_pServerVar[m_iBlocked] = blocked_s:block_roundnew;
}
case block_commencing:
{
g_pServerVar[m_iBlocked] = blocked_s:block_none;
}
case block_admin_change:
{
DrawBox(g_pServerVar[m_iStatus]);
g_pServerVar[m_iBlocked] = blocked_s:block_permament;
}
case block_none:
{
new nActivePlayers = UTIL__GetActivePlayers();
// check condition for open map
if (nActivePlayers >= g_pServerVar[m_iOnline_High])
{
if (g_pServerVar[m_iStatus] == map_close)
DrawBox(g_pServerVar[m_iStatus] = map_open);
}
// check condition for close map
else if (nActivePlayers <= g_pServerVar[m_iOnline_Low])
{
if (g_pServerVar[m_iStatus] == map_open)
DrawBox(g_pServerVar[m_iStatus] = map_close);
}
}
}
}
}
public CTestEffect__ThinkWall(const this)
{
if (g_pBoxVar[m_iEntid] != this)
return HAM_IGNORED;
new Float:mins[coord_s], Float:maxs[coord_s], Float:pos[coord_s];
entity_get_vector(this, EV_VEC_origin, pos);
entity_get_vector(this, EV_VEC_mins, mins);
entity_get_vector(this, EV_VEC_maxs, maxs);
mins[x] += pos[x];
mins[y] += pos[y];
mins[z] += pos[z];
maxs[x] += pos[x];
maxs[y] += pos[y];
maxs[z] += pos[z];
new const color[] = { 255, 0, 0 }; // red
UTIL_DrawLine(maxs[0], maxs[1], maxs[2], mins[0], mins[1], mins[2], { 0, 255, 0 }); // green
UTIL_DrawLine(maxs[0], maxs[1], maxs[2], mins[0], maxs[1], maxs[2], color);
UTIL_DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], maxs[2], color);
UTIL_DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], maxs[1], mins[2], color);
UTIL_DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], mins[2], color);
UTIL_DrawLine(mins[0], mins[1], mins[2], mins[0], maxs[1], mins[2], color);
UTIL_DrawLine(mins[0], mins[1], mins[2], mins[0], mins[1], maxs[2], color);
UTIL_DrawLine(mins[0], maxs[1], maxs[2], mins[0], maxs[1], mins[2], color);
UTIL_DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], mins[2], color);
UTIL_DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], mins[2], color);
UTIL_DrawLine(maxs[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], color);
UTIL_DrawLine(maxs[0], mins[1], maxs[2], mins[0], mins[1], maxs[2], color);
UTIL_DrawLine(mins[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], color);
entity_set_float(this, EV_FL_nextthink, get_gametime() + 0.155);
return HAM_IGNORED;
}
stock UTIL_DrawLine(const Float:x1, const Float:y1, const Float:z1, const Float:x2, const Float:y2, const Float:z2, const color[3])
{
new vecStart[3], vecEnd[3];
vecStart[0] = floatround(x1);
vecStart[1] = floatround(y1);
vecStart[2] = floatround(z1);
vecEnd[0] = floatround(x2);
vecEnd[1] = floatround(y2);
vecEnd[2] = floatround(z2);
UTIL_DrawBeamPoints(vecStart, vecEnd, 2, color);
return 0;
}
stock UTIL_DrawBeamPoints(const vecStart[3], const vecEnd[3], lifetime, const color[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMPOINTS);
write_coord(vecStart[0]);
write_coord(vecStart[1]);
write_coord(vecStart[2]);
write_coord(vecEnd[0]);
write_coord(vecEnd[1]);
write_coord(vecEnd[2]);
write_short(g_pBoxVar[m_iBeamSprite]);
write_byte(0);
write_byte(0);
write_byte(lifetime);
write_byte(10);
write_byte(0);
write_byte(color[0]); // red
write_byte(color[1]); // green
write_byte(color[2]); // blue
write_byte(255);
write_byte(0);
message_end();
}
public CWeaponBox__Touch(const this, const other)
{
if (!is_valid_ent(other) || entity_get_int(other, EV_INT_impulse) != ID_KEY_WALL)
return HAM_IGNORED;
new Float:flAngles[3], Float:flVelocity[3];
entity_get_vector(other, EV_VEC_angles, flAngles);
angle_vector(flAngles, ANGLEVECTOR_FORWARD, flVelocity);
flVelocity[x] = -flVelocity[x] * STRONG_PUSH;
flVelocity[y] = -flVelocity[y] * STRONG_PUSH;
flVelocity[z] = -flVelocity[z] * STRONG_PUSH;
entity_set_vector(this, EV_VEC_velocity, flVelocity);
return HAM_IGNORED;
}
public CBasePlayer__Touch(const this, const other)
{
if (!is_valid_ent(other) || entity_get_int(other, EV_INT_impulse) != ID_KEY_WALL)
{
return HAM_IGNORED;
}
new Float:flCurrentTime = get_gametime();
if (flCurrentTime > g_pServerVar[m_fWait][this])
{
g_pServerVar[m_fWait][this] = _:(flCurrentTime + get_pcvar_float(pcvar_mode_touch_wait));
client_print_color(this, DontChange, "%L %L", this, "MODE_PREFIX", this, "MODE_MESSAGE_TOUCH");
return HAM_IGNORED;
}
return HAM_IGNORED;
}
public CMD_ModeChange(id, level, cid)
{
if (!get_pcvar_num(pcvar_mode_allow_change))
return PLUGIN_CONTINUE;
if (!cmd_access(id, level, cid, 2))
return PLUGIN_CONTINUE;
if (!g_pServerVar[m_LoadBox])
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_NOT_USED");
return PLUGIN_HANDLED;
}
new szName[32];
get_user_name(id, szName, charsmax(szName));
if (g_pServerVar[m_iClosedIndex] != id && is_user_connected(g_pServerVar[m_iClosedIndex]))
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_ADMIN_BUSY_CHANGE", szName);
return PLUGIN_HANDLED;
}
switch (g_pServerVar[m_iBlocked])
{
case block_vote:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_VOTE");
return PLUGIN_HANDLED;
}
case block_start_vote:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_START_VOTE");
return PLUGIN_HANDLED;
}
case block_success_vote:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_WAIT_NEW_ROUND");
return PLUGIN_HANDLED;
}
case block_admin_change:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_ADMIN_CHANGED", id, (g_pServerVar[m_iStatus] == map_close) ? "MODE_ADMIN_CLOSED" : "MODE_ADMIN_OPENED");
return PLUGIN_HANDLED;
}
}
g_pServerVar[m_iBlocked] = blocked_s:block_admin_change;
g_pServerVar[m_fNext] = _:(get_gametime() + (VOTE_TIMEWAIT * 60.0));
g_pServerVar[m_iStatus] ^= map_close;
if (get_pcvar_num(pcvar_mode_admin_only) != 0)
{
g_pServerVar[m_iClosedIndex] = (g_pServerVar[m_iStatus] == map_open) ? id : 0;
}
new iPlayers[32], iNum, p;
get_players(iPlayers, iNum, "ch");
for (new a = 0; a < iNum; ++a)
{
p = iPlayers[a];
if (get_user_flags(p) & ADMIN_VOTE)
{
client_print_color(p, DontChange + id, "%L %L", p, "MODE_PREFIX", p, "MODE_ADMIN_CHANGED_ADMINS", szName, p, (g_pServerVar[m_iStatus] == map_close) ? "MODE_ADMIN_CLOSED" : "MODE_ADMIN_OPENED");
}
}
return PLUGIN_HANDLED;
}
public CMD_Mode(id)
{
if (!get_pcvar_num(pcvar_mode_allow_vote))
return PLUGIN_CONTINUE;
if (!g_pServerVar[m_LoadBox])
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_NOT_USED");
return PLUGIN_HANDLED;
}
switch (g_pServerVar[m_iBlocked])
{
case block_vote:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_VOTE");
return PLUGIN_HANDLED;
}
case block_start_vote:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_START_VOTE");
return PLUGIN_HANDLED;
}
case block_admin_change:
{
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_ADMIN_CHANGED", id, (g_pServerVar[m_iStatus] == map_close) ? "MODE_ADMIN_CLOSED" : "MODE_ADMIN_OPENED");
return PLUGIN_HANDLED;
}
}
new Float:flCurrent = get_gametime();
if (g_pServerVar[m_fNext] > flCurrent)
{
new szBuffer[64];
getChangeleft(id, floatround(g_pServerVar[m_fNext] - flCurrent), szBuffer, charsmax(szBuffer));
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_VOTE_LEFT", szBuffer);
return PLUGIN_HANDLED;
}
else
{
new iNumRatio = floatround(VOTE_RATIO * UTIL__GetActivePlayers());
if (g_pServerVar[m_iVote][id])
client_print_color(id, DontChange, "%L %L", id, "MODE_PREFIX", id, "MODE_VOTE_ALREADY", g_pServerVar[m_iAll], iNumRatio);
else
{
++g_pServerVar[m_iAll];
g_pServerVar[m_iVote][id] = 1;
new iPlayers[32], szName[32], iNum;
get_players(iPlayers, iNum, "ch");
get_user_name(id, szName, charsmax(szName));
for (new a = 0; a < iNum; ++a)
{
client_print_color(iPlayers[a], DontChange + id, "%L %L", id, "MODE_PREFIX", id, "MODE_VOTED", szName, id, (g_pServerVar[m_iStatus] == map_close) ? "MODE_VOTE_OPENED" : "MODE_VOTE_CLOSED", g_pServerVar[m_iAll], iNumRatio);
}
if (iNumRatio <= g_pServerVar[m_iAll])
{
g_pServerVar[m_iCount] = MODE_COUNT_START;
g_pServerVar[m_iBlocked] = blocked_s:block_vote;
set_task(MODE_TIME_START, "Task_ModeVote", TASK_MODE_START);
client_print_color(0, DontChange, "%L %L", LANG_PLAYER, "MODE_PREFIX", LANG_PLAYER, "MODE_MESSAGE_VOTE_START", 10);
}
}
}
return 1;
}
public Task_ModeVote()
{
new szBuffer[128];
if (0 < g_pServerVar[m_iCount]--)
{
new szSpeak[24];
num_to_word(g_pServerVar[m_iCount] + 1, szSpeak, charsmax(szSpeak));
client_cmd(0, "spk \"fvox/%s\"", szSpeak);
formatex(szBuffer, charsmax(szBuffer), "%L", LANG_PLAYER, "MODE_VOTE_PRESTART_MENU", LANG_PLAYER, (g_pServerVar[m_iStatus] == map_close) ? "MODE_TITLE_OPENED" : "MODE_TITLE_CLOSED", g_pServerVar[m_iCount] + 1);
show_menu(0, 0x3FF, szBuffer, 2, "Mode Menu");
set_task(1.0, "Task_ModeVote", TASK_MODE_START);
}
else
{
g_pServerVar[m_iBlocked] = blocked_s:block_start_vote;
formatex(szBuffer, charsmax(szBuffer), "%L", LANG_PLAYER, "MODE_VOTE_POSTSTART_MENU", LANG_PLAYER, (g_pServerVar[m_iStatus] == map_close) ? "MODE_TITLE_OPENED" : "MODE_TITLE_CLOSED");
show_menu(0, MENU_KEY_1 | MENU_KEY_2, szBuffer, 18, "Mode Menu");
set_task(20.0, "Task_ResultVote", TASK_MODE_VOTE);
}
}
public Mode_Handler(id, key)
{
if (!get_pcvar_num(pcvar_mode_allow_vote))
return PLUGIN_CONTINUE;
if (g_pServerVar[m_iBlocked] == blocked_s:block_vote)
{
client_cmd(id, "slot%d", key + 1);
return PLUGIN_HANDLED;
}
new szName[32];
get_user_name(id, szName, charsmax(szName));
client_print_color(0, DontChange + id, "%L", id, "MODE_VOTE_FORMAT", szName, id, key ? "MODE_VOTE_NO" : "MODE_VOTE_YES");
++g_pServerVar[m_iVoting][key];
return PLUGIN_HANDLED;
}
public Task_ResultVote()
{
g_pServerVar[m_iAll] = 0;
g_pServerVar[m_fNext] = _:(get_gametime() + (VOTE_TIMEWAIT * 60.0));
arrayset(g_pServerVar[m_iVote], 0, g_pServerVar[m_iMaxpl]);
if (g_pServerVar[m_iVoting][vote_no] > g_pServerVar[m_iVoting][vote_yes])
{
g_pServerVar[m_iBlocked] = blocked_s:block_success_vote;
g_pServerVar[m_iStatus] ^= map_close;
client_print_color(0, DontChange, "%L %L", LANG_PLAYER, "MODE_PREFIX", LANG_PLAYER, "MODE_VOTE_RESULT",
g_pServerVar[m_iVoting][vote_no],
g_pServerVar[m_iVoting][vote_yes],
g_pServerVar[m_iVoting][vote_no] + g_pServerVar[m_iVoting][vote_yes]);
Исходник и проблему прикрепил в виде файла
В этой теме было размещено решение! Перейти к решению.
Download all Attachments
-
24.1 KB Просмотры: 87
-
52.3 KB Просмотры: 82