diff --git a/configs/mixsystem/mode/zombie.cfg b/configs/mixsystem/mode/zombie.cfg index b33894c..ce625c2 100644 --- a/configs/mixsystem/mode/zombie.cfg +++ b/configs/mixsystem/mode/zombie.cfg @@ -4,7 +4,7 @@ mp_freezetime 5 mp_forcechasecam 0 mp_forcecamera 0 mp_timelimit 0 -mp_round_infinite 0 +mp_round_infinite b mp_auto_join_team 0 mp_roundrespawn_time -1 mp_buytime 0 diff --git a/data/lang/mixsystem.txt b/data/lang/mixsystem.txt index 550180d..4c1c6f1 100644 --- a/data/lang/mixsystem.txt +++ b/data/lang/mixsystem.txt @@ -40,9 +40,15 @@ PUB_ALREADY = Public mode is already running. PUB_CANC = Please disable other mode before public. DM_ACTIVATED = ^3%n^1 has activated ^3deatchmatch^1 mode. -DM_ALREADY = deatchmatch mode is already running. +DM_ALREADY = Deatchmatch mode is already running. DM_CANC = Please disable other mode before deathmatch. +ZM_ACTIVATED = ^3%n^1 has activated ^3zombie^1 mode. +ZM_ALREADY = Zombie mode is already running. +ZM_CANC = Please disable other mode before zombie. + +SET_ZOMBIE = ^3%n^1 zombie! + BLEND_TEAMS = ^3%n^1 blend teams. TRANSF_SPEC = ^3%n^1 transfered all players to ^3spectators^1! @@ -71,6 +77,7 @@ STOP_KNIFE = ^3%n^1 stopped ^3knife^1 round^1. STOP_PUB = ^3%n^1 stopped ^3public^1 mode^1. STOP_CAP = ^3%n^1 stopped ^3captain^1 mode^1. STOP_DM = ^3%n^1 stopped ^3deathmatch^1 mode^1. +STOP_ZM = ^3%n^1 stopped ^3zombie^1 mode^1. SCORE_TIME = TT [^3%s^1] %d vs %d [^3%s^1] CT (^3%d^1/^3%d^1 rounds) (^3%s^1 diff) SCORE_TIME_WT = TT [^3%s^1] vs [^3%s^1] CT (^3%s^1 diff) @@ -134,6 +141,7 @@ MENU_MAIN_MAP = Change map MENU_CUSTOM_PUB = Publick MENU_CUSTOM_DM = DeathMatch +MENU_CUSTOM_ZM = Zombie MENU_STNGS_ROUNDTIME_TRNG = Roundtime: \d[Training] MENU_STNGS_ROUNDTIME = Roundtime: \y%.1f @@ -215,6 +223,12 @@ DM_ACTIVATED = ^3%n^1 активировал ^3ДМ^1 режим. DM_ALREADY = ДМ режим уже запущен. DM_CANC = Пожалуйста, отключите другой режим чтобы запустить ДМ. +ZM_ACTIVATED = ^3%n^1 активировал ^3зомби^1 режим. +ZM_ALREADY = Зомби режим уже запущен. +ZM_CANC = Пожалуйста, отключите другой режим чтобы запустить Зомби. + +SET_ZOMBIE = ^3%n^1 зомби! + BLEND_TEAMS = ^3%n^1 смешал команды. TRANSF_SPEC = ^3%n^1 перевел всех игроков за ^3наблюдателей^1! @@ -243,6 +257,7 @@ STOP_KNIFE = ^3%n^1 остановил ^3ножевой раунд^1. STOP_PUB = ^3%n^1 остановил ^3паблик^1 режим. STOP_CAP = ^3%n^1 остановил режим ^3капитанов^1. STOP_DM = ^3%n^1 остановил ^3ДМ^1 режим. +STOP_ZM = ^3%n^1 остановил ^3зомби^1 режим^1. SCORE_TIME = TT [^3%s^1] %d vs %d [^3%s^1] CT (^3%d^1/^3%d^1 раундов) (^3%s^1 разрыв) SCORE_TIME_WT = TT [^3%s^1] vs [^3%s^1] CT (^3%s^1 разрыв) @@ -306,6 +321,7 @@ MENU_MAIN_MAP = Сменить карту MENU_CUSTOM_PUB = Паблик MENU_CUSTOM_DM = ДМ +MENU_CUSTOM_ZM = Зомби MENU_STNGS_ROUNDTIME_TRNG = Roundtime: \d[Training] MENU_STNGS_ROUNDTIME = Roundtime: \y%.1f diff --git a/scripting/HnsMatchSystem.sma b/scripting/HnsMatchSystem.sma index b4817d8..aa0a041 100644 --- a/scripting/HnsMatchSystem.sma +++ b/scripting/HnsMatchSystem.sma @@ -6,7 +6,7 @@ public plugin_precache() { } public plugin_init() { - g_PluginId = register_plugin("Hide'n'Seek Match System", "2.0.1", "OpenHNS"); // Спасибо: Cultura, Garey, Medusa, Ruffman, Conor, Juice + g_PluginId = register_plugin("Hide'n'Seek Match System", "2.0.2", "OpenHNS"); // Спасибо: Cultura, Garey, Medusa, Ruffman, Conor, Juice rh_get_mapname(g_szMapName, charsmax(g_szMapName)); diff --git a/scripting/HnsMatchTraining.sma b/scripting/HnsMatchTraining.sma index 92cb83b..747cf70 100644 --- a/scripting/HnsMatchTraining.sma +++ b/scripting/HnsMatchTraining.sma @@ -399,10 +399,9 @@ public fmAddToFullPack(es, e, iEnt, id, hostflags, player, pSet) { return FMRES_IGNORED; if (player) { - set_es(es, ES_Solid, SOLID_NOT); - if (is_user_alive(iEnt)) { if (g_bInvisPlayers[id]) { + set_es(es, ES_Solid, SOLID_NOT); set_es(es, ES_RenderMode, kRenderTransTexture); set_es(es, ES_RenderAmt, 0); set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 }); diff --git a/scripting/include/hns-match/addition/cmds.inc b/scripting/include/hns-match/addition/cmds.inc index cad09a0..7abdd11 100644 --- a/scripting/include/hns-match/addition/cmds.inc +++ b/scripting/include/hns-match/addition/cmds.inc @@ -21,7 +21,7 @@ stock cmds_init() { RegisterSayCmd("duel", "versus", "cmdDuelMode", access, "Choose 1x1 mode"); RegisterSayCmd("pub", "public", "cmdPubMode", access, "Public mode"); RegisterSayCmd("dm", "deathmatch", "cmdDMMode", access, "DeathMatch mode"); - //RegisterSayCmd("zm", "zombie", "cmdZMMode", access, "Zombie mode"); + RegisterSayCmd("zm", "zombie", "cmdZMMode", access, "Zombie mode"); RegisterSayCmd("bld", "blend", "cmdBlend", access, "Blend teams"); RegisterSayCmd("specall", "specall", "cmdTransferSpec", access, "Spec Transfer"); RegisterSayCmd("ttall", "ttall", "cmdTransferTT", access, "TT Transfer"); @@ -236,16 +236,16 @@ public cmdZMMode(id) { } if (g_iCurrentMode == MODE_ZM) { - chat_print(id, "Zombie mode is already running."); + chat_print(id, "%L", id, "ZM_ALREADY"); return PLUGIN_HANDLED; } if (g_iCurrentMode != MODE_TRAINING) { - chat_print(id, "Please disable other mode before zombie."); + chat_print(id, "%L", id, "ZM_CANC"); return PLUGIN_HANDLED; } - chat_print(0, "^3%n^1 has activated ^3zombie^1 mode.", id); + chat_print(0, "%l", "ZM_ACTIVATED", id); zm_start(); @@ -257,6 +257,12 @@ public cmdBlend(id) { return PLUGIN_HANDLED; } + if (g_iCurrentMode == MODE_ZM) { + chat_print(0, "%l", "BLEND_TEAMS", id); + blendZM(); + return PLUGIN_HANDLED; + } + if (g_iCurrentMode != MODE_PUB && g_iCurrentMode != MODE_DM) return PLUGIN_HANDLED; @@ -286,6 +292,11 @@ public cmdBlend(id) { return PLUGIN_HANDLED; } +public blendZM() { + zm_set_teams(); + restartRound(2.0); +} + public cmdTransferSpec(id) { if (!getUserInAccess(id)) { return PLUGIN_HANDLED; @@ -378,7 +389,7 @@ public cmdKnifeRound(id) { return PLUGIN_HANDLED; } - chat_print(id, "%L", id, "START_KNIFE_1"); + chat_print(id, "%L", id, "START_KNIFE_1", id); g_iMatchStatus = MATCH_TEAMKNIFE; kniferound_start(); @@ -463,7 +474,7 @@ public cmdStop(id) { } case MODE_ZM: { training_start(); - chat_print(0, "Player %n stopped zombie mode", id); + chat_print(0, "%l", "STOP_ZM", id); } } diff --git a/scripting/include/hns-match/addition/hnsmenu.inc b/scripting/include/hns-match/addition/hnsmenu.inc index 2079106..fdfa5c6 100644 --- a/scripting/include/hns-match/addition/hnsmenu.inc +++ b/scripting/include/hns-match/addition/hnsmenu.inc @@ -165,8 +165,8 @@ public customMenu(id) { formatex(szMsg, charsmax(szMsg), "%L", id, "MENU_CUSTOM_DM"); menu_additem(hMenu, szMsg, "2"); - // formatex(szMsg, charsmax(szMsg), "Zombie"); - // menu_additem(hMenu, szMsg, "3"); + formatex(szMsg, charsmax(szMsg), "%L", id, "MENU_CUSTOM_ZM"); + menu_additem(hMenu, szMsg, "3"); menu_display(id, hMenu, 0); return PLUGIN_HANDLED; @@ -190,9 +190,9 @@ public customMenuHandler(id, hMenu, item) { case 2: { cmdDMMode(id); } - // case 3: { - // cmdZMMode(id); - // } + case 3: { + cmdZMMode(id); + } } return PLUGIN_HANDLED; } diff --git a/scripting/include/hns-match/modes/mode_knife.inl b/scripting/include/hns-match/modes/mode_knife.inl index d5a7062..8d5beb3 100755 --- a/scripting/include/hns-match/modes/mode_knife.inl +++ b/scripting/include/hns-match/modes/mode_knife.inl @@ -60,7 +60,6 @@ public kniferound_roundend(bool:win_ct) { training_start(); g_iMatchStatus = MATCH_MAPPICK; StartVoteRules(); - //client_print_color(0, print_team_blue, "%L", 0, "KNIFE_WIN", hns_tag, win_ct ? "CT" : "TT", win_ct ? "CT" : "TT"); } } ChangeGameplay(GAMEPLAY_TRAINING); diff --git a/scripting/include/hns-match/modes/mode_zombie.inl b/scripting/include/hns-match/modes/mode_zombie.inl index 6a8fd9b..290655d 100644 --- a/scripting/include/hns-match/modes/mode_zombie.inl +++ b/scripting/include/hns-match/modes/mode_zombie.inl @@ -1,8 +1,11 @@ +new iLastZombie + public zm_init() { g_ModFuncs[MODE_ZM][MODEFUNC_START] = CreateOneForward(g_PluginId, "zm_start"); g_ModFuncs[MODE_ZM][MODEFUNC_KILL] = CreateOneForward(g_PluginId, "zm_killed", FP_CELL, FP_CELL); g_ModFuncs[MODE_ZM][MODEFUNC_ROUNDEND] = CreateOneForward(g_PluginId, "zm_roundend", FP_CELL); g_ModFuncs[MODE_ZM][MODEFUNC_PLAYER_JOIN] = CreateOneForward(g_PluginId, "zm_player_join", FP_CELL); + g_ModFuncs[MODE_ZM][MODEFUNC_PLAYER_LEAVE] = CreateOneForward(g_PluginId, "zm_player_leave", FP_CELL); } public zm_start() { @@ -17,7 +20,7 @@ public zm_start() { zm_set_teams(); - restartRound(0.5); + restartRound(2.0); } public zm_killed(victim, killer) { @@ -38,7 +41,7 @@ public zm_roundend(bool:win_ct) { public zm_set_teams() { new iPlayers[MAX_PLAYERS], iNum - get_players(iPlayers, iNum, "ch"); + get_players(iPlayers, iNum, "h"); for (new i; i < iNum; i++) { new iPlayer = iPlayers[i]; @@ -51,24 +54,72 @@ public zm_set_teams() { set_task(1.0, "set_zombie", 11223); } -public set_zombie() { - new iZombie = GetRandomTT(); - rg_set_user_team(iZombie, TEAM_CT); - chat_print(0, "^3%n^1 zombie!", iZombie); - hns_setrole(iZombie); -} +GetRandomAlive() { + static iPlayers[MAX_PLAYERS], iTTNum + get_players(iPlayers, iTTNum, "he", "TERRORIST"); + + new iAlivePlayers[MAX_PLAYERS], iAliveNum; + + for (new i; i < iTTNum; i++) { + if (!is_user_connected(iPlayers[i])) { + continue; + } + + if (is_user_connected(iLastZombie)) { + if (iPlayers[i] == iLastZombie) { + continue; + } + } + + iAlivePlayers[iAliveNum] = iPlayers[i]; + iAliveNum++; + } + + if (!iAliveNum) { + for (new i = 0; i < MAX_PLAYERS; i++) { + iAlivePlayers[i] = iPlayers[i]; + } + iAliveNum = iTTNum; + } -GetRandomTT() { - static iPlayers[32], iCTNum - get_players(iPlayers, iCTNum, "che", "TERRORIST"); + new iChoose; - if (!iCTNum) + if (iAliveNum > 1) { + iChoose = iAlivePlayers[random(iAliveNum)]; + } else { + iChoose = iAlivePlayers[iAliveNum - 1]; + } + + if (!iAliveNum) return 0 - return iCTNum > 1 ? iPlayers[random(iCTNum)] : iPlayers[iCTNum - 1]; + return iChoose; } public zm_player_join(id) { rg_set_user_team(id, TEAM_CT); rg_round_respawn(id); -} \ No newline at end of file +} + +public zm_player_leave(id) { + set_task(2.0, "checkZombie", 12341); + + //set_task(2.0, "checkAlive", 12341); +} + +public checkZombie() { + new iPlayers[MAX_PLAYERS], iNum; + get_players(iPlayers, iNum, "he", "CT"); + + if (!iNum) { + set_zombie(); + } +} + +public set_zombie() { + new iZombie = GetRandomAlive(); + rg_set_user_team(iZombie, TEAM_CT); + chat_print(0, "%l", "SET_ZOMBIE", iZombie); + iLastZombie = iZombie; + hns_setrole(iZombie); +}