Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Gui--
- local menu = gui.Reference("MISC", "GENERAL", "Extra")
- local killsound = gui.Checkbox(menu, "killsound", "Kill Sound", 0)
- local killsound_time = gui.Slider(menu, "killsound_time", "Killsound Time", 0.6, 0, 10, 0.1 )
- local currentTime = 0
- local timer = 0
- local enabled = true
- local fl_val, flp_val = nil, nil
- killsound:SetDescription("Plays sound when you kill someone")
- killsound_time:SetDescription("*Should be equal to your file's length")
- gui.Text(menu, "File name and settings should be:")
- gui.Text(menu, "voice_input")
- gui.Text(menu, "Wave Microsoft (.wav)")
- gui.Text(menu, "22050hz MONO 32 or 16 bit")
- --Function--
- local function handler()
- local snd_time = killsound_time:GetValue()
- currentTime = globals.RealTime()
- if currentTime >= timer then
- timer = globals.RealTime() + snd_time
- if enabled then
- client.SetConVar("voice_loopback", 0, true)
- client.SetConVar("voice_inputfromfile", 0, true)
- client.Command("-voicerecord", true)
- enabled = false
- gui.SetValue("misc.fakelag.enable", fl_val)
- gui.SetValue("misc.fakelag.peek", flp_val)
- end
- end
- end
- local function on_player_death(Event)
- local snd_time = killsound_time:GetValue()
- if killsound:GetValue() == false or Event:GetName() ~= "player_death" then
- return
- end
- local INT_ATTACKER = Event:GetInt("attacker")
- if INT_ATTACKER == nil then
- return
- end
- local local_ent = client.GetLocalPlayerIndex()
- local attacker_ent = entities.GetByUserID(INT_ATTACKER)
- if local_ent == nil or attacker_ent == nil then
- return
- end
- if (attacker_ent:GetIndex() == local_ent) then
- fl_val, flp_val = gui.GetValue("misc.fakelag.enable"), gui.GetValue("misc.fakelag.peek")
- gui.SetValue("misc.fakelag.enable", 0)
- gui.SetValue("misc.fakelag.peek", 0)
- client.SetConVar("voice_loopback", 1, true)
- client.SetConVar("voice_inputfromfile", 1, true)
- client.Command("+voicerecord", true)
- timer, enabled = globals.RealTime() + snd_time, true
- end
- end
- --Callbacks--
- client.AllowListener("player_death")
- callbacks.Register("FireGameEvent", on_player_death)
- callbacks.Register("Draw", handler)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement