Неверный раздел форума
Плагин компилится без ошибок,
Но менюшка не открывается....
Почему и как исправить?
Но менюшка не открывается....
Почему и как исправить?
Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
enum
{
NONE = -1,
LIVE,
WARM,
}
new const g_Msg[][] =
{
"LIVE LIVE LIVE",
"Рестарт"
}
new g_msgSayText
new g_Count, g_CountA
new g_Round = NONE
public plugin_init()
{
register_plugin("Lite CW", "1.0", "ill")
register_event("CurWeapon", "EventCurWeapon", "be", "2!29")
register_event("DeathMsg", "on_death", "a")
register_logevent("logevent_round_end", 2, "1=Round_End")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_clcmd("cwmenu", "show_cw_menu")
register_clcmd("type_password", "clcmd_setpassword", ADMIN_BAN);
register_menu("CW Menu", KEYSMENU, "cw_menu")
RegisterHam(Ham_Spawn, "player", "fw_SpawnPost", 1)
g_msgSayText = get_user_msgid("SayText")
set_task(120.0, "reset_password", .flags = "b")
}
public reset_password()
{
if(!get_playersnum())
set_cvar_string("sv_password", "")
}
public clcmd_setpassword(id, bitsAccess)
{
if(!(get_user_flags(id) & bitsAccess))
return PLUGIN_HANDLED
new szPwd[32]
read_argv(1, szPwd, charsmax(szPwd))
remove_quotes(szPwd)
set_cvar_string("sv_password", szPwd)
show_cw_menu(id)
return PLUGIN_HANDLED
}
public logevent_round_end()
{
g_Round = NONE
}
public fnRevivePlayer(id)
{
if(!is_user_alive(id) && (get_user_team(id) == 1 || get_user_team(id) == 2))
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
public show_cw_menu(id)
{
if(!(get_user_flags(id) & ADMIN_BAN))
return PLUGIN_HANDLED
static menu[512], len
len = 0
len += formatex(menu[len], charsmax(menu) - len, "\y КВ Меню \w[1/2]^n^n")
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wКикнуть^n")
len += formatex(menu[len], charsmax(menu) - len, "\r2. \wЗабанить^n")
len += formatex(menu[len], charsmax(menu) - len, "\r3. \wРестарт^n^n")
len += formatex(menu[len], charsmax(menu) - len, "\r4. \wПереместить^n")
len += formatex(menu[len], charsmax(menu) - len, "\r5. \wНачать игру^n^n")
new iPwd[32];get_cvar_string("sv_password", iPwd, charsmax(iPwd))
len += formatex(menu[len], charsmax(menu) - len, "\r6. \wПароль [\y%s\w]^n", iPwd[0] ? iPwd : "\rне установлен")
len += formatex(menu[len], charsmax(menu) - len, "\r7. \wСменить карту^n^n")
len += formatex(menu[len], charsmax(menu) - len, "^n\r0. \wВыход")
show_menu(id, KEYSMENU, menu, -1, "CW Menu")
return PLUGIN_HANDLED
}
public cw_menu(id, key)
{
switch(key)
{
case 0:
{
client_cmd(id, "amx_kickmenu")
}
case 1:
{
client_cmd(id, "amx_banmenu")
}
case 2:
{
server_cmd("sv_restart 1")
}
case 3:
{
client_cmd(id, "amx_teammenu")
}
case 4:
{
set_round(LIVE)
}
case 5:
{
new iPwd[32]
get_cvar_string("sv_password", iPwd, charsmax(iPwd))
if(iPwd[0])
{
set_cvar_string("sv_password", "")
show_cw_menu(id)
}
else
client_cmd(id, "messagemode type_password");
}
case 6:
{
client_cmd(id, "amx_mapmenu")
}
}
return PLUGIN_HANDLED
}
set_round(num)
{
new iRes
if(num == WARM)
{
iRes = 1
server_cmd("mp_freezetime 0")
server_cmd("mp_buytime 99")
}
else
{
iRes = 3
server_cmd("mp_freezetime 0")
server_cmd("mp_buytime 0.15")
}
g_CountA = 0
g_Count = 0
g_Round = num
//log_to_file("cw.log", "Pre: g_Round = %d", g_Round)
set_task(1.0, "restart", _, _, _, "a", iRes)
set_task(0.2, "show_msg", 44335, _, _, "a", 21)
}
public show_msg()
{
if(g_Round < 0)
{
remove_task(44335)
return
}
//log_to_file("cw.log", "Post: g_Round = %d", g_Round)
new iStart[12], iEnd[12]
if(g_CountA == 11)
g_Count = 1
for(new s = 0; s < g_Count; s++)
add(iStart, charsmax(iStart), "-")
for(new s = 0; s < 10 - g_Count; s++)
add(iEnd, charsmax(iEnd), "-")
if(g_CountA <= 10)
ChatColor(0, "^1[%s%s%s]", iStart, g_Msg[g_Round], iEnd)
else
ChatColor(0, "^1[%s%s%s]", iEnd, g_Msg[g_Round], iStart)
g_CountA++
g_Count++
}
public restart()
{
server_cmd("sv_restart 1")
}
stock ChatColor(const id, const input[], any:...) {
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
if (id) players[0] = id; else get_players(players, count, "ch"); {
for (new i = 0; i < count; i++) {
if (is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
Вложения
-
4.9 KB Просмотры: 1