From d5e29b883c03e363c14918ab4e86c33c07bc4f3a Mon Sep 17 00:00:00 2001 From: Greyscale Date: Fri, 17 Apr 2009 01:09:52 +0200 Subject: [PATCH] Removed debug test commands from previous commit, added ambientsounds module, removed old, and removed some unused translations phrases. --- .../translations/zombiereloaded.phrases.txt | 1354 ++++++++--------- src/zombiereloaded.sp | 19 +- src/zr/ambience.inc | 139 -- src/zr/antistick.inc | 12 +- src/zr/commands.inc | 2 +- src/zr/cvars.inc | 16 +- src/zr/event.inc | 13 +- src/zr/knockback.inc | 104 +- src/zr/sayhooks.inc | 8 - src/zr/soundeffects/ambientsounds.inc | 214 +++ src/zr/soundeffects/soundeffects.inc | 131 +- src/zr/soundeffects/zombiesounds.inc | 3 +- src/zr/weapons/weapons.inc | 2 +- src/zr/zadmin.inc | 8 +- src/zr/zombie.inc | 2 +- src/zr/zombiereloaded.inc | 2 +- 16 files changed, 1103 insertions(+), 926 deletions(-) delete mode 100644 src/zr/ambience.inc create mode 100644 src/zr/soundeffects/ambientsounds.inc diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index 66e073b..3e766b0 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -1,695 +1,661 @@ -"Phrases" -{ - // =========================== - // General - // =========================== - - "Round objective" - { - "en" "The game is @greenHumans vs. Zombies@default, the goal for zombies is to infect all humans by knifing them." - "ru" "Битва @greenЛюдей против Зомби@default, цель для зомби - инфицировать всех людей." - } - - "You are a zombie" - { - "en" "You have been infected! Now go pass it on to as many people as you can." - "ru" "Вы были инфицированы! Теперь вы охотитесь за людьми." - } - - "Zombie replacement" - { - "en" "The last zombie has left the game, and has passed the infection on to you." - "ru" "Последний зомби покинул игру и передал свою инфекцию вам." - } - - "Auto-assign" - { - "#format" "{1:s}" - "en" "You have randomly been assigned to the @green\"{1}\" @defaultclass." - "ru" "Вам был случайным образом установлен класс \"{1}\"." - } - - "Random class is enabled" - { - "en" "Class selection is locked. A random class will be assigned to you every round." - "ru" "Выбор класса отключен. Каждый раунд вам будет установлен случайнй класс." - } - - "Feature is disabled" - { - "en" "This feature has been disabled by the server host." - "ru" "Данная функция отключена." - } - - "Must be admin" - { - "en" "Can only be used by admins." - "ru" "Может быть использовано только, когда жив." - } - - "Must be alive" - { - "en" "Can only be used when alive." - "ru" "Может быть использовано только, когда жив." - } - - "Must be dead" - { - "en" "Can only be used when dead." - "ru" "Может быть использовано только, когда мертв." - } - - "Must be zombie" - { - "en" "Can only be used while zombie." - "ru" "Может быть использовано только, когда зомби." - } - - "!zmenu reminder" - { - "en" "Type !zmenu in chat to view all ZR commands." - "ru" "Напишите !zmenu в чате для просмотра всех команд." - } - - "Class select" - { - "#format" "{1:s}" - "en" "Switched zombie class to \"{1}\"" - "ru" "Класс зомби переключен на \"{1}\"" - } - - "!ztele amount" - { - "#format" "{1:d}" - "en" "You have @green{1}@default teleports left this round." - "ru" "У вас осталось @green{1}@default телепортов в этом раунде." - } - - "!ztele time left" - { - "#format" "{1:d}" - "en" "You will be teleported in {1} seconds." - "ru" "Вы будете телепортированы через {1} секунды." - } - - "!ztele limit reached" - { - "en" "Teleportation limit has been reached." - "ru" "Вы использовали все свои телепорты." - } - - "!ztele humans restricted" - { - "en" "Once a player has been infected, only zombies can use !ztele." - "ru" "После инфицирования кого-либо, только зомби могут использовать !ztele" - } - - "!ztele zombies restricted" - { - "en" "The teleporter is disabled for zombies." - } - - "!ztele stuck" - { - "en" "Tip: Use !tp to teleport away if you are stuck." - } - - "!ztele not spawned" - { - "en" "You cannot use the teleporter before you've spawned." - } - - "!ztele offline" - { - "en" "The teleporter is not online yet." - } - - "!ztele cooldown" - { - "en" "Your teleporter is still on a cooldown." - } - - "!ztele in progress" - { - "en" "You already have a teleportation in progress." - } - - "!ztele successful" - { - "en" "Teleport successful." - } - - // =========================== - // Generic - // =========================== - - // Menu - - "Menu empty" - { - "en" "(Empty)" - } - - // =========================== - // Weapons - // =========================== - - // General - - "Zombie cant use weapon" - { - "en" "Zombies can't use weapons!" - "ru" "Зомби не могут использовать оружие!" - } - - // Market - - "Market out of buyzone" - { - "en" "You are not in a buyzone." - "ru" "Вы вне зоны покупки." - } - - // Restrict - - "Restrict weapon" - { - "#format" "{1:s}" - "en" "Weapon @green\"{1}\" @defaulthas been restricted." - } - - "Unrestrict weapon" - { - "#format" "{1:s}" - "en" "Weapon @green\"{1}\" @defaulthas been unrestricted." - } - - "Restrict weapon failed" - { - "#format" "{1:s}" - "en" "Weapon @green\"{1}\" @defaultis already restricted." - } - - "Unrestrict weapon failed" - { - "#format" "{1:s}" - "en" "Weapon @green\"{1}\" @default has no restrictions set." - } - - "Restrict custom weapon group" - { - "#format" "{1:s},{2:s}" - "en" "Weapon group @green\"{1}\" ({2}) @defaulthas been restricted." - } - - "Unrestrict custom weapon group" - { - "#format" "{1:s},{2:s}" - "en" "Weapon group @green\"{1}\" ({2}) @defaulthas been unrestricted." - } - - "Restrict custom weapon group failed" - { - "#format" "{1:s},{2:s}" - "en" "Weapon group @green\"{1}\" ({2}) @defaultis already restricted." - } - - "Unrestrict custom weapon group failed" - { - "#format" "{1:s},{2:s}" - "en" "Weapon group @green\"{1}\" ({2}) @defaulthas no restrictions set." - } - - "Weapon invalid" - { - "#format" "{1:s}" - "en" "Weapon @green\"{1}\" @defaultis an invalid weapon name." - } - - "Weapon is restricted" - { - "#format" "{1:s}" - "en" "Weapon @green{1} @defaultis restricted." - "ru" "Оружие @green{1} @default запрещено." - } - - // Menu - - "Weapons menu main title" - { - "en" "Weapons Management" - } - - "Weapons menu main toggle weapon restrict" - { - "en" "Toggle Weapon Restriction" - } - - "Weapons menu main toggle weapon group restrict" - { - "en" "Toggle Weapon Group Restriction" - } - - "Weapons menu main market" // Option disabled if ZMarket isn't installed - { - "en" "ZMarket Options" - } - - "Weapons menu weapons weapon title" - { - "en" "Toggle Restrictions:\n * = restricted" - } - - "Weapons menu weapons group title" - { - "en" "Access Weapon Group:\n * = Partially restricted\n ** = Fully restricted" - } - - "Weapons menu weapon group title" - { - "#format" "{1:s}" - "en" "Modify Restrictions:\n Current Weapon Group: {1}\n * = restricted" - } - - "Weapons menu market title" - { - "en" "Toggle Market Settings:" - } - - "Weapons menu market toggle buyzone" - { - "#format" "{1:s}" - "en" "Buyzone Only (Current: {1})" - } - - "Weapons menu weapon group restrict all" - { - "en" "Restrict All Group Weapons" - } - - "Weapons menu weapon group unrestrict all" - { - "en" "Unrestrict All Group Weapons" - } - - // =========================== - // Spawn Protect - // =========================== - - // General - - "Spawn protection begin" - { - "#format" "{1:d}" - "en" "Zombies are present, you have {1} seconds to find a safe place before you lose immunity." - "ru" "Зомби на свободе, у вас {1} секунд, чтобы найти безопасное место, пока не потеряли иммунитет." - } - - "Spawn protection end" - { - "en" "You are now susceptible to zombie infection." - "ru" "Теперь вы восприимчивы к зомби инфекции." - } - - // HUD - - "Spawn Protect" - { - "#format" "{1:d}" - "en" "Zombie protection ends in: {1} seconds." - } - - // =========================== - // ZHP - // =========================== - - // General - - "ZHP enable" - { - "en" "HP display enabled, your real HP will be displayed after infection." - } - - "ZHP disable" - { - "en" "HP display disabled." - "ru" "Отображение здоровья включено." - } - - // HUD - - "Display HP" - { - "#format" "{1:d}" - "en" "HP: {1}" - "ru" "Здоровье: {1}" - } - - - "Suicide text" - { - "en" "Nice try n00b!" - "ru" "Неплохая попытка n00b!" - } - - "Unfair camping" - { - "en" "An admin has marked this area as unfair, please move along, or die." - } - - "Unfair camper slayed" - { - "#format" "{1:s},{2:d}" - "en" "Player {1} has been slayed for camping in a restricted area. (ID: {2})" - } - - "DX90 not supported" - { - "#format" "{1:d},{2:d}" - "en" "Blocking Overlay - DX{1} Detected (DX{2} Required)" - "ru" "Оверлей Отключен - Обнаружен DX{1} (Необходим DX{2})" - } - - // =========================== - // Menus - // =========================== - - "!zmenu title" - { - "en" "ZR Commands:" - "ru" "ZR Команды:" - } - - "!zmenu menu" - { - "en" "ZMenu (!zmenu) - Display all ZR commands" - "ru" "ZMenu (!zmenu) - Показывает все ZR команды" - } - - "!zmenu admin" - { - "en" "ZAdmin (!zadmin) - View Admin Menu" - } - - "!zmenu class" - { - "en" "ZClass (!zclass) - Select a zombie class" - "ru" "ZClass (!zclass) - Выбор класса зомби" - } - - "!zmenu market" - { - "en" "ZMarket (!zmarket) - Custom weapon list" - "ru" "ZMarket (!zmarket) - Собственный набор оружия" - } - - "!zmenu spawn" - { - "en" "ZSpawn (!zspawn) - Spawn into game" - "ru" "ZSpawn (!zspawn) - Заход в игру" - } - - "!zmenu tele" - { - "en" "ZTele (!ztele) - Teleport to your spawnpoint" - "ru" "ZTele (!ztele) - Телепорт на место появления" - } - - "!zmenu hp" - { - "en" "ZHP (!zhp) - Toggle persistent display of HP as zombie" - "ru" "ZHP (!zhp) - Показ здоровья зомби" - } - - "Market title" - { - "en" "Available Guns:" - "ru" "Доступные Пушки:" - } - - "Market rebuy" - { - "en" "Rebuy" - "ru" "Купить снова" - } - - // =========================== - // Class menu - // =========================== - - "!zclass title" - { - "en" "Class Selection:" - } - - "!zclass zombie" - { - "en" "Select Zombie Class" - } - - "!zclass human" - { - "en" "Select Human Class" - } - - "!zclass admin" - { - "en" "Select Admin Class" - } - - "!zclass admin mode enabled" - { - "en" "Admin mode is enabled!" - } - - "!zclass admin mode toggle" - { - "en" "Toggle Admin Mode" - } - - // =========================== - // ZAdmin Menu - // =========================== - - "!zadmin main title" - { - "en" "ZAdmin Menu:" - } - - "!zadmin main knockbackm" - { - "en" "Modify Knockback Multiplier" - } - - "!zadmin main knockback" - { - "en" "Modify Class Knockback" - } - - "!zadmin main nvgs" - { - "en" "Modify Nightvision Options" - } - - "!zadmin main infect" - { - "en" "Infect a Player" - } - - "!zadmin main spawn" - { - "en" "Spawn All Players" - } - - "!zadmin main tele" - { - "en" "ZTele Commands" - } - - "!zadmin main weapons" - { - "en" "Weapon Management" - } - - "!zadmin main logflags" - { - "en" "Logging Flags" - } - - "!zadmin class title" - { - "en" "Select Class to Modify:" - } - - "!zadmin knockbackm title" - { - "#format" "{1:f}" - "en" "Modify Knockback Multiplier\nCurrent Knockback: {1}" - } - - "!zadmin knockbackm increase" - { - "#format" "{1:s}" - "en" "Increase Knockback Multiplier (+{1})" - } - - "!zadmin knockbackm decrease" - { - "#format" "{1:s}" - "en" "Decrease Knockback Multiplier (-{1})" - } - - "!zadmin knockback title" - { - "#format" "{1:s},{2:f}" - "en" "Modify Knockback\nClass: {1}\nCurrent Knockback: {2}" - } - - "!zadmin knockback increase" - { - "#format" "{1:s}" - "en" "Increase Knockback (+{1})" - } - - "!zadmin knockback decrease" - { - "#format" "{1:s}" - "en" "Decrease Knockback (-{1})" - } - - "!zadmin nvgs title" - { - "#format" "{1:d}" - "en" "Override NVG Cvar\nCurrent Setting: {1}" - } - - "!zadmin nvgs decrease" - { - "en" "Decrease Knockback" - } - - "!zadmin nvgs no override" - { - "en" "No Override/Class Specific" - } - - "!zadmin nvgs disable" - { - "en" "Disable NVGs" - } - - "!zadmin nvgs enable" - { - "en" "Enable NVGs" - } - - "!zadmin infect title" - { - "en" "Choose a Player to Infect:" - } - - "!zadmin ztele title" - { - "en" "ZTele Admin Menu:" - } - - "!zadmin ztele spawn tele" - { - "en" "Teleport a Player to Spawn" - } - - "!zadmin ztele abort" - { - "en" "Abort Teleport on a Player" - } - - "!zadmin ztele save" - { - "en" "Save Teleport Location" - } - - "!zadmin ztele tele" - { - "en" "Teleport Player to Saved Location" - } - - "!zadmin log flags title" - { - "en" "Toggle Logging Flags:" - } - - // =========================== - // Server Messages - // =========================== - - "ZR" - { - "en" "ZR" - "ru" "ZR" - } - - "Plugin loading" - { - "en" "-----------| Zombie:Reloaded Loading |----------" - "ru" "-----------| Zombie:Reloaded Загружается |----------" - } - - "Plugin loaded" - { - "en" "-----------| Zombie:Reloaded Loaded |----------" - "ru" "-----------| Zombie:Reloaded Загружен |----------" - } - - "Console restricted" - { - "en" "Command not usable from console." - "ru" "Команда не используется для консоли." - } - - "Restrict weapon mapstart" - { - "#format" "{1:s}" - "en" "Restricted weapon: {1}" - "ru" "Запрещенное оружие: {1}" - } - - "Restrict weapon group mapstart" - { - "#format" "{1:s}" - "en" "Restricted group: {1}" - "ru" "Запрещенная группа: {1}" - } - - "Ambient sound load failed" - { - "#format" "{1:s}" - "en" "Invalid sound file: {1}" - "ru" "Неправильный звуковой файл: {1}" - } - - "Class limit" - { - "#format" "{1:d}" - "en" "The max amount of classes have been exceeded, only loading first {1}." - "ru" "Превышено максимальное количество классов, загружаются только первые {1}." - } - - "Class auto-disable" - { - "en" "No classes defined in \"{1}\", disabling classes." - "ru" "В \"{1}\" отсутствуют определения классов, классы отключены." - } - - "Models loaded" - { - "en" "--- Models Loaded ---" - "ru" "--- Модели Загружены ---" - } - - "File load failed" - { - "#format" "{1:s}" - "en" "Missing file for download: \"{1}\", check downloads.txt" - "ru" "Пропущен файл для скачивания: \"{1}\", проверьте downloads.txt" - } +"Phrases" +{ + // =========================== + // General + // =========================== + + "Round objective" + { + "en" "The game is @greenHumans vs. Zombies@default, the goal for zombies is to infect all humans by knifing them." + "ru" "Битва @greenЛюдей против Зомби@default, цель для зомби - инфицировать всех людей." + } + + "You are a zombie" + { + "en" "You have been infected! Now go pass it on to as many people as you can." + "ru" "Вы были инфицированы! Теперь вы охотитесь за людьми." + } + + "Zombie replacement" + { + "en" "The last zombie has left the game, and has passed the infection on to you." + "ru" "Последний зомби покинул игру и передал свою инфекцию вам." + } + + "Auto-assign" + { + "#format" "{1:s}" + "en" "You have randomly been assigned to the @green\"{1}\" @defaultclass." + "ru" "Вам был случайным образом установлен класс \"{1}\"." + } + + "Random class is enabled" + { + "en" "Class selection is locked. A random class will be assigned to you every round." + "ru" "Выбор класса отключен. Каждый раунд вам будет установлен случайнй класс." + } + + "Feature is disabled" + { + "en" "This feature has been disabled by the server host." + "ru" "Данная функция отключена." + } + + "Must be admin" + { + "en" "Can only be used by admins." + "ru" "Может быть использовано только, когда жив." + } + + "Must be alive" + { + "en" "Can only be used when alive." + "ru" "Может быть использовано только, когда жив." + } + + "Must be dead" + { + "en" "Can only be used when dead." + "ru" "Может быть использовано только, когда мертв." + } + + "Must be zombie" + { + "en" "Can only be used while zombie." + "ru" "Может быть использовано только, когда зомби." + } + + "!zmenu reminder" + { + "en" "Type !zmenu in chat to view all ZR commands." + "ru" "Напишите !zmenu в чате для просмотра всех команд." + } + + "Class select" + { + "#format" "{1:s}" + "en" "Switched zombie class to \"{1}\"" + "ru" "Класс зомби переключен на \"{1}\"" + } + + "!ztele amount" + { + "#format" "{1:d}" + "en" "You have @green{1}@default teleports left this round." + "ru" "У вас осталось @green{1}@default телепортов в этом раунде." + } + + "!ztele time left" + { + "#format" "{1:d}" + "en" "You will be teleported in {1} seconds." + "ru" "Вы будете телепортированы через {1} секунды." + } + + "!ztele limit reached" + { + "en" "Teleportation limit has been reached." + "ru" "Вы использовали все свои телепорты." + } + + "!ztele humans restricted" + { + "en" "Once a player has been infected, only zombies can use !ztele." + "ru" "После инфицирования кого-либо, только зомби могут использовать !ztele" + } + + "!ztele zombies restricted" + { + "en" "The teleporter is disabled for zombies." + } + + "!ztele stuck" + { + "en" "Tip: Use !tp to teleport away if you are stuck." + } + + "!ztele not spawned" + { + "en" "You cannot use the teleporter before you've spawned." + } + + "!ztele offline" + { + "en" "The teleporter is not online yet." + } + + "!ztele cooldown" + { + "en" "Your teleporter is still on a cooldown." + } + + "!ztele in progress" + { + "en" "You already have a teleportation in progress." + } + + "!ztele successful" + { + "en" "Teleport successful." + } + + // =========================== + // Generic + // =========================== + + // Menu + + "Menu empty" + { + "en" "(Empty)" + } + + // =========================== + // Weapons + // =========================== + + // General + + "Zombie cant use weapon" + { + "en" "Zombies can't use weapons!" + "ru" "Зомби не могут использовать оружие!" + } + + // Market + + "Market out of buyzone" + { + "en" "You are not in a buyzone." + "ru" "Вы вне зоны покупки." + } + + // Restrict + + "Restrict weapon" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\" @defaulthas been restricted." + } + + "Unrestrict weapon" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\" @defaulthas been unrestricted." + } + + "Restrict weapon failed" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\" @defaultis already restricted." + } + + "Unrestrict weapon failed" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\" @default has no restrictions set." + } + + "Restrict custom weapon group" + { + "#format" "{1:s},{2:s}" + "en" "Weapon group @green\"{1}\" ({2}) @defaulthas been restricted." + } + + "Unrestrict custom weapon group" + { + "#format" "{1:s},{2:s}" + "en" "Weapon group @green\"{1}\" ({2}) @defaulthas been unrestricted." + } + + "Restrict custom weapon group failed" + { + "#format" "{1:s},{2:s}" + "en" "Weapon group @green\"{1}\" ({2}) @defaultis already restricted." + } + + "Unrestrict custom weapon group failed" + { + "#format" "{1:s},{2:s}" + "en" "Weapon group @green\"{1}\" ({2}) @defaulthas no restrictions set." + } + + "Weapon invalid" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\" @defaultis an invalid weapon name." + } + + "Weapon is restricted" + { + "#format" "{1:s}" + "en" "Weapon @green{1} @defaultis restricted." + "ru" "Оружие @green{1} @default запрещено." + } + + // Menu + + "Weapons menu main title" + { + "en" "Weapons Management" + } + + "Weapons menu main toggle weapon restrict" + { + "en" "Toggle Weapon Restriction" + } + + "Weapons menu main toggle weapon group restrict" + { + "en" "Toggle Weapon Group Restriction" + } + + "Weapons menu main market" // Option disabled if ZMarket isn't installed + { + "en" "ZMarket Options" + } + + "Weapons menu weapons weapon title" + { + "en" "Toggle Restrictions:\n * = restricted" + } + + "Weapons menu weapons group title" + { + "en" "Access Weapon Group:\n * = Partially restricted\n ** = Fully restricted" + } + + "Weapons menu weapon group title" + { + "#format" "{1:s}" + "en" "Modify Restrictions:\n Current Weapon Group: {1}\n * = restricted" + } + + "Weapons menu market title" + { + "en" "Toggle Market Settings:" + } + + "Weapons menu market toggle buyzone" + { + "#format" "{1:s}" + "en" "Buyzone Only (Current: {1})" + } + + "Weapons menu weapon group restrict all" + { + "en" "Restrict All Group Weapons" + } + + "Weapons menu weapon group unrestrict all" + { + "en" "Unrestrict All Group Weapons" + } + + // =========================== + // Spawn Protect + // =========================== + + // General + + "Spawn protection begin" + { + "#format" "{1:d}" + "en" "Zombies are present, you have {1} seconds to find a safe place before you lose immunity." + "ru" "Зомби на свободе, у вас {1} секунд, чтобы найти безопасное место, пока не потеряли иммунитет." + } + + "Spawn protection end" + { + "en" "You are now susceptible to zombie infection." + "ru" "Теперь вы восприимчивы к зомби инфекции." + } + + // HUD + + "Spawn Protect" + { + "#format" "{1:d}" + "en" "Zombie protection ends in: {1} seconds." + } + + // =========================== + // ZHP + // =========================== + + // General + + "ZHP enable" + { + "en" "HP display enabled, your real HP will be displayed after infection." + } + + "ZHP disable" + { + "en" "HP display disabled." + "ru" "Отображение здоровья включено." + } + + // HUD + + "Display HP" + { + "#format" "{1:d}" + "en" "HP: {1}" + "ru" "Здоровье: {1}" + } + + + "Suicide text" + { + "en" "Nice try n00b!" + "ru" "Неплохая попытка n00b!" + } + + "Unfair camping" + { + "en" "An admin has marked this area as unfair, please move along, or die." + } + + "Unfair camper slayed" + { + "#format" "{1:s},{2:d}" + "en" "Player {1} has been slayed for camping in a restricted area. (ID: {2})" + } + + "DX90 not supported" + { + "#format" "{1:d},{2:d}" + "en" "Blocking Overlay - DX{1} Detected (DX{2} Required)" + "ru" "Оверлей Отключен - Обнаружен DX{1} (Необходим DX{2})" + } + + // =========================== + // Menus + // =========================== + + "!zmenu title" + { + "en" "ZR Commands:" + "ru" "ZR Команды:" + } + + "!zmenu menu" + { + "en" "ZMenu (!zmenu) - Display all ZR commands" + "ru" "ZMenu (!zmenu) - Показывает все ZR команды" + } + + "!zmenu admin" + { + "en" "ZAdmin (!zadmin) - View Admin Menu" + } + + "!zmenu class" + { + "en" "ZClass (!zclass) - Select a zombie class" + "ru" "ZClass (!zclass) - Выбор класса зомби" + } + + "!zmenu market" + { + "en" "ZMarket (!zmarket) - Custom weapon list" + "ru" "ZMarket (!zmarket) - Собственный набор оружия" + } + + "!zmenu spawn" + { + "en" "ZSpawn (!zspawn) - Spawn into game" + "ru" "ZSpawn (!zspawn) - Заход в игру" + } + + "!zmenu tele" + { + "en" "ZTele (!ztele) - Teleport to your spawnpoint" + "ru" "ZTele (!ztele) - Телепорт на место появления" + } + + "!zmenu hp" + { + "en" "ZHP (!zhp) - Toggle persistent display of HP as zombie" + "ru" "ZHP (!zhp) - Показ здоровья зомби" + } + + "Market title" + { + "en" "Available Guns:" + "ru" "Доступные Пушки:" + } + + "Market rebuy" + { + "en" "Rebuy" + "ru" "Купить снова" + } + + // =========================== + // Class menu + // =========================== + + "!zclass title" + { + "en" "Class Selection:" + } + + "!zclass zombie" + { + "en" "Select Zombie Class" + } + + "!zclass human" + { + "en" "Select Human Class" + } + + "!zclass admin" + { + "en" "Select Admin Class" + } + + "!zclass admin mode enabled" + { + "en" "Admin mode is enabled!" + } + + "!zclass admin mode toggle" + { + "en" "Toggle Admin Mode" + } + + // =========================== + // ZAdmin Menu + // =========================== + + "!zadmin main title" + { + "en" "ZAdmin Menu:" + } + + "!zadmin main knockbackm" + { + "en" "Modify Knockback Multiplier" + } + + "!zadmin main knockback" + { + "en" "Modify Class Knockback" + } + + "!zadmin main nvgs" + { + "en" "Modify Nightvision Options" + } + + "!zadmin main infect" + { + "en" "Infect a Player" + } + + "!zadmin main spawn" + { + "en" "Spawn All Players" + } + + "!zadmin main tele" + { + "en" "ZTele Commands" + } + + "!zadmin main weapons" + { + "en" "Weapon Management" + } + + "!zadmin main logflags" + { + "en" "Logging Flags" + } + + "!zadmin class title" + { + "en" "Select Class to Modify:" + } + + "!zadmin knockbackm title" + { + "#format" "{1:f}" + "en" "Modify Knockback Multiplier\nCurrent Knockback: {1}" + } + + "!zadmin knockbackm increase" + { + "#format" "{1:s}" + "en" "Increase Knockback Multiplier (+{1})" + } + + "!zadmin knockbackm decrease" + { + "#format" "{1:s}" + "en" "Decrease Knockback Multiplier (-{1})" + } + + "!zadmin knockback title" + { + "#format" "{1:s},{2:f}" + "en" "Modify Knockback\nClass: {1}\nCurrent Knockback: {2}" + } + + "!zadmin knockback increase" + { + "#format" "{1:s}" + "en" "Increase Knockback (+{1})" + } + + "!zadmin knockback decrease" + { + "#format" "{1:s}" + "en" "Decrease Knockback (-{1})" + } + + "!zadmin nvgs title" + { + "#format" "{1:d}" + "en" "Override NVG Cvar\nCurrent Setting: {1}" + } + + "!zadmin nvgs decrease" + { + "en" "Decrease Knockback" + } + + "!zadmin nvgs no override" + { + "en" "No Override/Class Specific" + } + + "!zadmin nvgs disable" + { + "en" "Disable NVGs" + } + + "!zadmin nvgs enable" + { + "en" "Enable NVGs" + } + + "!zadmin infect title" + { + "en" "Choose a Player to Infect:" + } + + "!zadmin ztele title" + { + "en" "ZTele Admin Menu:" + } + + "!zadmin ztele spawn tele" + { + "en" "Teleport a Player to Spawn" + } + + "!zadmin ztele abort" + { + "en" "Abort Teleport on a Player" + } + + "!zadmin ztele save" + { + "en" "Save Teleport Location" + } + + "!zadmin ztele tele" + { + "en" "Teleport Player to Saved Location" + } + + "!zadmin log flags title" + { + "en" "Toggle Logging Flags:" + } + + // =========================== + // Server Messages + // =========================== + + "ZR" + { + "en" "ZR" + "ru" "ZR" + } + + "Plugin loading" + { + "en" "-----------| Zombie:Reloaded Loading |----------" + "ru" "-----------| Zombie:Reloaded Загружается |----------" + } + + "Plugin loaded" + { + "en" "-----------| Zombie:Reloaded Loaded |----------" + "ru" "-----------| Zombie:Reloaded Загружен |----------" + } + + "Console restricted" + { + "en" "Command not usable from console." + "ru" "Команда не используется для консоли." + } + + "Models loaded" + { + "en" "--- Models Loaded ---" + "ru" "--- Модели Загружены ---" + } + + "File load failed" + { + "#format" "{1:s}" + "en" "Missing file for download: \"{1}\", check downloads.txt" + "ru" "Пропущен файл для скачивания: \"{1}\", проверьте downloads.txt" + } } \ No newline at end of file diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index b800784..6da3a4e 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -22,16 +22,12 @@ #include "zr/cvars" #include "zr/translation" #include "zr/offsets" -#include "zr/ambience" #include "zr/models" #include "zr/overlays" // Class system #include "zr/playerclasses/playerclasses" -// Antistick -#include "zr/antistick" - #include "zr/anticamp" #include "zr/teleport" #include "zr/zombie" @@ -44,6 +40,9 @@ // Sound effects #include "zr/soundeffects/soundeffects" +// Antistick +#include "zr/antistick" + // Hitgroups #include "zr/hitgroups" @@ -146,12 +145,14 @@ public OnMapStart() // Forward event to modules. ClassLoad(); WeaponsLoad(); + SEffectsOnMapStart(); HitgroupsLoad(); Anticamp_Startup(); } public OnMapEnd() { + // Forward event to modules. Anticamp_Disable(); } @@ -176,7 +177,9 @@ public OnConfigsExecuted() } FindMapSky(); - LoadAmbienceData(); + + // Forward event to modules. + SEffectsLoad(); } public OnClientPutInServer(client) @@ -185,14 +188,12 @@ public OnClientPutInServer(client) // Forward event to modules. ClassClientInit(client); - ZombieSoundsClientInit(client); + SEffectsClientInit(client); WeaponsClientInit(client); SpawnProtectClientInit(client); RespawnClientInit(client); ZHPClientInit(client); - if (!IsFakeClient(client)) AmbienceStart(client); - ClientHookAttack(client); FindClientDXLevel(client); @@ -214,7 +215,6 @@ public OnClientDisconnect(client) ClassOnClientDisconnect(client); WeaponsOnClientDisconnect(client); ZTeleResetClient(client); - AmbienceStop(client); for (new x = 0; x < MAXTIMERS; x++) { @@ -232,7 +232,6 @@ MapChangeCleanup() { tRound = INVALID_HANDLE; tInfect = INVALID_HANDLE; - AmbienceStopAll(); AntiStickReset(); // x = client index. diff --git a/src/zr/ambience.inc b/src/zr/ambience.inc deleted file mode 100644 index ff7e285..0000000 --- a/src/zr/ambience.inc +++ /dev/null @@ -1,139 +0,0 @@ -/** - * ==================== - * Zombie:Reloaded - * File: ambience.inc - * Author: Greyscale - * ==================== - */ - -// TODO: Move skybox and lightning functions into this file. - -new bool:AmbienceLoaded = false; -new String:AmbienceSound[64]; -new Float:AmbienceVolume; -new Handle:tAmbience[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; - -LoadAmbienceData() -{ - new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENCE]); - if (!ambience) - { - return; - } - - decl String:sound[64]; - GetConVarString(gCvars[CVAR_AMBIENCE_FILE], AmbienceSound, sizeof(AmbienceSound)); - Format(sound, sizeof(sound), "sound/%s", AmbienceSound); - - AmbienceLoaded = FileExists(sound, true); - - if (AmbienceLoaded) - { - AddFileToDownloadsTable(sound); - PrecacheSound(AmbienceSound); - AmbienceVolume = GetConVarFloat(gCvars[CVAR_AMBIENCE_VOLUME]); - - if (AmbienceVolume <= 0.0) - { - // No reason to play ambience sound if it's muted. - AmbienceLoaded = false; - if (LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_AMBIENCE)) ZR_LogMessageFormatted(-1, "ambience", "startup", "Ambience volume is muted or invalid.", LOG_FORMAT_TYPE_ERROR); - } - - if (LogFlagCheck(LOG_DEBUG, LOG_MODULE_AMBIENCE)) ZR_LogMessageFormatted(-1, "ambience", "startup", "Ambience sound loaded."); - } - else - { - if (LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_AMBIENCE)) - { - decl String:log_message[256]; - ZR_TranslateMessage(log_message, sizeof(log_message), "Ambience sound load failed", sound); - ZR_LogMessageFormatted(-1, "ambience", "startup", log_message, true); - } - } -} - -AmbienceStart(client) -{ - if (!AmbienceLoaded) - { - return; - } - - new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENCE]); - if (!ambience) - { - return; - } - - new Float:delay = GetConVarFloat(gCvars[CVAR_AMBIENCE_LENGTH]); - if (delay <= 0.0) - { - return; - } - - if (!IsClientConnected(client) || !IsClientInGame(client)) - { - return; - } - - if (LogFlagCheck(LOG_DEBUG, LOG_MODULE_AMBIENCE)) ZR_LogMessageFormatted(client, "ambience", "start", "Starting ambience on client %d...", _, client); - AmbiencePlay(client); - tAmbience[client] = CreateTimer(delay, AmbienceTimer, client, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT); -} - -AmbienceStop(client) -{ - if (tAmbience[client] != INVALID_HANDLE) - { - KillTimer(tAmbience[client]); - tAmbience[client] = INVALID_HANDLE; - if (IsClientConnected(client) && IsClientInGame(client)) - { - StopSound(client, SNDCHAN_AUTO, AmbienceSound); - } - } -} - -AmbienceStopAll() -{ - // x = client index. - for (new x = 1; x < MaxClients; x++) - { - AmbienceStop(x); - } -} - -AmbienceRestart(client) -{ - AmbienceStop(client); - AmbienceStart(client); -} - -AmbienceRestartAll() -{ - // x = client index. - for (new x = 1; x < MaxClients; x++) - { - AmbienceRestart(x); - } -} - -public Action:AmbienceTimer(Handle:timer, any:client) -{ - new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENCE]); - if (!ambience || !AmbienceLoaded) - { - KillTimer(tAmbience[client]); - tAmbience[client] = INVALID_HANDLE; - return; - } - - AmbiencePlay(client); -} - -AmbiencePlay(client) -{ - EmitSoundToClient(client, AmbienceSound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, AmbienceVolume, SNDPITCH_NORMAL, -1, NULL_VECTOR, NULL_VECTOR, true, 0.0); - if (LogFlagCheck(LOG_DEBUG, LOG_MODULE_AMBIENCE)) ZR_LogMessageFormatted(client, "ambience", "play", "Playing ambience sound on client %d.", _, client); -} \ No newline at end of file diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index 9336feb..ee0b154 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -21,6 +21,15 @@ */ new Handle:tAntiStick = INVALID_HANDLE; +/** + * The round is starting. + */ +AntiStickOnRoundStart() +{ + // Restart antistick timer. + AntiStickRestart(); +} + /** * Restarts the AntiStickTimer function. */ @@ -97,8 +106,7 @@ AntiStickIsStuck(client) } /** - * Repeated timer function. - * Automatically unsticks players that are stuck together. + * Timer callback, automatically unsticks players that are stuck together. */ public Action:AntiStickTimer(Handle:timer) { diff --git a/src/zr/commands.inc b/src/zr/commands.inc index 0573ef5..7ec4b6c 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -311,7 +311,7 @@ public Action:Command_LogFlags(client, argc) ReplyToCommand(client, message); message[0] = 0; - StrCat(message, sizeof(message), "LOG_MODULE_AMBIENCE (2048) - ambience.inc\n"); + StrCat(message, sizeof(message), "LOG_MODULE_AMBIENTSOUNDS (2048) - ambientsounds.inc\n"); StrCat(message, sizeof(message), "LOG_MODULE_OVERLAYS (4096) - overlays.inc\n"); StrCat(message, sizeof(message), "LOG_MODULE_SAYTRIGGERS (8192) - sayhooks.inc\n"); StrCat(message, sizeof(message), "LOG_MODULE_TELEPORT (16384) - teleport.inc\n"); diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index bfdfe45..079cd6b 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -11,10 +11,10 @@ enum ZRSettings Handle:CVAR_ENABLE, Handle:CVAR_LOG, Handle:CVAR_ALLOW_PLAYER_TEAM, - Handle:CVAR_AMBIENCE, - Handle:CVAR_AMBIENCE_FILE, - Handle:CVAR_AMBIENCE_LENGTH, - Handle:CVAR_AMBIENCE_VOLUME, + Handle:CVAR_AMBIENTSOUNDS, + Handle:CVAR_AMBIENTSOUNDS_FILE, + Handle:CVAR_AMBIENTSOUNDS_LENGTH, + Handle:CVAR_AMBIENTSOUNDS_VOLUME, Handle:CVAR_SOUNDEFFECTS_MOAN, Handle:CVAR_SOUNDEFFECTS_GROAN, Handle:CVAR_SOUNDEFFECTS_DEATH, @@ -101,10 +101,10 @@ CreateCvars() gCvars[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "Enable zombie gameplay (0: Disable)"); gCvars[CVAR_LOG] = CreateConVar("zr_log", "331", "Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)"); gCvars[CVAR_ALLOW_PLAYER_TEAM] = CreateConVar("zr_allow_player_team", "0", "This will allow the player_team event to be fired on first team join, enable when using mani model menu (0: Disable)"); - gCvars[CVAR_AMBIENCE] = CreateConVar("zr_ambience", "1", "Enable creepy ambience to be played throughout the game (0: Disable)"); - gCvars[CVAR_AMBIENCE_FILE] = CreateConVar("zr_ambience_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1"); - gCvars[CVAR_AMBIENCE_LENGTH] = CreateConVar("zr_ambience_length", "60.0", "The length, in seconds, of the ambient sound file"); - gCvars[CVAR_AMBIENCE_VOLUME] = CreateConVar("zr_ambience_volume", "0.6", "Volume of ambient sounds when zr_ambience is 1 (0.0: Unhearable, 1.0: Max volume)"); + gCvars[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "Enable creepy ambience to be played throughout the game (0: Disable)"); + gCvars[CVAR_AMBIENTSOUNDS_FILE] = CreateConVar("zr_ambientsounds_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1"); + gCvars[CVAR_AMBIENTSOUNDS_LENGTH] = CreateConVar("zr_ambientsounds_length", "60.0", "The length, in seconds, of the ambient sound file"); + gCvars[CVAR_AMBIENTSOUNDS_VOLUME] = CreateConVar("zr_ambientsounds_volume", "1.0", "Volume of ambient sounds when zr_ambience is 1 (0.0: Unhearable, 1.0: Max volume)"); gCvars[CVAR_SOUNDEFFECTS_MOAN] = CreateConVar("zr_soundeffects_moan", "50", "How often, in seconds, a zombie moans (0: Disable)"); gCvars[CVAR_SOUNDEFFECTS_GROAN] = CreateConVar("zr_soundeffects_groan", "5", "Chance factor a zombie will groan when shot (Lower: More often, 0: Disable)"); gCvars[CVAR_SOUNDEFFECTS_DEATH] = CreateConVar("zr_soundeffects_death", "1", "Zombie will emit a death sound when killed 0: Disable)"); diff --git a/src/zr/event.inc b/src/zr/event.inc index 8c5dab3..c97186c 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -33,10 +33,12 @@ UnhookEvents() public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { ChangeLightStyle(); - AmbienceRestartAll(); - AntiStickRestart(); RefreshList(); + // Forward event to sub-modules. + SEffectsOnRoundStart(); + AntiStickOnRoundStart(); + if (tRound != INVALID_HANDLE) { KillTimer(tRound); @@ -74,6 +76,7 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca new Float:randlen = GetRandomFloat(min, max); tInfect = CreateTimer(randlen, MotherZombie, _, TIMER_FLAG_NO_MAPCHANGE); + // Forward events to modules. ZTeleEnable(); } @@ -193,7 +196,7 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) // Forward event to modules. ClassOnClientSpawn(index); - ZombieSoundsOnClientSpawn(index); + SEffectsOnClientSpawn(index); SpawnProtectOnClientSpawn(index); RespawnOnClientSpawn(index); ZHPOnClientSpawn(index); @@ -241,7 +244,7 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) // Forward event to modules. ClassAlphaUpdate(index); - ZombieSoundsOnClientHurt(index); + SEffectsOnClientHurt(index); KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health); ZHPOnPlayerHurt(index); } @@ -308,7 +311,7 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) // Forward event to modules. ClassOnClientDeath(index); - ZombieSoundsOnClientDeath(index); + SEffectsOnClientDeath(index); SpawnProtectOnClientDeath(index); RespawnOnClientDeath(index, attacker, weapon); ZHPOnClientDeath(index); diff --git a/src/zr/knockback.inc b/src/zr/knockback.inc index 017a3f8..1eb1601 100644 --- a/src/zr/knockback.inc +++ b/src/zr/knockback.inc @@ -16,57 +16,67 @@ */ KnockbackOnClientHurt(client, attacker, const String:weapon[], hitgroup, dmg_health) { - // Check if the attacker is a player. - if (attacker != 0) + // If attacker is invalid, then stop. + if (!ZRIsValidClient(attacker)) { - // Check if a human attacks a zombie. - if (IsPlayerZombie(client) && IsPlayerHuman(attacker)) + return; + } + + // Client is a human, then stop. + if (IsPlayerHuman(client)) + { + return; + } + + // If attacker is a zombie, then stop. + if (IsPlayerZombie(attacker)) + { + return; + } + + // Get zombie knockback value. + new Float:knockback = ClassGetKnockback(client); + + new Float:clientloc[3]; + new Float:attackerloc[3]; + + GetClientAbsOrigin(client, clientloc); + + // Check if a grenade was thrown. + if (StrEqual(weapon, "hegrenade")) + { + // Get the location of the grenade. + if (KnockbackFindExplodingGrenade(attackerloc) == -1) { - // Get zombie knockback value. - new Float:knockback = ClassGetKnockback(client); - - new Float:clientloc[3]; - new Float:attackerloc[3]; - - GetClientAbsOrigin(client, clientloc); - - // Check if a grenade was thrown. - if (StrEqual(weapon, "hegrenade")) - { - // Get the location of the grenade. - if (KnockbackFindExplodingGrenade(attackerloc) == -1) - { - // If the grenade wasn't found, then stop. - return; - } - } - else - { - // Get attackers eye position. - GetPlayerEyePosition(attacker, attackerloc); - - // Get attackers eye angles. - new Float:attackerang[3]; - GetPlayerEyeAngles(attacker, attackerang); - - // Calculate knockback end-vector. - TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, KnockbackTRFilter); - TR_GetEndPosition(clientloc); - } - - // Retrieve weapon knockback boost. - new Float:boostWeapon = WeaponGetWeaponKnockback(weapon); - - // Retrieve hitgroup knockback boost. - new Float:boostHitgroup = HitgroupsGetHitgroupKnockback(hitgroup); - - // Apply all knockback multipliers. - knockback *= float(dmg_health) * boostWeapon * boostHitgroup; - - // Apply knockback. - KnockbackSetVelocity(client, attackerloc, clientloc, knockback); + // If the grenade wasn't found, then stop. + return; } } + else + { + // Get attackers eye position. + GetPlayerEyePosition(attacker, attackerloc); + + // Get attackers eye angles. + new Float:attackerang[3]; + GetPlayerEyeAngles(attacker, attackerang); + + // Calculate knockback end-vector. + TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, KnockbackTRFilter); + TR_GetEndPosition(clientloc); + } + + // Retrieve weapon knockback boost. + new Float:boostWeapon = WeaponGetWeaponKnockback(weapon); + + // Retrieve hitgroup knockback boost. + new Float:boostHitgroup = HitgroupsGetHitgroupKnockback(hitgroup); + + // Apply all knockback multipliers. + knockback *= float(dmg_health) * boostWeapon * boostHitgroup; + + // Apply knockback. + KnockbackSetVelocity(client, attackerloc, clientloc, knockback); } /** diff --git a/src/zr/sayhooks.inc b/src/zr/sayhooks.inc index 43167cf..71bb290 100644 --- a/src/zr/sayhooks.inc +++ b/src/zr/sayhooks.inc @@ -75,14 +75,6 @@ public Action:SayCommand(client, argc) { ZR_PrintToChat(client, "!ztele stuck"); } - else if (StrEqual(args, "play", false)) - { - SEffectsEmitAmbientSound("ambient/machines/heli_pass_distant1.wav"); - } - else if (StrEqual(args, "stop", false)) - { - SEffectsStopAmbientSound("ambient/machines/heli_pass_distant1.wav"); - } return Plugin_Continue; } diff --git a/src/zr/soundeffects/ambientsounds.inc b/src/zr/soundeffects/ambientsounds.inc new file mode 100644 index 0000000..c4de221 --- /dev/null +++ b/src/zr/soundeffects/ambientsounds.inc @@ -0,0 +1,214 @@ +/* + * ============================================================================ + * + * Zombie:Reloaded + * + * File: ambientsounds.inc + * Description: Plays ambient sounds to clients. + * + * ============================================================================ + */ + +/** + * Global variable that tells if ambient sound cvar data was loaded successfully. + */ +new bool:g_bAmbientSounds; + +/** + * Global variable to store ambient sounds timer handle. + */ +new Handle:tAmbientSounds = INVALID_HANDLE; + +/** + * Array for flagging client to play sound. + */ +new bool:bAmbientSoundsIsPlaying[MAXPLAYERS + 1]; + +/** + * Load ambient sound data. + */ +AmbientSoundsLoad() +{ + // Validate cvars. + g_bAmbientSounds = AmbientSoundsValidateConfig(); +} + +/** + * Client is joining the server. + * + * @param client The client index. + */ +AmbientSoundsClientInit(client) +{ + // Reset flag to play sound on client. + bAmbientSoundsIsPlaying[client] = false; +} + +/** + * Validate ambient sounds cvars. + */ +bool:AmbientSoundsValidateConfig() +{ + // If ambience is disabled, then stop. + new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENTSOUNDS]); + if (!ambience) + { + return false; + } + + // If logging is disabled for ambient sounds, then stop. + if (!LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_AMBIENTSOUNDS)) + { + return false; + } + + // Get ambient sound file. + decl String:sound[SOUND_MAX_PATH]; + GetConVarString(gCvars[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound)); + Format(sound, sizeof(sound), "sound/%s", sound); + + // If file doesn't exist, then log error and stop. + if (!FileExists(sound, true)) + { + // Log invalid sound file error. + ZR_LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Invalid sound file specified in zr_ambientsounds_file.", LOG_FORMAT_TYPE_ERROR); + return false; + } + + // If volume is muted or invalid, then log error and stop. + new Float:ambientvolume = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_VOLUME]); + if (ambientvolume <= 0.0) + { + // Log invalid ambient sound volume error. + ZR_LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.", LOG_FORMAT_TYPE_ERROR); + return false; + } + + // If length is invalid, then log error and stop. + new Float:ambientlength = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_LENGTH]); + if (ambientlength <= 0.0) + { + // Log invalid ambient sound length error. + ZR_LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Ambient sound length is invalid.", LOG_FORMAT_TYPE_ERROR); + return false; + } + + // Add sound file to downloads table. + AddFileToDownloadsTable(sound); + + return true; +} + +/** + * Map is starting. + */ +AmbientSoundsOnMapStart() +{ + // Reset timer handle. + tAmbientSounds = INVALID_HANDLE; +} + +/** + * The round is starting. + */ +AmbientSoundsOnRoundStart() +{ + // Restart ambient sound for all clients. + AmbientSoundsRestart(); +} + +/** + * Client is spawning into the game. + * + * @param client The client index. + */ +AmbientSoundsOnClientSpawn(client) +{ + // If ambience is disabled, then stop. + if (!g_bAmbientSounds) + { + return; + } + + // If flag is enabled, then stop. + if (bAmbientSoundsIsPlaying[client]) + { + return; + } + + // Get ambient sound file. + decl String:sound[SOUND_MAX_PATH]; + GetConVarString(gCvars[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound)); + + // Get ambient sound volume. + new Float:ambientvolume = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_VOLUME]); + + // Emit ambient sound. + SEffectsEmitAmbientSound(sound, ambientvolume, client); +} + +/** + * Restart ambient sound for all clients. + */ +AmbientSoundsRestart() +{ + // If timer is running, kill it. + if (tAmbientSounds != INVALID_HANDLE) + { + KillTimer(tAmbientSounds); + } + + // If ambience is disabled, then stop. + if (!g_bAmbientSounds) + { + return; + } + + // x = client index + for (new x = 1; x <= MaxClients; x++) + { + // If client isn't in-game, then stop. + if (!IsClientInGame(x)) + { + continue; + } + + bAmbientSoundsIsPlaying[x] = false; + } + + // Get ambient sound length. + new Float:ambientlength = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_LENGTH]); + + // Start ambient sounds timer. + tAmbientSounds = CreateTimer(ambientlength, AmbientSoundsTimer, _, TIMER_FLAG_NO_MAPCHANGE); +} + +/** + * Timer callback, Replays ambient sound on all clients. + * + * @param timer The timer handle. +*/ +public Action:AmbientSoundsTimer(Handle:timer) +{ + // If ambience is disabled, then stop. + if (!g_bAmbientSounds) + { + return; + } + + // Get ambient sound file. + decl String:sound[SOUND_MAX_PATH]; + GetConVarString(gCvars[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound)); + + // Get ambient sound volume. + new Float:ambientvolume = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_VOLUME]); + + // Emit ambient sound. + SEffectsEmitAmbientSound(sound, ambientvolume); + + // Get ambient sound length. + new Float:ambientlength = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_LENGTH]); + + // Start new timer with sound length as delay. + tAmbientSounds = CreateTimer(ambientlength, AmbientSoundsTimer, _, TIMER_FLAG_NO_MAPCHANGE); +} \ No newline at end of file diff --git a/src/zr/soundeffects/soundeffects.inc b/src/zr/soundeffects/soundeffects.inc index d0665f5..8982d77 100644 --- a/src/zr/soundeffects/soundeffects.inc +++ b/src/zr/soundeffects/soundeffects.inc @@ -19,22 +19,139 @@ */ #define SOUND_AMBIENT_CHANNEL 8 +#include "zr/soundeffects/ambientsounds" #include "zr/soundeffects/zombiesounds" /** - * Emits an ambient sound + * Load sound effects data. */ -SEffectsEmitAmbientSound(const String:sound[], Float:soundvolume = 1.0) +SEffectsLoad() +{ + // Load ambient sound cvars. + AmbientSoundsLoad(); +} + +/** + * Map is starting. + */ +SEffectsOnMapStart() +{ + // Forward event to sub-modules. + AmbientSoundsOnMapStart(); +} + +/** + * Client is joining the server. + * + * @param client The client index. + */ +SEffectsClientInit(client) +{ + // Forward event to sub-modules. + AmbientSoundsClientInit(client); + ZombieSoundsClientInit(client); +} + +/** + * The round is starting. + */ +SEffectsOnRoundStart() +{ + // Forward event to sub-modules. + AmbientSoundsOnRoundStart(); +} + +/** + * Client is spawning into the game. + * + * @param client The client index. + */ +SEffectsOnClientSpawn(client) +{ + // Forward event to sub-modules. + AmbientSoundsOnClientSpawn(client); + ZombieSoundsOnClientSpawn(client); +} + +/** + * Client has been killed. + * + * @param client The client index. + */ +SEffectsOnClientDeath(client) +{ + // Forward event to sub-modules. + ZombieSoundsOnClientDeath(client); +} + +/** + * Client has been hurt. + * + * @param client The client index. + */ +SEffectsOnClientHurt(client) +{ + // Forward event to sub-modules. + ZombieSoundsOnClientHurt(client); +} + +/** + * Client has been infected. + * + * @param client The client index. + */ +SEffectsOnClientInfected(client) +{ + // Forward event to sub-modules. + ZombieSoundsOnClientInfected(client); +} + +/** + * Emits an ambient sound + * + * @param sound The path to the sound file (relative to sounds/) + * @param soundvolume The volume of the sound (0.0 - 1.0) + * @param client (Optional) Client index to play sound to. + */ +SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client = -1) { // Precache sound before playing. PrecacheSound(sound); - // Emit ambient sound. - EmitSoundToAll(sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, soundvolume); + // Stop sound before playing again. + SEffectsStopAmbientSound(sound); + + if (ZRIsValidClient(client)) + { + // Emit ambient sound. + EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume); + + // Flag client that sound is playing. + bAmbientSoundsIsPlaying[client] = true; + } + else + { + for (new x = 1; x <= MaxClients; x++) + { + // If client isn't in-game, then stop. + if (!IsClientInGame(x)) + { + continue; + } + + // Emit ambient sound. + EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume); + + // Flag client that sound is playing. + bAmbientSoundsIsPlaying[x] = true; + } + } } /** * Stop an ambient sound + * + * @param sound The path to the sound file (relative to sounds/) */ SEffectsStopAmbientSound(const String:sound[]) { @@ -52,6 +169,12 @@ SEffectsStopAmbientSound(const String:sound[]) } } +/** + * Replay an ambient sound + * + * @param sound The path to the sound file (relative to sounds/) + */ + /** * Emits a sound from a client. * diff --git a/src/zr/soundeffects/zombiesounds.inc b/src/zr/soundeffects/zombiesounds.inc index 5521535..8594c16 100644 --- a/src/zr/soundeffects/zombiesounds.inc +++ b/src/zr/soundeffects/zombiesounds.inc @@ -176,7 +176,8 @@ ZombieSoundsOnClientInfected(client) /** * Gets a random zombie sound from hl2 folder. * - * @param sound The randomly picked moan sound. + * @param sound The randomly picked sound. + * @param soundtype The type of sound to get. (See enum ZombieSounds) * @return True if sound was successfully picked, false otherwise. */ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype) diff --git a/src/zr/weapons/weapons.inc b/src/zr/weapons/weapons.inc index 340e2b8..dc44866 100644 --- a/src/zr/weapons/weapons.inc +++ b/src/zr/weapons/weapons.inc @@ -81,7 +81,7 @@ WeaponsLoad() /** * Validate weapon config file and settings. - */ + */ WeaponsValidateConfig() { // If log flag check fails, don't log. diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index e3bbc06..3232f89 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -514,7 +514,7 @@ ZRLogFlagsMenu(client) decl String:z_log_ignore_console[64]; decl String:z_log_modules_enabled[64]; decl String:z_log_module_zombie[64]; - decl String:z_log_module_ambience[64]; + decl String:z_log_module_ambientsounds[64]; decl String:z_log_module_overlays[64]; decl String:z_log_module_saytriggers[64]; decl String:z_log_module_teleport[64]; @@ -537,7 +537,7 @@ ZRLogFlagsMenu(client) Format(z_log_ignore_console, sizeof(z_log_ignore_console), "Don't log messages from the console (%d)", LogHasFlag(LOG_IGNORE_CONSOLE)); Format(z_log_modules_enabled, sizeof(z_log_modules_enabled), "Module based log control (%d)", LogHasFlag(LOG_MODULES_ENABLED)); Format(z_log_module_zombie, sizeof(z_log_module_zombie), "Zombie (%d)", LogHasFlag(LOG_MODULE_ZOMBIE)); - Format(z_log_module_ambience, sizeof(z_log_module_ambience), "Ambience (%d)", LogHasFlag(LOG_MODULE_AMBIENCE)); + Format(z_log_module_ambientsounds, sizeof(z_log_module_ambientsounds), "Ambient Sounds (%d)", LogHasFlag(LOG_MODULE_AMBIENTSOUNDS)); Format(z_log_module_overlays, sizeof(z_log_module_overlays), "Overlays (%d)", LogHasFlag(LOG_MODULE_OVERLAYS)); Format(z_log_module_saytriggers, sizeof(z_log_module_saytriggers), "Chat commands (%d)", LogHasFlag(LOG_MODULE_SAYTRIGGERS)); Format(z_log_module_teleport, sizeof(z_log_module_teleport), "Teleporter (%d)", LogHasFlag(LOG_MODULE_TELEPORT)); @@ -560,7 +560,7 @@ ZRLogFlagsMenu(client) AddMenuItem(menu_log_flags, z_log_ignore_console, z_log_ignore_console, item_state); AddMenuItem(menu_log_flags, z_log_modules_enabled, z_log_modules_enabled, item_state); AddMenuItem(menu_log_flags, z_log_module_zombie, z_log_module_zombie, item_state); - AddMenuItem(menu_log_flags, z_log_module_ambience, z_log_module_ambience, item_state); + AddMenuItem(menu_log_flags, z_log_module_ambientsounds, z_log_module_ambientsounds, item_state); AddMenuItem(menu_log_flags, z_log_module_overlays, z_log_module_overlays, item_state); AddMenuItem(menu_log_flags, z_log_module_saytriggers, z_log_module_saytriggers, item_state); AddMenuItem(menu_log_flags, z_log_module_teleport, z_log_module_teleport, item_state); @@ -638,7 +638,7 @@ public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, sl } case 11: { - ToggleLogFlag(LOG_MODULE_AMBIENCE); + ToggleLogFlag(LOG_MODULE_AMBIENTSOUNDS); ZRLogFlagsMenu(client); } case 12: diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index 1b71adc..36e244e 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -202,7 +202,7 @@ InfectPlayer(client, attacker = -1, bool:motherinfect = false) // Forward event to modules. ClassOnClientInfected(client, motherinfect); - ZombieSoundsOnClientInfected(client); + SEffectsOnClientInfected(client); ZHPOnClientInfected(client); AbortTeleport(client); diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 84fd52e..3faef3b 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -51,7 +51,7 @@ enum ZTeam #define LOG_MODULE_CLASSES 4096 /** Class system - playerclasses/ *.inc */ #define LOG_MODULE_ZOMBIE 8192 /** zombie.inc */ #define LOG_MODULE_SAYTRIGGERS 16384 /** sayhooks.inc */ -#define LOG_MODULE_AMBIENCE 32768 /** ambience.inc */ +#define LOG_MODULE_AMBIENTSOUNDS 32768 /** ambientsounds.inc */ #define LOG_MODULE_OVERLAYS 65536 /** overlays.inc */ #define LOG_MODULE_TELEPORT 131072 /** teleport.inc */ #define LOG_MODULE_WEAPONS 262144 /** Weapons module - weapons/ *.inc */