Skip to content

Commit

Permalink
add lang file
Browse files Browse the repository at this point in the history
  • Loading branch information
WessTorn committed Jun 27, 2023
1 parent e3a624b commit 5035ea7
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 32 deletions.
20 changes: 20 additions & 0 deletions data/lang/hidenseek.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"%L", id, ""
"%L", 0, ""

MAIN_TRANSFER_TT = [^3%s^1] %n перенесли за ^3КТ^1.
MAIN_TRANSFER_CT = [^3%s^1] %n перенесли за ^3Террористов^1.
MAIN_SWAP = [^3%s^1] Команда TT Выйграла %d раунда! Автоматический свап.
MAIN_SWIST = [^3%s^1] %n свистнул.
MAIN_KILL_NOT = [^3%s^1] Не доступно для режима ДМ.
MAIN_KILL_WAIT = [^3%s^1] Не доступно в начале раунда.
MAIN_KILL = [^3%s^1] ^3%n^1 убил сам себя.

LAST_NEED = \rНужны гранаты?
LAST_SET = [^3%s^1] ^3%n^1 Взял последние гранаты.

KNIFE_HIDE = Hide knife
KNIFE_CT = Hide for \yCT \r%s
KNIFE_TT = Hide for \yTT \r%s

HNS_YES = Да
HNS_NO = Нет
36 changes: 17 additions & 19 deletions hns_hideknife.sma
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,26 @@ public plugin_init() {
register_clcmd("say_team /knife", "commandHideKnife");

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

register_dictionary("hidenseek.txt");
}

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);
new szMsg[64];
new szMsgYesNo[16];

formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "KNIFE_HIDE");
new hMenu = menu_create(szMsg, "hideknifeHandler");

formatex(szMsgYesNo, charsmax(szMsgYesNo), "%L", LANG_PLAYER, g_playerHideKnife[id][TEAM_TERRORIST] ? "HNS_YES" : "HNS_NO");
formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "KNIFE_TT", szMsgYesNo);
menu_additem(hMenu, szMsg);

formatex(szMsgYesNo, charsmax(szMsgYesNo), "%L", LANG_PLAYER, g_playerHideKnife[id][TEAM_CT] ? "HNS_YES" : "HNS_NO");
formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "KNIFE_CT", szMsgYesNo);
menu_additem(hMenu, szMsg);

menu_display(id, hMenu);

return PLUGIN_HANDLED;
}
Expand Down
27 changes: 22 additions & 5 deletions hns_lash_grenade.sma
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
#include <amxmodx>
#include <reapi>
#include <hns_mode_main>

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

new bool:g_bLastFlash;

new g_szPrefix[24];

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

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

register_dictionary("hidenseek.txt");
}

public plugin_cfg() {
hns_get_prefix(g_szPrefix, charsmax(g_szPrefix));
}

public rgRoundStart() {
Expand All @@ -31,11 +40,17 @@ public rgPlayerKilled(victim, attacker) {
}

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

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

new szMsg[64];

formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "LAST_NEED");
new hMenu = menu_create(szMsg, "NadesHandler");

formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "HNS_YES");
menu_additem(hMenu, szMsg);

formatex(szMsg, charsmax(szMsg), "%L", LANG_PLAYER, "HNS_NO");
menu_additem(hMenu, szMsg);

menu_setprop(hMenu, MPROP_PERPAGE, 0);
menu_display(id, hMenu, 0);
return PLUGIN_HANDLED;
Expand All @@ -60,6 +75,8 @@ public NadesHandler(id, hMenu, item) {
} else {
rg_give_item(id, "weapon_smokegrenade");
}

client_print_color(0, print_team_blue, "%L", 0, "LAST_SET", g_szPrefix, id);
}

g_bLastFlash = false;
Expand Down
27 changes: 19 additions & 8 deletions hns_main.sma
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public plugin_init() {
set_task(0.5, "delayed_mode");

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

register_dictionary("hidenseek.txt");
}

public plugin_precache() {
Expand All @@ -102,10 +104,19 @@ public plugin_precache() {
}

public plugin_natives() {
register_native("hns_get_prefix", "native_get_prefix");

register_native("hns_get_mode", "native_get_mode");
register_native("hns_set_mode", "native_set_mode");
}

public native_get_prefix(amxx, params) {
enum {
arg_prefix = 1, arg_len
};
set_string(arg_prefix, g_pCvar[c_szPrefix], get_param(arg_len));
}

public HNS_MODE:native_get_mode(amxx, params) {
return g_eHnsMode;
}
Expand Down Expand Up @@ -169,15 +180,15 @@ public checkBalanceTeams() {
rg_set_user_team(iPlayer, TEAM_CT);
setUserRole(iPlayer);

client_print_color(0, print_team_blue, "[^3%s^1] %n перенесли за ^3КТ^1.", g_pCvar[c_szPrefix], iPlayer);
client_print_color(0, print_team_blue, "%L", 0, "MAIN_TRANSFER_CT", g_pCvar[c_szPrefix], iPlayer);
}
} else {
new iPlayer = getRandomAlivePlayer(TEAM_TERRORIST);
if (iPlayer) {
rg_set_user_team(iPlayer, TEAM_TERRORIST);
setUserRole(iPlayer);

client_print_color(0, print_team_blue, "[^3%s^1] %n перенесли за ^3Террористов^1.", g_pCvar[c_szPrefix], iPlayer);
client_print_color(0, print_team_blue, "%L", 0, "MAIN_TRANSFER_TT", g_pCvar[c_szPrefix], iPlayer);
}
}

Expand All @@ -193,7 +204,7 @@ public rgPlayerKilled(victim, attacker) {
new iLucky = getRandomAlivePlayer(TEAM_CT);
if (iLucky) {
rg_set_user_team(iLucky, TEAM_TERRORIST);
client_print_color(0, print_team_blue, "[^3%s^1] %n перенесли за ^3Террористов^1.", g_pCvar[c_szPrefix], iLucky)
client_print_color(0, print_team_blue, "%L", 0, "MAIN_TRANSFER_TT", g_pCvar[c_szPrefix], iLucky)
rg_set_user_team(victim, TEAM_CT);
setUserRole(iLucky);
}
Expand Down Expand Up @@ -268,7 +279,7 @@ public rgRoundEnd(WinStatus: status, ScenarioEventEndRound: event, Float:tmDelay

if (g_pCvar[c_iSwapTeams]) {
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]);
client_print_color(0, print_team_blue, "%L", 0, "MAIN_SWAP", g_pCvar[c_szPrefix], g_pCvar[c_iSwapTeams]);
rg_swap_all_players();
ExecuteForward(g_hForwards[hns_team_swap], _, 0);
iWinsTT = 0;
Expand Down Expand Up @@ -310,7 +321,7 @@ public fwdEmitSound(id, iChannel, szSample[], Float:volume, Float:attenuation, f
emit_sound(id, iChannel, g_szUseSound, volume, attenuation, fFlags, pitch);
} else {
emit_sound(id, iChannel, g_szUseSwist, volume, attenuation, fFlags, pitch);
client_print_color(0, print_team_blue, "[^3%s^1] %n свистнул.", g_pCvar[c_szPrefix], id);
client_print_color(0, print_team_blue, "%L", 0, "MAIN_SWIST", g_pCvar[c_szPrefix], id);
flNextTime[id] = get_gametime() + 20.0;
}

Expand All @@ -322,13 +333,13 @@ public fwdEmitSound(id, iChannel, szSample[], Float:volume, Float:attenuation, f

public fwdClientKill(id) {
if (g_eHnsMode == hns_deathmatch) {
client_print_color(id, print_team_blue, "[^3%s^1] Не доступно для режима ДМ.", g_pCvar[c_szPrefix]);
client_print_color(id, print_team_blue, "%L", id, "MAIN_KILL_NOT", g_pCvar[c_szPrefix]);
return FMRES_SUPERCEDE;
} else if (rg_get_remaining_time() > 60.0) {
client_print_color(id, print_team_blue, "[^3%s^1] Не доступно в начале раунда.", g_pCvar[c_szPrefix]);
client_print_color(id, print_team_blue, "%L", id, "MAIN_KILL_WAIT", g_pCvar[c_szPrefix]);
return FMRES_SUPERCEDE;
} else {
client_print_color(0, print_team_blue, "[^3%s^1] ^3%n^1 убил сам себя.", g_pCvar[c_szPrefix], id);
client_print_color(0, print_team_blue, "%L", 0, "MAIN_KILL", g_pCvar[c_szPrefix], id);
}
return FMRES_IGNORED;
}
Expand Down
2 changes: 2 additions & 0 deletions include/hns_mode_main.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ enum HNS_MODE {

new HNS_MODE:g_eHnsMode;

native hns_get_prefix(prefix[], len);

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

Expand Down

0 comments on commit 5035ea7

Please sign in to comment.