local misc_hitsound = menu.Combo(misc_name, "> Custom hitsound", {"$ Disabled", "$ bameware", "$ bubble", "$ COD", "$ minecraft egg", "$ metallic", "$ minecraft hit", "$ stapler", "$ custom"}, 0)
local misc_hitsound_textbox = menu.TextBox(misc_name, "File", 200, "", "$ Enter filename")
-- Хитсаунд пресеты (можно убрать выбор готовых, что бы пользователи сами вписывали нужный файл)
-- https://drive.google.com/file/d/1f6B1WbyIxMhggUMR587rxbI7FquXDMyZ/view?usp=sharing
cheat.RegisterCallback("events", function(event)
g_Config:FindVar("Visuals","World", "Hit", "Hit Sound"):SetBool(false)
ffi.cdef[[
bool PlaySound(const char *pszSound, void *hmod, uint32_t fdwSound);
]]
-- https://docs.microsoft.com/en-us/previous-versions/dd743680(v=vs.85)
local Winmm = ffi.load("Winmm")
local function PlaySound(file)
Winmm.PlaySound(file, nil, 0x00020003) -- SND_ASYNC | SND_NODEFAULT | SND_FILENAME
end
local file = ""
if misc_hitsound:GetInt() == 1 then
file = "C:\\pasta\\bameware.wav"
elseif misc_hitsound:GetInt() == 2 then
file = "C:\\pasta\\bubble.wav"
elseif misc_hitsound:GetInt() == 3 then
file = "C:\\pasta\\cod.wav"
elseif misc_hitsound:GetInt() == 4 then
file = "C:\\pasta\\egg.wav"
elseif misc_hitsound:GetInt() == 5 then
file = "C:\\pasta\\metallic.wav"
elseif misc_hitsound:GetInt() == 6 then
file = "C:\\pasta\\minecraft.wav"
elseif misc_hitsound:GetInt() == 7 then
file = "C:\\pasta\\stapler.wav"
elseif misc_hitsound:GetInt() == 8 then
file = "C:\\pasta\\".. misc_hitsound_textbox:GetString()
end
local event_name = event:GetName()
if misc_hitsound:GetInt() ~= 0 then
if event_name == "player_hurt" then
local attacker = g_EngineClient:GetPlayerForUserId(event:GetInt("attacker", 0))
if attacker == g_EngineClient:GetLocalPlayer() then
PlaySound(file)
end
end
end
end