Skip to content

Commit

Permalink
add more plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
WessTorn committed Jun 27, 2023
1 parent 5220f70 commit e3a624b
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 3 deletions.
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
# hns_mode
## [README in English](https://github.com/OpenHNS/hns_mode/blob/main/README_ENG.md)

# hns_mode

Hide'N'Seek мод для Counter-Strike 1.6 и доп. плагины к моду.

## Требование

- [ReHLDS](https://dev-cs.ru/resources/64/)
- [Amxmodx 1.9.0](https://dev-cs.ru/resources/405/)
- [Reapi (last)](https://dev-cs.ru/resources/73/updates)
- [ReGameDLL (last)](https://dev-cs.ru/resources/67/updates)
- [ReSemiclip (last)](https://dev-cs.ru/resources/71/updates)

## Характеристики

- Public / DeathMatch мод.
- Автоматический свап команд в случае неоднократной победы команды ТТ.
- Гибкая настройка кварами и lang файл.
- Кастомная пикалка (+USE) у команды ТТ и свист раз в 15 секунд.
- Возможность добовлять и связывать дополнительные плагины для основного плагина.

## Описание

Hide'N'Seek - По большей части догонялки. Команда КТ догоняет команду ТТ. Команде ТТ дается 5 секунд (mp_freezetime) чтобы разбежаться. У команды ТТ есть гранаты, у команды КТ только нож. Но не все так просто, мод интересен тем, что из-за особенностей движка игроки с помощью "багов" могут передвигаться быстрее.

## Консольные команды (квары)

| Cvar | Default | Description |
| :-: | :-: | :-: |
| hns_deathmatchт| 0 | Дезматч мод `1` Включить / `0` Отключить |
| hns_respawn | 3 | Кол-во секунд возрождения игроков в режиме ДМ |
| hns_he | 0 | Кол-во HE гранат у команды ТТ |
| hns_flash | 2 | Кол-во Flash гранат у команды ТТ |
| hns_smoke | 1 | Кол-во Smoke гранат у команды ТТ |
| hns_swap_team | 2 | Кол-во выйграных раундов подряд команды ТТ после которого поменять команды местами |
| hns_swist | 1 | Свист (+USE) у команды ТТ `1` Включить / `0` Отключить |
| hns_prefix | HNS | Префикс сообений в чате |

## Плагины

- hns_main.sma - Основной плагин мода

## Установка

1. Скомпилируйте плагин.

2. Скопируйте скомпилированный файл `.amxx` в директорию: `amxmodx/plugins/`.
3. Скопируйте содержимое папки и саму папку `cstrike/sound/openhns` в директорию: `cstrike/sound/` на вашем сервере.

4. Скопируйте содержимое папки `data/lang/` в директорию: `amxmodx/data/lang/` на вашем сервере.

5. Пропишите `.amxx` в файле `amxmodx/configs/plugins.ini`

6. Перезапустите сервер или поменяйте карту.
53 changes: 53 additions & 0 deletions README_ENG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# hns_mode

Hide'N'Seek mod for Counter-Strike 1.6 and additional plugins.

## Requirement

- [ReHLDS](https://dev-cs.ru/resources/64/)
- [Amxmodx 1.9.0](https://dev-cs.ru/resources/405/)
- [Reapi (last)](https://dev-cs.ru/resources/73/updates)
- [ReGameDLL (last)](https://dev-cs.ru/resources/67/updates)
- [ReSemiclip (last)](https://dev-cs.ru/resources/71/updates)

## Features

- Public / DeathMatch mod.
- Automatic team swap in case of repeated TT team wins.
- Flexible customization with quars and lang file.
- Custom kicker (+USE) for TT team and whistle once in 15 seconds.
- Ability to add and link additional plugins to the main plugin.

## Description

Hide'N'Seek - For the most part a catch-up game. The CT team catches up with the TT team. The TT team is given 5 seconds (mp_freezetime) to scatter. Team TT has grenades, the CT team has only the knife. But it's not all that simple, the mod is interesting because of the peculiarities of the engine players with the "bugs" can move faster.

## Console commands (quars)

| Cvar | Default | Description |
| :-: | :-: | :-: |
| hns_deathmatch| 0 | deathmatch mod `1` Enable / `0` Disable |
| hns_respawn | 3 | Number of seconds to revive players in DM mode |
| | hns_he | 0 | HE number of grenades on TT team |
| hns_flash | 2 | Qty of Flash grenades on TT team |
| hns_smoke | 1 | Qty of Smoke grenades on the TT |
| hns_swap_team | 2 | Number of consecutive rounds won by the TT team after which to swap teams |
| hns_swist | 1 | whistle (+USE) on TT team `1` Enable / `0` Disable |
| hns_prefix | HNS | chat message prefix

## Plugins

- hns_main.sma - Main plugin of the mod

## installation

1. Compile the plugin.

2. Copy the compiled file `.amxx` to directory: `amxmodx/plugins/`.
3. Copy the contents of the folder and the folder itself `cstrike/sound/openhns` in the directory: `cstrike/sound/` on your server.

4. Copy the contents of the folder `data/lang/` to the directory: `amxmodx/data/lang/` on your server.

5. Write `.amxx` in file `amxmodx/configs/plugins.ini`.

6. Restart the server or change the map.
File renamed without changes.
85 changes: 85 additions & 0 deletions hns_hideknife.sma
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#include <amxmodx>
#include <hamsandwich>
#include <reapi>

new bool: g_playerHideKnife[MAX_PLAYERS + 1][TeamName];

public plugin_init() {
register_plugin("HNS: Hideknife", "1.0.0", "OpenHNS"); // ufame (https://github.com/ufame/brohns/blob/master/server/src/scripts/hns/hns_hideknife.sma)

register_clcmd("say /hideknife", "commandHideKnife");
register_clcmd("say_team /hideknife", "commandHideKnife");
register_clcmd("say /knife", "commandHideKnife");
register_clcmd("say_team /knife", "commandHideKnife");

RegisterHam(Ham_Item_Deploy, "weapon_knife", "knifeDeploy", 1);
}

public commandHideKnife(id) {
new menu = menu_create("Hide knife", "hideknifeHandler");

menu_additem(
menu,
fmt(
"Hide for \yTE \r%s",
g_playerHideKnife[id][TEAM_TERRORIST] ? "YES" : "NO"
)
);

menu_additem(
menu,
fmt(
"Hide for \yCT \r%s",
g_playerHideKnife[id][TEAM_CT] ? "YES" : "NO"
)
);

menu_display(id, menu);

return PLUGIN_HANDLED;
}

public hideknifeHandler(const id, const menu, const item) {
if (item == MENU_EXIT) {
menu_destroy(menu);

return PLUGIN_HANDLED;
}

menu_destroy(menu);

new bool: hideKnife;
new TeamName: hideTeam;

switch (item) {
case 0: {
hideTeam = TEAM_TERRORIST;

hideKnife = g_playerHideKnife[id][hideTeam] = !g_playerHideKnife[id][hideTeam];
}
case 1: {
hideTeam = TEAM_CT;

hideKnife = g_playerHideKnife[id][hideTeam] = !g_playerHideKnife[id][hideTeam];
}
}

if (is_user_alive(id) && hideTeam == get_member(id, m_iTeam)) {
new activeItem = get_member(id, m_pActiveItem);

if (is_nullent(activeItem) || get_member(activeItem, m_iId) != WEAPON_KNIFE)
return PLUGIN_HANDLED;

set_entvar(id, var_viewmodel, hideKnife ? "" : "models/v_knife.mdl");
}

return PLUGIN_HANDLED;
}

public knifeDeploy(const entity) {
new player = get_member(entity, m_pPlayer);
new TeamName: team = get_member(player, m_iTeam);

if (g_playerHideKnife[player][team])
set_entvar(player, var_viewmodel, "");
}
69 changes: 69 additions & 0 deletions hns_lash_grenade.sma
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#include <amxmodx>
#include <reapi>

#define rg_get_user_team(%0) get_member(%0, m_iTeam)

new bool:g_bLastFlash;

public plugin_init() {
register_plugin("HNS Last grenade", "1.0.0", "OpenHNS");

RegisterHookChain(RG_CSGameRules_RestartRound, "rgRoundStart", true);
RegisterHookChain(RG_CBasePlayer_Killed, "rgPlayerKilled", true);
}

public rgRoundStart() {
g_bLastFlash = false;
}

public rgPlayerKilled(victim, attacker) {
if (rg_get_user_team(victim) != TEAM_TERRORIST || g_bLastFlash)
return HC_CONTINUE;

new iPlayers[MAX_PLAYERS], iNum;
get_players(iPlayers, iNum, "aech", "TERRORIST");
if (iNum == 1) {
g_bLastFlash = true;
NewNadesMenu(iPlayers[0]);
}

return HC_CONTINUE;
}

public NewNadesMenu(id) {
new hMenu = menu_create("\rНужны гранаты?", "NadesHandler");

menu_additem(hMenu, "Да.");
menu_additem(hMenu, "Нет.");

menu_setprop(hMenu, MPROP_PERPAGE, 0);
menu_display(id, hMenu, 0);
return PLUGIN_HANDLED;
}

public NadesHandler(id, hMenu, item) {
if (item == MENU_EXIT || !g_bLastFlash) {
menu_destroy(hMenu);
return PLUGIN_HANDLED;
}

if (!item) {
if (user_has_weapon(id, CSW_FLASHBANG)) {
rg_set_user_bpammo(id, WEAPON_SMOKEGRENADE, rg_get_user_bpammo(id, WEAPON_SMOKEGRENADE) + 1);
} else {
rg_give_item(id, "weapon_flashbang");
}

if (user_has_weapon(id, CSW_SMOKEGRENADE))
{
rg_set_user_bpammo(id, WEAPON_HEGRENADE, rg_get_user_bpammo(id, WEAPON_HEGRENADE) + 1);
} else {
rg_give_item(id, "weapon_smokegrenade");
}
}

g_bLastFlash = false;

menu_destroy(hMenu);
return PLUGIN_HANDLED;
}
12 changes: 11 additions & 1 deletion hns_main.sma
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ new const g_szDefaultEntities[][] = {
"monster_scentist"
}

enum _: Forwards_s {
hns_team_swap
};

new g_hForwards[Forwards_s];

public plugin_init() {
register_plugin("HNS Mode Main", "1.0.0", "OpenHNS");
register_plugin("HNS Mode Main", "1.0.1", "OpenHNS");

register_clcmd("chooseteam", "BlockCmd");
register_clcmd("jointeam", "BlockCmd");
Expand Down Expand Up @@ -77,6 +83,8 @@ public plugin_init() {
set_msg_block(get_user_msgid("Money"), BLOCK_SET)

set_task(0.5, "delayed_mode");

g_hForwards[hns_team_swap] = CreateMultiForward("hns_team_swap", ET_CONTINUE);
}

public plugin_precache() {
Expand Down Expand Up @@ -247,6 +255,7 @@ public rgRoundEnd(WinStatus: status, ScenarioEventEndRound: event, Float:tmDelay

if (status == WINSTATUS_CTS) {
rg_swap_all_players();
ExecuteForward(g_hForwards[hns_team_swap], _, 0);
iWinsTT = 0;
} else if (status == WINSTATUS_TERRORISTS) {
new iPlayers[MAX_PLAYERS], iCTNum, iTTNum
Expand All @@ -261,6 +270,7 @@ public rgRoundEnd(WinStatus: status, ScenarioEventEndRound: event, Float:tmDelay
if (iWinsTT >= g_pCvar[c_iSwapTeams]) {
client_print_color(0, print_team_blue, "[^3%s^1] Команда TT Выйграла %d раунда! Автоматический свап.", g_pCvar[c_szPrefix], g_pCvar[c_iSwapTeams]);
rg_swap_all_players();
ExecuteForward(g_hForwards[hns_team_swap], _, 0);
iWinsTT = 0;
}
}
Expand Down
71 changes: 71 additions & 0 deletions hns_specback.sma
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <amxmodx>
#include <reapi>
#include <hns_mode_main>

#define rg_get_user_team(%0) get_member(%0, m_iTeam)

new bool:g_bSpec[MAX_PLAYERS + 1];
new TeamName:g_iTeam[MAX_PLAYERS + 1];

public plugin_init() {
register_plugin("HNS Spec back", "1.0.0", "OpenHNS");

register_clcmd("say /spec", "SpecBack");
register_clcmd("say /back", "SpecBack");
}

public hns_team_swap() {
for(new i = 1; i <= MaxClients; i++) {
if(g_bSpec[i]) {
if(g_iTeam[i] == TEAM_CT)
g_iTeam[i] = TEAM_TERRORIST;
else if(g_iTeam[i] == TEAM_TERRORIST)
g_iTeam[i] = TEAM_CT;
}
}
}

public SpecBack(id) {
g_bSpec[id] = !g_bSpec[id];

if (g_bSpec[id]) {
if (rg_get_user_team(id) == TEAM_SPECTATOR) {
g_bSpec[id] = false;
return;
}
g_iTeam[id] = rg_get_user_team(id);
TransferToSpec(id);
} else {
if (rg_get_user_team(id) != TEAM_SPECTATOR) {
g_bSpec[id] = true;
return;
}
rg_set_user_team(id, g_iTeam[id]);
}
}

stock TransferToSpec(id) {
SetTeam(id, TEAM_SPECTATOR);
set_entvar(id, var_solid, SOLID_NOT);
set_entvar(id, var_movetype, MOVETYPE_FLY);
}

SetTeam(id, TeamName:iTeam) {
set_member(id, m_bTeamChanged, false);

if (is_user_alive(id))
user_silentkill(id);

switch (iTeam) {
case TEAM_TERRORIST: {
rg_internal_cmd(id, "jointeam", "1");
rg_internal_cmd(id, "joinclass", "5");
}
case TEAM_CT: {
rg_internal_cmd(id, "jointeam", "2");
rg_internal_cmd(id, "joinclass", "5");
}
case TEAM_SPECTATOR:
rg_internal_cmd(id, "jointeam", "6");
}
}
4 changes: 3 additions & 1 deletion include/hns_mode_main.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ enum HNS_MODE {
new HNS_MODE:g_eHnsMode;

native HNS_MODE:native_get_mode();
native hns_set_mode(HNS_MODE:eMode);
native hns_set_mode(HNS_MODE:eMode);

forward hns_team_swap();

0 comments on commit e3a624b

Please sign in to comment.