diff --git a/data/lang/hidenseek.txt b/data/lang/hidenseek.txt new file mode 100644 index 0000000..6890753 --- /dev/null +++ b/data/lang/hidenseek.txt @@ -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 = Нет \ No newline at end of file diff --git a/hns_hideknife.sma b/hns_hideknife.sma index 959f97b..af80ce3 100644 --- a/hns_hideknife.sma +++ b/hns_hideknife.sma @@ -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; } diff --git a/hns_lash_grenade.sma b/hns_lash_grenade.sma index efbec78..cc418c9 100644 --- a/hns_lash_grenade.sma +++ b/hns_lash_grenade.sma @@ -1,15 +1,24 @@ #include #include +#include #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() { @@ -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; @@ -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; diff --git a/hns_main.sma b/hns_main.sma index d3b195f..0480dea 100644 --- a/hns_main.sma +++ b/hns_main.sma @@ -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() { @@ -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; } @@ -169,7 +180,7 @@ 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); @@ -177,7 +188,7 @@ public checkBalanceTeams() { 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); } } @@ -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); } @@ -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; @@ -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; } @@ -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; } diff --git a/include/hns_mode_main.inc b/include/hns_mode_main.inc index aa56dba..22a5083 100644 --- a/include/hns_mode_main.inc +++ b/include/hns_mode_main.inc @@ -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);