From 5f3a5c1aa3607bd1dc53dafeff579701b74c01e0 Mon Sep 17 00:00:00 2001 From: WessTorn Date: Sat, 3 Feb 2024 02:50:26 +0300 Subject: [PATCH] v2.0.1 --- data/lang/match_additons.txt | 19 ++ data/lang/mixsystem.txt | 2 + scripting/HnsMatchSystem.sma | 2 +- scripting/HnsMatchTraining.sma | 178 +++++++++++++++++- scripting/include/hns-match/addition/cmds.inc | 10 + .../hns-match/gameplay/gameplay_hns.inc | 2 +- scripting/include/hns-match/globals.inc | 4 + .../include/hns-match/modes/mode_manager.inl | 3 - .../include/hns-match/modes/mode_mix.inl | 50 ++--- scripting/include/hns-match/user.inc | 2 +- 10 files changed, 240 insertions(+), 32 deletions(-) diff --git a/data/lang/match_additons.txt b/data/lang/match_additons.txt index 833e8a8..840e3cf 100644 --- a/data/lang/match_additons.txt +++ b/data/lang/match_additons.txt @@ -38,6 +38,11 @@ MENU_TRNING_TLPRT = Teleport MENU_TRNING_NOCLIP = No Clip MENU_TRNING_RESPAWN = Respawn MENU_TRNING_DAMAGE = Damage +MENU_TRNING_ANGL_ON = Save angles \yOn +MENU_TRNING_ANGL_OFF = Save angles \dOff +MENU_TRNING_INVIS_ON = Invis players \yOn +MENU_TRNING_INVIS_OFF = Invis players \dOff +MENU_TRNING_WEAPONS = Get weapons TRNING_NOT_ALIVE = %s You must be alive to use this command! TRNING_CPNT_SAVE = %s Checkpoint saved! @@ -45,8 +50,12 @@ TRNING_TLPRT_NOT = %s You haven't got any checkpoints! TRNING_STUCK_NOT = %s You must have another checkpoint to use stuck! TRNING_SHOW_ON = %s Damage show ^3enabled^1! TRNING_SHOW_OFF = %s Damage show ^3disabled^1! +TRNING_ANGLES_ON = %s Save angles ^3enabled^1! +TRNING_ANGLES_OFF = %s Save angles ^3disabled^1! TRNING_CLIP_ON = %s No Clip ^3enabled^1! TRNING_CLIP_OFF = %s No Clip ^3disabled^1! +TRNING_INVIS_ON = %s Invis players ^3enabled^1! +TRNING_INVIS_OFF = %s Invis players ^3disabled^1! TRNING_DMG = %s You have taken ^3%i^1 damage. HNS_OWNAGE_MIX = %n owned %n's head! [#%d] @@ -107,6 +116,12 @@ MENU_TRNING_TLPRT = Телепорт MENU_TRNING_NOCLIP = Ноклип MENU_TRNING_RESPAWN = Возродиться MENU_TRNING_DAMAGE = Показать дамаг +MENU_TRNING_ANGL_ON = Сохранять прицел \yOn +MENU_TRNING_ANGL_OFF = Сохранять прицел \dOff +MENU_TRNING_INVIS_ON = Невидимные игроки \yOn +MENU_TRNING_INVIS_OFF = Невидимные игроки \dOff +MENU_TRNING_WEAPONS = Получить оружие + TRNING_NOT_ALIVE = %s Вы должны быть живы, чтобы использовать эту команду! TRNING_CPNT_SAVE = %s Чекпоинт сохранена! @@ -114,8 +129,12 @@ TRNING_TLPRT_NOT = %s У вас нет чекпоинтов! TRNING_STUCK_NOT = %s У вас должен быть другой чекпоинт, чтобы использовать stuck! TRNING_SHOW_ON = %s Показать урон: ^3влючено^1! TRNING_SHOW_OFF = %s Показать урон: ^3выключено^1! +TRNING_ANGLES_ON = %s Сохранять прицел ^3влючено^1! +TRNING_ANGLES_OFF = %s Сохранять прицел ^3выключено^1! TRNING_CLIP_ON = %s Ноклип ^3включен^1! TRNING_CLIP_OFF = %s Ноклип ^3выключен^1! +TRNING_INVIS_ON = %s Невидимные игроки ^3влючено^1! +TRNING_INVIS_OFF = %s Невидимные игроки ^3выключено^1! TRNING_DMG = %s Вы получили ^3%i^1 урона. HNS_OWNAGE_MIX = %n запрыгнул на голову %n! [#%d] diff --git a/data/lang/mixsystem.txt b/data/lang/mixsystem.txt index a1afb1b..550180d 100644 --- a/data/lang/mixsystem.txt +++ b/data/lang/mixsystem.txt @@ -64,6 +64,7 @@ NOT_CAPTAIN = Only available on the knife map. START_MIX = ^3%n^1 has started ^3mix^1. START_KNIFE = Started ^3knife^1 round! +START_KNIFE_1 = ^3%n^1 has started ^3knife^1 round! STOP_MIX = ^3%n^1 stopped ^3mix^1. STOP_KNIFE = ^3%n^1 stopped ^3knife^1 round^1. @@ -235,6 +236,7 @@ NOT_CAPTAIN = Доступно только на ножевой карте. START_MIX = ^3%n^1 запустил ^3микс^1! START_KNIFE = Запущен ^3ножевой^1 раунд! +START_KNIFE_1 = ^3%n^1 запустил ^3ножевой^1 раунд! STOP_MIX = ^3%n^1 остановил ^3микс^1. STOP_KNIFE = ^3%n^1 остановил ^3ножевой раунд^1. diff --git a/scripting/HnsMatchSystem.sma b/scripting/HnsMatchSystem.sma index 18ddf0e..b4817d8 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.0", "OpenHNS"); // Спасибо: Cultura, Garey, Medusa, Ruffman, Conor, Juice + g_PluginId = register_plugin("Hide'n'Seek Match System", "2.0.1", "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 5c70918..92cb83b 100644 --- a/scripting/HnsMatchTraining.sma +++ b/scripting/HnsMatchTraining.sma @@ -1,5 +1,6 @@ #include #include +#include #include new g_szPrefix[24]; @@ -11,6 +12,8 @@ new Float:g_fCheckpointAngles[MAX_PLAYERS + 1][3]; new Float:g_fCheckpoints[MAX_PLAYERS + 1][2][3]; new bool:g_fCheckpointAlternate[MAX_PLAYERS + 1]; +new bool:g_bInvisPlayers[MAX_PLAYERS + 1]; + new g_hResetBugForward; public plugin_init() { @@ -24,9 +27,20 @@ public plugin_init() { RegisterSayCmd("stuck", "st", "CmdStuck"); RegisterSayCmd("respawn", "rp", "CmdRespawn"); RegisterSayCmd("noclip", "clip", "CmdClipMode"); - RegisterSayCmd("showdamage", "showdmg", "CmdShowDamage"); + RegisterSayCmd("showdamage", "showdmg", "CmdShowDamage"); + RegisterSayCmd("angles", "ang", "CmdSaveAngles"); + RegisterSayCmd("invis", "inv", "cmdInvis"); + + RegisterSayCmd("weapons", "weap", "cmdWeapons"); + RegisterSayCmd("scout", "sc", "cmdScout"); + RegisterSayCmd("usp", "pistol", "cmdUsp"); + RegisterSayCmd("awp", "sniper", "cmdAWP"); + RegisterSayCmd("m4a1", "m4", "cmdM4A1"); RegisterHookChain(RG_CSGameRules_FlPlayerFallDamage, "rgFlPlayerFallDamage", true); + RegisterHookChain(RG_CBasePlayer_Spawn, "rgPlayerSpawn", false); + + register_forward(FM_AddToFullPack, "fmAddToFullPack", 1); g_hResetBugForward = CreateMultiForward("fwResetBug", ET_IGNORE, FP_CELL); @@ -35,6 +49,8 @@ public plugin_init() { public client_putinserver(id) { g_bDamage[id] = true; + g_bSaveAngles[id] = true; + g_bInvisPlayers[id] = false; } public plugin_cfg() { @@ -173,6 +189,92 @@ public CmdShowDamage(id) { return PLUGIN_HANDLED; } +public CmdSaveAngles(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + g_bSaveAngles[id] = !g_bSaveAngles[id]; + + if (g_bSaveAngles[id]) { + client_print_color(id, print_team_blue, "%L", id, "TRNING_ANGLES_ON", g_szPrefix); + } else { + client_print_color(id, print_team_blue, "%L", id, "TRNING_ANGLES_OFF", g_szPrefix); + } + + return PLUGIN_HANDLED; +} + +public cmdInvis(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + g_bInvisPlayers[id] = !g_bInvisPlayers[id]; + + if (g_bInvisPlayers[id]) { + client_print_color(id, print_team_blue, "%L", id, "TRNING_INVIS_ON", g_szPrefix); + } else { + client_print_color(id, print_team_blue, "%L", id, "TRNING_INVIS_OFF", g_szPrefix); + } + + return PLUGIN_HANDLED; +} + +public cmdWeapons(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + give_user_item(id, "weapon_awp", 10); + give_user_item(id, "weapon_m249", 10); + give_user_item(id, "weapon_m4a1", 10); + give_user_item(id, "weapon_sg552", 10); + give_user_item(id, "weapon_famas", 10); + give_user_item(id, "weapon_p90", 10); + give_user_item(id, "weapon_usp", 10, GT_REPLACE); + give_user_item(id, "weapon_scout", 10); + + return PLUGIN_HANDLED; +} + +public cmdScout(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + give_user_item(id, "weapon_scout", 10, GT_REPLACE); + return PLUGIN_HANDLED; +} + +public cmdUsp(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + give_user_item(id, "weapon_usp", 10, GT_REPLACE); + return PLUGIN_HANDLED; +} + +public cmdAWP(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + give_user_item(id, "weapon_awp", 2, GT_REPLACE); + return PLUGIN_HANDLED; +} + +public cmdM4A1(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return PLUGIN_HANDLED + } + + give_user_item(id, "weapon_m4a1", 10, GT_REPLACE); + return PLUGIN_HANDLED; +} + + public hns_training_menu(id) { if ((hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) || !is_user_connected(id)) return PLUGIN_HANDLED; @@ -197,6 +299,26 @@ public hns_training_menu(id) { formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "MENU_TRNING_DAMAGE"); menu_additem(hMenu, szMsg, "5"); + if (g_bSaveAngles[id]) { + formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "MENU_TRNING_ANGL_ON"); + } else { + formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "MENU_TRNING_ANGL_OFF"); + } + + menu_additem(hMenu, szMsg, "6"); + + if (g_bInvisPlayers[id]) { + formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "MENU_TRNING_INVIS_ON"); + } else { + formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "MENU_TRNING_INVIS_OFF"); + } + + menu_additem(hMenu, szMsg, "7"); + + formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "MENU_TRNING_WEAPONS"); + menu_additem(hMenu, szMsg, "8"); + + menu_display(id, hMenu, 0); return PLUGIN_HANDLED; @@ -227,6 +349,15 @@ public hns_training_menu_code(id, hMenu, item) { case 5: { CmdShowDamage(id); } + case 6: { + CmdSaveAngles(id); + } + case 7: { + cmdInvis(id); + } + case 8: { + cmdWeapons(id); + } } menu_destroy(hMenu); @@ -235,6 +366,16 @@ public hns_training_menu_code(id, hMenu, item) { return PLUGIN_HANDLED; } +public rgPlayerSpawn(id) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return HC_CONTINUE; + } + + set_task(0.2, "cmdUsp", id); + + return HC_CONTINUE; +} + public rgFlPlayerFallDamage(id) { if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { return HC_CONTINUE @@ -249,6 +390,41 @@ public rgFlPlayerFallDamage(id) { return HC_CONTINUE; } +public fmAddToFullPack(es, e, iEnt, id, hostflags, player, pSet) { + if (hns_get_mode() != MODE_TRAINING && hns_get_state() != STATE_PAUSED) { + return FMRES_IGNORED; + } + + if (id == iEnt) + 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_RenderMode, kRenderTransTexture); + set_es(es, ES_RenderAmt, 0); + set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 }); + } + } + } + + return FMRES_IGNORED; +} + + public plugin_end() { DestroyForward(g_hResetBugForward); +} + +stock give_user_item(id, const szWeapon[], numBullets, GiveType:giveType = GT_APPEND) { + if (!is_user_alive(id)) return; + + new iWeapon = rg_give_item(id, szWeapon, giveType); + + if (!is_nullent(iWeapon) && iWeapon != -1) { + rg_set_iteminfo(iWeapon, ItemInfo_iMaxClip, numBullets); + rg_set_user_ammo(id, rg_get_weapon_info(szWeapon, WI_ID), numBullets); + } } \ No newline at end of file diff --git a/scripting/include/hns-match/addition/cmds.inc b/scripting/include/hns-match/addition/cmds.inc index 1c53354..cad09a0 100644 --- a/scripting/include/hns-match/addition/cmds.inc +++ b/scripting/include/hns-match/addition/cmds.inc @@ -348,6 +348,14 @@ public cmdStartMatch(id) { return PLUGIN_HANDLED; } + if (task_exists(TASK_STARTED)) { + remove_task(TASK_STARTED); + } + + if (task_exists(TASK_WAIT)) { + remove_task(TASK_WAIT); + } + chat_print(0, "%l", "START_MIX", id); mix_start(); @@ -370,6 +378,8 @@ public cmdKnifeRound(id) { return PLUGIN_HANDLED; } + chat_print(id, "%L", id, "START_KNIFE_1"); + g_iMatchStatus = MATCH_TEAMKNIFE; kniferound_start(); diff --git a/scripting/include/hns-match/gameplay/gameplay_hns.inc b/scripting/include/hns-match/gameplay/gameplay_hns.inc index 1ff0678..5bcc65c 100644 --- a/scripting/include/hns-match/gameplay/gameplay_hns.inc +++ b/scripting/include/hns-match/gameplay/gameplay_hns.inc @@ -153,7 +153,7 @@ public NadesHandler(id, hMenu, item) } } - if (g_iSettings[FLASH] >= 1) + if (g_iSettings[SMOKE] >= 1) { if (user_has_weapon(id, CSW_SMOKEGRENADE)) { diff --git a/scripting/include/hns-match/globals.inc b/scripting/include/hns-match/globals.inc index dbb7b74..417d27d 100644 --- a/scripting/include/hns-match/globals.inc +++ b/scripting/include/hns-match/globals.inc @@ -9,6 +9,10 @@ #define TASK_TIMER 54345 #define HUD_PAUSE 23931 +#define TASK_WAIT 12319 +#define TASK_STARTED 13339 + + new g_PluginId; enum NATCH_RULES { diff --git a/scripting/include/hns-match/modes/mode_manager.inl b/scripting/include/hns-match/modes/mode_manager.inl index 7952d9e..8548658 100755 --- a/scripting/include/hns-match/modes/mode_manager.inl +++ b/scripting/include/hns-match/modes/mode_manager.inl @@ -1,6 +1,3 @@ -const TASK_WAIT = 12319; -const TASK_STARTED = 13339; - new Float:flWaitPlayersTime; public mode_init() { diff --git a/scripting/include/hns-match/modes/mode_mix.inl b/scripting/include/hns-match/modes/mode_mix.inl index a03c883..2035b6b 100755 --- a/scripting/include/hns-match/modes/mode_mix.inl +++ b/scripting/include/hns-match/modes/mode_mix.inl @@ -28,7 +28,7 @@ public mix_start() { loadMapCFG(); new iPlayers[MAX_PLAYERS], iNum; - get_players(iPlayers, iNum, "ce", "TERRORIST"); + get_players(iPlayers, iNum, "e", "TERRORIST"); g_eMatchInfo[e_mTeamSizeTT] = iNum; g_eMatchInfo[e_mTeamSize] = get_num_players_in_match(); @@ -51,33 +51,10 @@ public mix_start() { public mix_freezeend() { if (g_eMatchState == STATE_ENABLED) { set_task(5.0, "taskCheckAfk"); - set_task(5.0, "taskCheckLeave"); set_task(0.25, "taskRoundEvent", .id = TASK_TIMER, .flags = "b"); } } -public taskCheckLeave() { - if (g_iCurrentMode != MODE_MIX) { - return; - } - - new iNum = get_num_players_in_match(); - - server_print("get_num_players_in_match %d", iNum); - server_print("g_eMatchInfo %d", g_eMatchInfo[e_mTeamSize]); - - if (iNum < g_eMatchInfo[e_mTeamSize]) { - // Pause Need Players - mix_pause(); - chat_print(0, "%L", LANG_PLAYER, "NEED_PAUSE", g_eMatchInfo[e_mTeamSize] - iNum) - } else { - iNum = iNum - g_eMatchInfo[e_mTeamSize]; - if (iNum >= 2) { - g_eMatchInfo[e_mTeamSize] = get_num_players_in_match(); - } - } -} - public mix_restartround() { if (g_eMatchState == STATE_ENABLED) { mix_reverttimer(); @@ -182,8 +159,30 @@ public mix_roundstart() { ResetAfkData(); set_task(0.3, "taskSaveAfk"); + set_task(5.0, "taskCheckLeave"); } +public taskCheckLeave() { + if (g_iCurrentMode != MODE_MIX) { + return; + } + + new iNum = get_num_players_in_match(); + + server_print("get_num_players_in_match %d", iNum); + server_print("g_eMatchInfo %d", g_eMatchInfo[e_mTeamSize]); + + if (iNum < g_eMatchInfo[e_mTeamSize]) { + // Pause Need Players + mix_pause(); + chat_print(0, "%L", LANG_PLAYER, "NEED_PAUSE", g_eMatchInfo[e_mTeamSize] - iNum) + } else { + iNum = iNum - g_eMatchInfo[e_mTeamSize]; + if (iNum >= 2) { + g_eMatchInfo[e_mTeamSize] = get_num_players_in_match(); + } + } +} public MixFinishedMR(iWinTeam) { ExecuteForward(g_hForwards[MATCH_FINISH], _, iWinTeam); @@ -255,11 +254,12 @@ public mix_roundend(bool:win_ct) { g_eMatchInfo[e_iRoundsPlayed][g_isTeamTT]++; new iPlayers[MAX_PLAYERS], iNum; - get_players(iPlayers, iNum, "ache", "CT"); + get_players(iPlayers, iNum, "ahe", "CT"); if (!iNum) { new Float:roundtime = get_round_time() * 60.0; g_eMatchInfo[e_flSidesTime][g_isTeamTT] += roundtime - g_flRoundTime; + client_print_color(0, 0, "Тут") } if (g_eMatchInfo[e_iRoundsPlayed][g_isTeamTT] + g_eMatchInfo[e_iRoundsPlayed][HNS_TEAM:!g_isTeamTT] >= g_iSettings[MAXROUNDS] * 2) { diff --git a/scripting/include/hns-match/user.inc b/scripting/include/hns-match/user.inc index adeb608..85a4ec4 100644 --- a/scripting/include/hns-match/user.inc +++ b/scripting/include/hns-match/user.inc @@ -111,7 +111,7 @@ setTeam(id, TeamName:iTeam) { stock get_num_players_in_match() { new iPlayers[MAX_PLAYERS], iNum; - get_players(iPlayers, iNum, "ch"); + get_players(iPlayers, iNum, "h"); new numGameplr; for (new i; i < iNum; i++) { new tempid = iPlayers[i];